Describes how to install, update, and authenticate to the Labelbox Python SDK.

Many actions and workflows available in the Labelbox app can be automated using the Python SDK, which provides access to the Labelbox API.


  • Make sure pip is installed and up-to-date.

  • Use the Workspace settings menu of the Labelbox app to create an API key. Store your key in a safe place, as you cannot view it after it has been created.

  • Python: 3.8 - 3.12

Install or upgrade SDK

After you create an API key, you can start using our Python SDK.

To install, run either pip install labelbox orpip install "labelbox[data]" in your command line.

pip install "labelbox[data]" 
# or
pip install labelbox
"labelbox[data]"Installs all required dependencies (libraries, tools to manipulate annotations, and more.)
labelboxInstalls all required libraries for client-only functionality
# install latest labelbox version
!pip install labelbox

import labelbox as lb

# Enter your Labelbox API key here

# Create Labelbox client
client = lb.Client(api_key=LB_API_KEY)

To upgrade to the latest version, use your package manager:
pip install --upgrade labelbox

To run the Python SDK in a Docker container, use the included Dockerfile as a starting place.

Related info:


You need an API key to authenticate your client. You can:

  • Save your key to an environment variable:

    user@machine:~$ export LABELBOX_API_KEY="<your_api_key>"
    user@machine:~$ python3

    Then, import and initialize the API Client.

    import labelbox as lb
    client = lb.Client()
  • Paste your API key directly into your script (not recommended)

    import labelbox as lb
    if __name__ == '__main__':
        API_KEY = "<your_api_key_here>"
        client = lb.Client(API_KEY)

Remember that your API key authorizes access to Labelbox, your account, and your data assets; treat it as carefully as any other set of credentials, and make sure the scope of the key is set according to the usage is meant for.