Team Management
Rotate API key
Replace an API key’s secret, keeping the old secret valid for a grace period.
cURL
Get your Exa API key
Create a key in the dashboard. New accounts start with free credits.
The Team Management API is enabled per team. It authenticates with a service account API key, which is created from the Service keys tab on the API keys page once the feature is enabled for your team. Contact support@exa.ai to request access.
Overview
Rotating replaces a key’s secret in place. The key keeps itspublicId, name, rate limit, budget, and usage history, so only the secret stored in your vault changes.
Rotating on a schedule
- Call this endpoint with the key’s
publicIdand agracePeriodSecondslong enough to roll out the new secret, for example86400for one day. - Store
apiKey.secretfrom the response in your secrets manager and deploy it. - The old secret stops working at
previousSecretExpiresAt. To cut it off sooner, call Revoke previous API key secret.
publicId. It never changes, while an old secret stops identifying the key once its grace period ends.
Rotating again during a grace period
A key has at most one previous secret. While the secret replaced by the last rotation is still in its grace period, a new rotation returns409 with code set to previous_secret_active and changes nothing, so a job that fires twice cannot revoke a secret you are still deploying. Wait until previousSecretExpiresAt, revoke the previous secret first, or send "force": true to rotate anyway.
Recovering a lost response
If the rotation succeeded but your job did not receive the response, read the current secret back from theid field of Get API key using the key’s publicId.Path Parameters
Body
application/json