/api/v2 is authenticated with an API key sent as a bearer token:
401.
Connect a client
For the MCP server, the SDKs, and the CLI you never handle a key yourself:~/.diagrams-so/credentials.json, readable only by you, and is shared by
the MCP server and both SDKs on that machine. Connected apps appear under Settings → AI Provider with
a Device badge, and you can revoke any of them in one click.
Re-connecting from the same machine replaces that machine’s previous key instead of adding another
one, so keys do not pile up.
Create a key manually
For CI, servers, or raw HTTP, create a key under Settings → AI Provider → Create key and send it as a bearer token.Keys
- Shown once. The full key is returned only at creation. If you lose it, revoke it and create a new one.
- Live vs test.
dgz_live_keys run against production.dgz_test_keys run in test mode (see below). - Expiry. Set an expiry of 30 days, 90 days, or never. Keys created by
loginexpire in 90 days. - Revoke anytime. Revocation takes effect immediately.
Keys are stored only as a salted, peppered hash. The raw key is never persisted and cannot be
recovered by anyone, including staff. See Security.
Scopes
Each key carries scopes so you can grant least privilege:
In the app these appear as a simple Read-only, Write-only, or Read & write choice per resource.
Test mode
Adgz_test_ key runs in test mode, which exercises the full API and applies lower rate limits so
you can develop against realistic behavior.
Handling failures
401 Unauthorized
Missing, malformed, expired, or revoked key.
403 Forbidden
Key lacks the scope for this action.
429 Too Many Requests
Slow down and retry.
402 Out of credits
Top up to run billable actions.