/api/orgs/{org_id}/keys/{key_id}/rotateRotate a key's secret
Creates a replacement key that keeps the group, budget, rate limits and IP rules, and returns its plaintext once. The old secret keeps working until old_key_expires_at (overlap_hours from now, 1 to 72, default 24). A revoked key, or one expiring within a minute, answers 409. Org admin or the provisioning key.
Authentication: Bearer API key in the Authorization header
Path parameters
org_idstringrequiredYour organization id (uuid).
GET /api/whoamireturns it.key_idstringrequiredThe key's id (
idfrom create, orhashon/api/v1/keys), never its secret.
Request body
overlap_hoursnumberHow long the old secret keeps working.
Responses
200The replacement key, its one-time plaintext and when the old secret stops working.
Response
keystringrequiredThe replacement key's plaintext, returned only here.
dataobjectrequireddata
idstringrequirednamestringrequiredlabelstringrequiredKey prefix and last characters.
identity_idstring | nullrequiredThe key's group.
budgetobject | nullrequiredThe shared budget the key draws from.
One of
object
budget_idstringrequiredperiodstringrequiredYYYY-MM, or*for recurring.scope_kindenumrequiredkeysis a shared budget;keyis an older per-key budget.api_key_idstring | nullrequiredidentity_idstring | nullrequiredalias_idstring | nullrequiredpool_idstring | nullrequireddeployment_idstring | nullrequiredlimit_nano_usdintegerrequiredThe cap, integer nano-USD. 0 is a hard zero cap.
reserved_nano_usdintegerrequiredIn flight, integer nano-USD.
settled_nano_usdintegerrequiredSpent this month, integer nano-USD.
remaining_nano_usdintegerrequiredInteger nano-USD.
created_by_kindenumrequiredcreated_by_api_key_idstring | nullrequiredThe authoring key, when a key wrote the row.
namestring | nullShared budgets only.
reset_periodenumShared budgets only.
api_key_idsarray | nullShared budgets only: the keys drawing from it.
rate_limitsobject | nullrequiredNull when the key uses its tier's windows.
One of
object
requests_per_minuteinteger | nullrequiredtokens_per_minuteinteger | nullrequiredtokens_per_hourinteger | nullrequiredtokens_per_dayinteger | nullrequired
ip_rulesobject | nullThe key's IP rules; null when it serves from any address.
One of
object
modeenumrequiredallowserves the key only from these ranges;denynever from them.cidrsarray<string>requiredIPv4 or IPv6 ranges in CIDR notation.
legacy_spend_capsarray<object>requiredlegacy_spend_caps
limit_nano_usdintegerrequiredperiodstringrequired
is_provisioningbooleanrequiredexpires_atstring | nullrequiredcreated_atstringrequiredrevoked_atstring | nullrequired
old_key_expires_atstringrequiredWhen the old secret stops working.
401Missing, unknown or revoked API key.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
403The key is not a provisioning key (inference keys are refused, reads included), or it is a customer-plan key.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
404No key with this id in the organization.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
409The key is revoked or about to expire.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
422The body or query failed validation.
Response
detailarray<object>requireddetail
typestringlocarray<string | integer>msgstring
Request
curl -X POST 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/keys/11111111-1111-1111-1111-111111111111/rotate' \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"overlap_hours": 1
}'Response
{
"key": "<new-api-key-shown-once>",
"old_key_expires_at": "2026-11-22T17:10:03.220Z",
"data": {
"id": "8f3b1d6a-2e4c-4a7b-9d05-6c8e0a2b4d17",
"name": "production-server",
"label": "xpl_live_c41a…9e2d",
"identity_id": "org-3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10",
"budget": null,
"rate_limits": null,
"ip_rules": null,
"legacy_spend_caps": [],
"is_provisioning": false,
"expires_at": null,
"created_at": "2026-11-22T16:10:03.220Z",
"revoked_at": null
}
}https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/keys/11111111-1111-1111-1111-111111111111/rotate