err:unkey:data:key_space_not_founddetail names the first missing keyspace.
Example response
Likely causes
- You passed the API ID (
api_...) instead of the keyspace ID (ks_...). They’re different values on the same API. - The API behind the keyspace was deleted. Deleting an API from the dashboard also deletes its keyspace, so a policy that used to work can start failing.
- The keyspace is in another workspace.
How to fix
- Use the keyspace ID shown on the API in the dashboard, or returned by
apis.getApi. - Fix every keyspace ID in the policy.
gateway.setPoliciesandgateway.updatePolicystop at the first missing one, so several bad IDs show up one at a time.
Related errors
err:unkey:data:key_auth_not_found: the deprecated deploy endpoint couldn’t find a keyspace.err:unkey:data:policy_not_found: the policy id doesn’t exist.err:unkey:data:api_not_found: the API itself doesn’t exist.