API keys

You will need an API key to use the Labelbox GraphQL API or the Python API.

Create API Key

Click Settings from the upper-right drop-down menu.

Click "Create API Key" and give it a name you’ll recognize based on how the API will be used.

Copy the API key to your clipboard by clicking the blue icon. The API key will be hidden once you leave this page so make sure to save your API Key somewhere else.

Delete API Key

Click "Settings" from the upper-right drop-down menu.

Click the 3 dots on the far right of the API Key you want to delete, and click "Delete".

GraphQL API authentication

Authentication tokens (API Keys) are accepted by our GraphQL API in one of two ways.

  1. Provided as an authorization header [RECOMMENDED]
# Pass API key as a header to make a graphql query
curl 'https://api.labelbox.com/graphql' \
-H 'Authorization: Bearer <API_KEY_HERE>' \
-H 'content-type: application/json' \
-d '{"query":"[QUERY HERE]"'

# Pass API key as a header to request a mask for an annotated object
curl 'https://api.labelbox.com/masks/feature/:id' \
-H 'Authorization: Bearer <API_KEY_HERE>'
  1. Provided as a query parameter. We do not recommend sending API keys as a query parameter for GraphQL queries.
# Passing API key as a query parameter to request a mask for an annotated object
curl 'https://api.labelbox.com/masks/feature/:id?token=<API_KEY_HERE>'


Was this page helpful?