Skip to content

Service keys

A service key is for your own application, server to server. A person using the CLI or an assistant through MCP logs in with Keycloak, not with a key.

Terminal window
curl -s https://api.prudai.com/v1/account \
-H "Authorization: Bearer prudai_sk_live_..."
PrefixWorks onData
prudai_sk_live_https://api.prudai.com/v1production
prudai_sk_test_https://api.staging.prudai.com/v1staging, test data

A key on the wrong environment gets 401 key_environment_mismatch.

  • One organisation. The organisation comes from the key, never from the request.
  • Scopes. A key can only do what is on the key. Compose it per product, object and verb. See Scopes and permissions.
  • Expiry. Optional expiry date; afterwards 401 api_key_expired.
  • IP list. Optional; other addresses get 403 ip_not_allowed.
  • Writing waits for a person. A write scope on a key does not skip the approval.

You do that in the Prudai Console, under Keys. Through the API and the CLI (prudai keys) it is coming soon.

  • You see the full key once. Prudai stores only a hash.
  • Rotating gives a new key; you see the new value once.
  • Revoking works immediately; afterwards 401 api_key_revoked.

Never put a key in frontend code or in a repository.