Overview
Rotate an API key by creating a new one with a fresh 90-day expiration. This is the recommended way to refresh keys before they expire.
Rotation Behavior:
- Creates a new API key with default 90-day expiration
- The old key remains active until its original expiration date
- Both keys can be used during the transition period
- Delete the old key manually when migration is complete
Use Cases:
- Refresh keys approaching expiration
- Rotate keys as part of security policies
- Replace potentially compromised keys
Path Parameters
UUID of the API key to rotateExample: “550e8400-e29b-41d4-a716-446655440000”
Response
Returns the newly created API key.
UUID of the new API key (different from the old key)
The new API key value. Store this securely - it won’t be shown again.
When the new key was created (ISO 8601)
When the new key was last modified (ISO 8601)
When the new key will expire - 90 days from creation (ISO 8601)
Always null for newly created keys
Email address of the user who rotated the key
Email address of the user who rotated the key
Example Request
curl -X POST https://api.airweave.ai/v1/api-keys/550e8400-e29b-41d4-a716-446655440000/rotate \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"id": "880e8400-e29b-41d4-a716-446655440003",
"organization_id": "770e8400-e29b-41d4-a716-446655440001",
"decrypted_key": "awv_live_n3w4k5y6v7a8l9u0e1x2y3z4a5b6c7d8",
"created_at": "2024-03-20T15:00:00Z",
"modified_at": "2024-03-20T15:00:00Z",
"expiration_date": "2024-06-18T15:00:00Z",
"last_used_date": null,
"created_by_email": "user@company.com",
"modified_by_email": "user@company.com"
}
Rotation Workflow
- Call rotate endpoint: Creates new key with 90-day expiration
- Store new key: Update your key management system
- Update applications: Deploy the new key to your services
- Verify new key works: Test API calls with the new key
- Delete old key: Once migration is complete, delete the old key using the DELETE endpoint
Error Responses
API key with the specified ID does not exist or does not belong to your organization
Missing or invalid authentication