This error occurs when you’re trying to create an identity with an external ID that already exists in your Unkey workspace. External IDs must be unique within a workspace to avoid confusion and maintain data integrity.Common scenarios that trigger this error:
Creating an identity with an external ID that’s already in use
Re-creating a previously deleted identity with the same external ID
Migration or import processes that don’t check for existing identities
Duplicate API calls due to retries or network issues
Here’s an example of a request that would trigger this error:
Copy
Ask AI
# Attempting to create an identity with an external ID that already existscurl -X POST https://api.unkey.com/v2/identities.createIdentity \ -H "Content-Type: application/json" \ -H "Authorization: Bearer unkey_YOUR_API_KEY" \ -d '{ "externalId": "user_123", "meta": { "name": "John Doe", "email": "john@example.com" } }'