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
- Send the key in
X-API-Keyfrom your backend. Secret keys (dv_..._sk_) belong in server-side code only; a key shipped to a browser should be treated as publicly visible. - 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.
- 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.
- Replace hand-built Authorization headers. If you pass a bearer token, regenerate it rather than patching a truncated one.
Related
- Error Code Reference — the
UNAUTHORIZEDrow with its status and cause. - Auth and API keys runbook — key lifecycle, modes, and revocation.
- Error Handling Examples — response-envelope handling patterns in code.