keys
Migrate API key(s)
Returns HTTP 200 even on partial success; hashes that could not be migrated are listed under data.failed.
Required Permissions Your root key must have one of the following permissions for basic key information:
- api.*.create_key (to migrate keys to any API)
- api.<api_id>.create_key (to migrate keys to a specific API)
post/v2/keys.migrateKeys
Request body
Example request
{
"migrationId": "your_company",
"apiId": "api_123456789",
"keys": [
{
"hash": "your_already_hashed_key",
"name": "Payment Service Production Key",
"externalId": "user_1234abcd",
"meta": {
"plan": "enterprise",
"featureFlags": {
"betaAccess": true,
"concurrentConnections": 10
},
"customerName": "Acme Corp",
"billing": {
"tier": "premium",
"renewal": "2024-12-31"
}
},
"roles": [
"api_admin",
"billing_reader"
],
"permissions": [
"documents.read",
"documents.write",
"settings.view"
],
"enabled": true,
"credits": {
"remaining": 1000,
"refill": {
"interval": "daily",
"amount": 1000,
"refillDay": 15
}
},
"ratelimits": [
{
"name": "requests",
"limit": 100,
"duration": 60000,
"autoApply": true
},
{
"name": "heavy_operations",
"limit": 10,
"duration": 3600000,
"autoApply": false
}
]
}
]
}Response
Successfully migrated keys.
Example response
{
"meta": {
"requestId": "req_123"
},
"data": {
"migrated": [
{
"hash": "sha256_abc123def456",
"keyId": "key_2cGKbMxRyIzhCxo1Idjz8q"
}
],
"failed": [
"sha256_ghi789jkl012"
]
}
}