Authentication
Create a Pictograph API key, set it for the SDK and CLI or send it as X-API-Key over REST, and pick its role. Also covers CLI profiles and rotation.
On this page
One API key works for the SDK, the CLI and REST.
Create a key
In Settings → API Keys, choose New API
Key, pick a role (member can upload and train) and copy the key. Admins and owners
create keys; members and above can view one again in Settings.
Use it
export PICTOGRAPH_API_KEY=pk_live_...
The SDK and CLI read it from the environment. Check it works:
pictograph credits balance
from pictograph import Client
print(Client().credits.balance().remaining_usd)
curl -H "X-API-Key: $PICTOGRAPH_API_KEY" https://api.pictograph.io/api/v1/developer/credits/balance
To save the key for the CLI instead, run pictograph login. To pass it in code, use
Client(api_key="pk_live_...").
Roles
| Role | Read | Create and update | Delete | Members, invites, keys, settings |
|---|---|---|---|---|
viewer |
Yes | - | - | - |
member |
Yes | Yes | - | - |
admin |
Yes | Yes | Yes | Yes |
owner |
Yes | Yes | Yes | Yes |
Only an owner can change or remove another owner. Organization members can also have the
annotator role; keys can’t.
Resolution order
When several sources hold a key, the first wins:
| Priority | Source |
|---|---|
| 1 | --api-key flag (CLI) or Client(api_key=...) (SDK) |
| 2 | --profile <name> (CLI only): that profile’s key in ~/.pictograph/config.toml |
| 3 | PICTOGRAPH_API_KEY environment variable |
| 4 | PICTOGRAPH_PROFILE (CLI only): that profile’s key |
| 5 | [default].api_key in ~/.pictograph/config.toml (CLI only) |
| none | ConfigurationError (SDK); exit code 2 (CLI) |
Keep one CLI profile per key: a key belongs to one organization (profiles).
Rotation
A key’s value never changes. Create a new key, swap it in, check it works, then revoke the old one:
pictograph api-keys create ci-2026-11 --role member --save-profile ci
pictograph --profile ci credits balance # the new key works
pictograph api-keys revoke ci-2026-10 --yes # then revoke the old one
Errors
A missing, unknown or revoked key raises AuthError (401); a role too low raises
ForbiddenError (403). Every error and its fix: Error handling.