Get API key

Authentication

View as Markdown

Bearer tokens, key format, scopes, and rotation.

Every request carries your API key as a bearer token, in one of these headers:

Text
Authorization: Bearer <ACCESS_KEY_ID>:<SECRET>
x-api-key: <ACCESS_KEY_ID>:<SECRET>

The key's two parts are joined by a colon and sent as one token. The OpenAI SDKs send Authorization and the Anthropic SDKs send x-api-key. Both work on every /v1 endpoint that takes an API key. If a request carries both, the API uses Authorization.

The Model servers API, the Workspaces API and the Kubernetes API take Authorization only. The Model servers API also accepts the short-lived token of a service identity with May manage model servers ticked.

The model list is the one endpoint that answers without a key. See Verifying a key works.

Key shape

  • Access key id: 32 characters, starting with PMIND. It encodes the user who owns the key.
  • Secret: 64 hexadecimal characters. The server stores only a one-way hash of it, which can't be reversed.

Example:

Text
PMIND...:...

Treat the full string, colon included, as one opaque secret.

Creating, rotating, revoking

You manage API keys on the API Keys page in the sidebar:

  • Create: a description, an expiry (30 days to 1 year), a rate limit and an optional spend cap. The secret is shown once, at creation.
  • Rotate: create a new key, swap it into your client, then revoke the old one.
  • Revoke: takes effect immediately. The next request with that key returns 401.

Org admins can also create, list and revoke members' keys from a script with the key management API.

What a key carries

  • Which models you can call. The API enforces your org's model access. A model your org can't use answers 404, and an external provider model your org has no grant for answers 403.
  • How much you can spend. Each request's tokens are priced and deducted. When spend reaches the cap, calls return 402 until the cap is raised.
  • How fast you can call. Each key has a requests-per-minute limit, enforced over a sliding window. Going over it returns 429.

Security

Treat keys like passwords. Anyone with the full bearer string can spend up to your budget cap until you revoke it.

  • Don't commit keys to source control. Use environment variables or a secret manager.
  • Don't put keys in browser code. The API is for server-side use: if you need browser access, proxy requests through your own backend.
  • Rotate on a schedule, and at once if a key may be exposed: a committed secret, a departing teammate, a leaked log.
Warning

Every key expires on the date you picked when you created it. Rotate it before then.

Verifying a key works

cURL
curl -s -o /dev/null -D - "https://api.privatemind.com/v1/models" \
  -H "Authorization: Bearer $PMIND_KEY" | grep -i -E '^HTTP|^x-privatemind-key'

x-privatemind-key: valid means the key is valid and active. rejected, or a 401, means it isn't. The model list returns 200 even without a valid key, so read the header. See Errors for other codes.

Where next

  • Quickstart for an end-to-end first request.
  • Rate limits for the budget and RPM ceilings your key enforces.
  • Errors for the full status-code map.