err:frontline:client:invalid_key401 Unauthorized, and the message is the same whatever the reason.
Example response
If you’re calling an API hosted on Unkey
Check that you’re sending the whole key, with no extra whitespace or quotes, and that it’s the key for this API rather than another service. If the key used to work, the API owner may have disabled, expired, rolled, or deleted it. Only they can tell you which, so contact them with the request ID.If you own this API
The gateway returns this code for any key that isn’t valid for this API, unless another code fits better (missing permissions, rate limited, or out of credits). Common causes:- The key doesn’t exist or was deleted.
- The key is disabled or expired.
- The key is from a keyspace your key-auth policy doesn’t list.
- The workspace that owns the key is disabled.
How to fix
- Look the key up in the dashboard or with
keys.getKey. Check that it’s enabled, not expired, and in a keyspace the policy accepts. - If callers hold keys from a keyspace you added recently, add that keyspace to the policy and create a new deployment. Policy changes only apply to deployments created after the change.
- If the key looks fine, check whether the workspace that owns it is disabled.
Related errors
err:frontline:client:missing_credentials: no key was found at all.err:frontline:client:insufficient_permissions: the key is valid but lacks permissions.err:unkey:data:key_not_found: the equivalent when you look a key up through the Unkey API rather than the gateway.