Skip to main content
Menu
Get started / Authentication
Get started

Authentication

How requests are authenticated: the key, what it can do, and how to keep it safe.

5 minute readUpdated 13 November 2026curl · Python · TypeScript

How authentication works#

Send your key as a bearer token: Authorization: Bearer pw_live_…. A key belongs to one project, and that project's policy applies to every request made with it.

A request with a key
curl https://api.panward.ai/v1/receipts/rcpt_01JC7Q4N9W3XK2H8ZP5T6V7B8M \
  -H "Authorization: Bearer $PANWARD_API_KEY"

Keys are created and managed in the console, under API keys. Owners and Admins manage every key of the organization; Developers manage the keys of their own projects.

Keys and the project#

A key looks like pw_live_, a 22-character id, an underscore and a 43-character secret. The console shows the first 12 characters as the key's prefix. Panward stores a hash of the key, not the key, so a lost key cannot be recovered: create a new one. The secret is shown once, when you create or rotate a key. There are no pw_test_ keys at launch.

Keep keys in a secret manager or an environment variable, one key per service and environment. Never put one in a browser, a mobile app or source control.

Scopes#

A key carries scopes. A key without the scope an operation needs gets 403 permission_denied. Give a service the least it needs: an inference service inference, a reporting job usage.read, a verifier receipts.read. The table is generated from the API contract.

ScopeAllows
inferencePOST /v1/chat/completions, POST /v1/completions, POST /v1/embeddings, POST /v1/rerank, POST /v1/audio/transcriptions, POST /v1/images/generations
models.readGET /v1/models, GET /v1/models/{vendor}/{name}, GET /v1/models/{id}
receipts.readGET /v1/receipts/{id}, GET /v1/receipts
usage.readGET /v1/usage

Restrictions on a key#

  • Allowed models. A list of model ids. Any other model returns 403 model_not_enabled.
  • IP allowlist. Address ranges the key may be used from. A caller outside them gets 403 ip_not_allowed.
  • Limits. Requests per minute, tokens per minute, maximum input tokens and a monthly spend limit. The lowest limit that applies, among the key, the project and the organization, wins. See Limits.
  • Expiry. An expired key returns 401 invalid_api_key.

Rotate and revoke#

Rotate key issues a new secret and keeps the old one valid for an overlap you choose, from zero to 168 hours (7 days). Deploy the new secret, then let the overlap end. Revoke key takes effect in every region within 30 seconds at the latest.

If a key leaks, revoke it first, then look at the requests made with it and at the audit log. A key that a public secret-scanning programme reports to Panward is revoked at once and the organization's Owners and the key's creator are notified.

Authentication errors#

Status and typeWhenWhat to do
401 authentication_requiredNo Authorization header.Send the bearer key.
401 invalid_api_keyThe key is unknown, revoked or expired.Create a new key or rotate it.
403 permission_deniedThe key lacks the scope the operation needs.Add the scope or use another key.
403 ip_not_allowedThe caller's address is outside the key's or the policy's allowlist.Add the range or call from an allowed address.
403 organization_suspendedThe organization is suspended.Contact support.
401 for an unknown, revoked or expired key
{
  "error": {
    "type": "invalid_api_key",
    "message": "The API key is invalid, revoked or expired.",
    "param": null,
    "request_id": "req_01JC7Q4N8G5T2R9X1M3K6P7W4D",
    "doc_url": "https://panward.ai/docs/errors#invalid_api_key"
  }
}

Every error type is on the Errors page.

Calls that need no key#

GET /v1/attestation and GET /v1/health need no key, and neither do the open endpoints under https://panward.ai/api/public. The attestation takes a nonce of your choosing, 64 hexadecimal characters.

No key needed: the gateway's attestation
curl "https://api.panward.ai/v1/attestation?nonce=5f3c9a1e7b2d4c6f8a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f"
Was this page helpful?Suggest an edit