Team Management

Replaces an API key's secret and returns the new one. The key keeps its publicId, name, rate limit, budget, and usage history. The old secret keeps working for gracePeriodSeconds (0 revokes it immediately), so the new secret can be rolled out before the old one stops working. A key has at most one previous secret: while it is still in its grace period, rotation returns 409 unless force is true.

post/api-keys/{id}/rotate

Request

  • Base URL
    https://admin-api.exa.ai/team-management
  • URL
    https://admin-api.exa.ai/team-management/api-keys/{id}/rotate
  • Auth
    API key in header x-api-key

Path parameters

idstring required

The key's publicId. The key's current secret, or a previous secret still in its grace period, is also accepted for backward compatibility.

Request body

gracePeriodSecondsinteger required

How long the old secret keeps working, in seconds (at most 90 days). 0 revokes it immediately.

forceboolean

Rotate even if the secret replaced by an earlier rotation is still in its grace period. That secret stops working immediately.

Example request

{
  "gracePeriodSeconds": 86400
}

Response

API key rotated successfully

Changes