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

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.
Outcome: Resolve API keys and the API base URL through explicit arguments, environment variables, or CLI configuration.
UnitlabClient resolves configuration in this order:
Explicit api_key or api_url constructor argument.
UNITLAB_API_KEY or UNITLAB_API_URL environment variable.
Values written by unitlab configure.
If no API key is found, the constructor raises AuthenticationError before making a request.
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.
Execution surface
Pinned unitlab==3.0.0 application environment on Python 3.10+.
Identity
Least-privilege API key supplied through approved configuration.
Target resolution
Stable resource IDs and an explicitly bounded target set.
Success evidence
Typed return fields, server-side state, and downstream acceptance of the result.
Authentication or authorization fails
Stop, correct the service identity or access model, rotate exposed credentials, and rerun a read-only check.
Validation or entitlement rejects the operation
Correct the input or entitlement; do not retry an unchanged request.
A request times out
Inspect remote state before repeating a mutation because the server may have accepted it.
Asynchronous processing exceeds its deadline
Preserve the Batch Queue or release ID, continue bounded monitoring, and inspect item-level failures.
Only part of a batch succeeds
Keep successful identifiers, isolate failed rows, and retry only the corrected subset.
Pin and test the production SDK version. Use stable IDs, keep secrets out of logs and command history, and record the correlation ID, target IDs, counts, final state, and redacted error details for material state changes.
Continue with Unitlab: Unitlab’s data annotation platform
export UNITLAB_API_KEY="YOUR_API_KEY"
export UNITLAB_API_URL="https://api.unitlab.ai"from unitlab import UnitlabClient
client = UnitlabClient()
try:
print(client.projects.list())
finally:
client.close()unitlab configure --api-key "$UNITLAB_API_KEY"
unitlab configure --api-url "https://api.unitlab.ai"