Data
err:unkey:data:key_not_found
The requested key was not found
Example
What Happened?
This error occurs when you’re trying to perform an operation on a specific API key using its ID, but the key with that ID doesn’t exist in the system. This is different from the authentication error err:unkey:authentication:key_not_found
, which occurs during the authentication process.
Common scenarios that trigger this error:
- Attempting to update, delete, or get information about a key that has been deleted
- Using an incorrect or malformed key ID
- Trying to access a key that exists in a different workspace
- Reference to a key that hasn’t been created yet
Here’s an example of a request that would trigger this error:
How To Fix
Verify that you’re using the correct key ID and that the key still exists in your workspace:
- Check the key ID in your request for typos or formatting errors
- Confirm the key exists by listing all keys in your workspace via the Unkey dashboard or the API
- Verify you’re working in the correct workspace
- If you need to create a new key, use the
keys.createKey
endpoint
Here’s how to list all keys to find the correct ID:
Common Mistakes
- Copy-paste errors: Incorrect key IDs due to copy-paste mistakes
- Deleted keys: Attempting to reference keys that have been deleted
- Environment confusion: Looking for a key in production that only exists in development
- Workspace boundaries: Trying to access a key that exists in another workspace
Related Errors
- err:unkey:authentication:key_not_found - When an API key used for authentication doesn’t exist
- err:unkey:data:api_not_found - When the requested API doesn’t exist
- err:unkey:data:workspace_not_found - When the requested workspace doesn’t exist