Labelbox API key

Shows how to create an API key that lets apps and other services access Labelbox APIs and endpoints.

Labelbox authenticates API requests using API keys that you create and distribute as needed. API keys authenticate access to the Python SDK; they also grant access to third-party services, such as cloud providers.

Admins can use Workplace Settings to create new API keys, view existing API keys, and delete individual keys.

API keys authorize access to Labelbox on your behalf. Treat API keys as carefully as other access tokens, credentials, or passwords.

Create a new API key

To create a new API key:

  1. Sign in to the Labelbox app and then select Workplace Settings from the main menu.

  2. Select the API keys tab and then select New API key.

  3. When the Create new API key prompt appears, enter a descriptive name for your API key and choose permissions according to the level of access you would like to provide.

The API key access level within your workspace is determined by its permissions.

The API key access level within your workspace is determined by its permissions.

  1. Your new key is displayed in an API key created prompt.

Use the Copy button to copy the key to the Clipboard.

We strongly recommend saving your new key in a safe location now. Once this prompt is closed, you cannot retrieve its value.

  1. Select Done to close the prompt.

View and delete API keys

Use the API keys tab of Workplace Settings to view and delete existing API keys.

To delete an API key:

  1. From the API Keys tab of Workplace Settings, locate the key you wish to delete and then open its command menu.

  2. Select Delete

Once an API key is deleted, it no longer authenticates API requests. Any app, script, or service using the key loses access to Labelbox.

To minimize disruptions, we recommend against deleting keys until you've created new keys and used them to replace outdated keys.

Guidelines and best practices

When working with API keys, remember that:

  • API keys do not expire and must be deleted manually to revoke access.
  • API keys access to your Labelbox account and data. Treat API keys like passwords and other credentials.
  • The value of an API key can only be retrieved once from the API key created prompt when the key is first created.
  • If you lose the value of your API key (or cannot determine how it's being used), delete it and create a new one.

Client

The Labelbox Client is essential for all SDK workflows. It connects to a Labelbox server with your authentication API key and provides functions for querying and creating data assets.

Instantiate Labelbox Client

Your Client is associated with the API key of your account. See more in Create an API key.

import labelbox as lb

## Option 1: List API_KEY in your Python script
API_KEY = "<YOUR_API_KEY>"
client = lb.Client(api_key=API_KEY)

## Option 2: Pass your API key as an environment variable $LABELBOX_API_KEY
# In your terminal:
user@machine:~$ export LABELBOX_API_KEY="<YOUR_API_KEY>"
# In Python:
client = lb.Client()