Authentication and configuration
Resolve API keys and the API base URL through explicit arguments, environment variables, or CLI configuration.
1. Create an API key

Workspace Settings › API keys is the credential issuance surface. Create a key there, copy it directly into an approved secret manager, and never reveal it in documentation, logs, command history, or screenshots.
2. Choose how to configure the client
UnitlabClient resolves configuration in this order:
Explicit
api_keyorapi_urlconstructor argument.UNITLAB_API_KEYorUNITLAB_API_URLenvironment variable.Values written by
unitlab configure.
If no API key is found, the constructor raises AuthenticationError before making a request.
The following shell example uses placeholders. Set your real key through your environment or secret manager, and use the API URL assigned to your deployment.
3. Verify access
Save this as check_connection.py, then run python check_connection.py in your configured environment:
A successful request returns the projects visible to the key. An empty list can be a valid result for an empty workspace. You can make the same read-only check with:
Optional: save workstation configuration
For a developer workstation, the CLI can persist configuration:
Use a workspace-owned service identity where possible. Rotate keys on an explicit schedule and immediately after suspected exposure.
Troubleshoot the connection
AuthenticationError before a request
Set an API key using one of the configuration methods above.
Server rejects the credential
Confirm the key belongs to the intended workspace and is still valid.
Access denied for a resource
Check the key's permissions and the target resource ID.
Changes to saved configuration have no effect
Explicit arguments and environment variables take precedence.
Continue with the Python SDK quickstart, CLI quickstart, or HTTP API overview.
Continue with Unitlab: Unitlab’s data annotation platform