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.Authorizations
Service API key for team authentication
Path Parameters
The key's publicId. The key's current secret, or a previous secret still in its grace period, is also accepted for backward compatibility.
Body
application/json
How long the old secret keeps working, in seconds (at most 90 days). 0 revokes it immediately.
Required range:
0 <= x <= 7776000Example:
86400
Rotate even if the secret replaced by an earlier rotation is still in its grace period. That secret stops working immediately.
Response
API key rotated successfully