Skip to main content

What this error means

UNAUTHORIZED is returned with HTTP status 401 when the request does not carry a valid credential: no API key or session at all, a key that has been revoked, a key used against the wrong mode (live versus test), or a malformed bearer token. The request is rejected before any work is done. Every response for this error carries this page’s address in meta.docs_url:

Cause

How to fix it

  1. Send the key in X-API-Key from your backend. Secret keys (dv_..._sk_) belong in server-side code only; a key shipped to a browser should be treated as publicly visible.
  2. Check live versus test. Confirm the key’s mode matches the host and mode you are sending against; a perfectly valid key in the wrong mode is indistinguishable from a bad one.
  3. Re-mint revoked keys. If the key was deleted, or a SCIM deprovisioning cascade revoked a departed member’s keys, create a new key under Settings → API Keys. Note that SCIM-provisioned members are not blocked from the API while active: they can mint and use keys like any member, and revocation happens at deprovisioning, not at provisioning.
  4. Replace hand-built Authorization headers. If you pass a bearer token, regenerate it rather than patching a truncated one.
A 401 is never transient: retrying the same credential produces the same rejection.