Skip to main content
Migrate pre-hashed API keys from an existing provider into Unkey. Use this to move keys from another system without requiring users to rotate their credentials. You provide the already-hashed keys and Unkey stores them directly, so existing API keys continue to work after migration. The endpoint returns HTTP 200 even on partial success; hashes that could not be migrated are listed in the response. Important: You must obtain a migrationId from Unkey support before using this command. Keys that already exist in the system will appear in the failed array rather than causing the entire request to fail. Required permissions: Your root key must have one of the following permissions:
  • api.*.create_key (to migrate keys to any API)
  • api.<api_id>.create_key (to migrate keys to a specific API)
See the API reference for the full HTTP endpoint documentation.

Usage

Flags

string
required
Identifier of the configured migration provider/strategy to use (e.g., “your_company”). You will receive this from Unkey’s support staff. Must be 3-255 characters.
string
required
The ID of the API that the keys should be inserted into. Must be 3-255 characters.
JSON string
required
JSON array of key migration objects. Each object describes a single key to migrate.

Global Flags

Examples

Output

Default output shows the request ID, followed by the migration results:
With --output=json, the full response envelope is returned:
Last modified on July 23, 2026