key_not_found means the key id is well formed, but no key with that id exists in the organization of your credential. Read this page if reading, revoking or rotating a key by id fails with a 404.
What happened
Routes:GET /v1/keys/{key_id}DELETE /v1/keys/{key_id}POST /v1/keys/{key_id}/rotate
- The calling key belongs to a different organization than the key you are looking for.
- The id was mistyped or truncated.
state: "revoked", so revoking a key does not cause this error. Revoking a key that is already revoked returns 200 with the original revoked_at.
A path value that does not start with key_ is refused earlier with malformed_key_id, and a value starting with otsk_ with secret_in_path.
How to fix
- List the keys the credential can see with
GET /v1/keysand pick theidfrom there. - Use a credential from the organization that owns the key.
- Store key ids as opaque strings and send them back unchanged.
Example
keys_read. Secrets are never returned here.
Related
- API keys in the console - every key in your organization, with its id and state.
- Key rotation - rotate or replace a key by id.
- malformed_key_id - the path value is not a key id.
- Problem codes - every code, its status, and whether a retry can help.