Skip to main content
invalid_credential means OpenType received a bearer credential and rejected it. Read this page if calls that used to work now fail with a 401, or if a new key is refused.

What happened

Routes: every protected route under /v1/, including runs, keys, usage, quota and billing. OpenType reads the value after Bearer. A value starting with otsk_ is checked as an API key; anything else is checked as a console session. The credential was refused for one of these reasons: A revoked key gets invalid_credential, not key_revoked. key_revoked is returned only when you try to rotate a revoked key. The response does not say which reason applied, and it does not carry a WWW-Authenticate header.

How to fix

Check the key, in this order:
  1. Shape. The secret is 69 characters: otsk_ plus 64 lowercase hex. A trailing newline, surrounding quotes, or a truncated copy breaks it. Trim the value when you load it.
  2. The right value. A key id (key_...) or a secret_prefix (otsk_ plus 8 characters) is not a secret. The full secret was shown once, when the key was created or rotated.
  3. State. Find the key on the API keys page or with GET /v1/keys, and match its secret_prefix against the first 13 characters of your secret. If its state is revoked, create a new key.
  4. Rotation. If the key was rotated, only the newest secret works. Update every service that still holds the old one.
  5. Environment. Check that the service loads the key you expect, for example after a deploy or a change in your secret store.
In the console, an expired session is handled by signing in again. Sending the same credential again gives the same answer. Fix the credential, then retry.

Example

A startup check that catches a bad key before real traffic, using a cheap read:
The check needs a key that holds runs_read. A key without it gets scope_denied, which still proves the key itself is valid.