Skip to main content

401 Unauthorized

401 Unauthorized · AuthenticationError. The API couldn't identify you. Either no key was sent, or the key wasn't recognised.

Missing API key​

Missing X-API-Key header, or the SDK raises AuthenticationError before sending anything.

  • REST APIs: send the key in a header named exactly X-API-Key.
  • SDKs: set CUSTODIAN_SDK_API_KEY, or pass api_key / apiKey. Restart the process after changing it.
  • MCP server: send Authorization: Bearer <key>. See MCP authentication.

No key at all? The API Keys page shows No API Keys Yet until you activate a plan. Signing in alone doesn't create a key.

SituationFix
No active planActivate a plan, then refresh API Keys
Paid checkout done, no key yetRefresh API Keys, wait a few seconds, refresh again
Still nothingCheck you're signed in with the checkout email, then contact support

Invalid API key​

Invalid API key. A key was sent, but it isn't recognised.

  • Copy it again from API Keys, with no stray spaces or line breaks.
  • Check the variable: CUSTODIAN_SDK_API_KEY for the SDKs, CUSTODIAN_API_KEY for the curl examples.
  • Restart your process after changing an environment variable or secret.

See also​

Platform API authentication · Guardian Layer API authentication