Regenerate API Key
Generate a new API key for the authenticated user
Overview
Generate a new primary API key for your account. This immediately invalidates the current API key and replaces it with a fresh one. This operation is useful for security key rotation or when you suspect your current key has been compromised.
Immediate Invalidation: Your current API key stops working immediately after regeneration. All applications using the old key will start receiving authentication errors until updated.
Response Fields
The new API key that replaces your current one. Starts with ek-
followed by a 32-character string.
Important Considerations
When to Regenerate
Security Breach
When you suspect your API key has been compromised or exposed
Regular Rotation
As part of periodic security practices and key rotation policies
Team Changes
When team members with key access leave the organization
Compliance
To meet security compliance requirements for key rotation
Post-Regeneration Checklist
After regenerating your API key, make sure to:
- Update Applications: Replace the old key in all applications and services
- Update CI/CD: Update environment variables in deployment pipelines
- Notify Team: Inform team members about the key change
- Test Services: Verify all integrations work with the new key
- Update Documentation: Update any internal docs that reference the old key
- Secure Storage: Store the new key securely using environment variables or key management systems
Example Implementation
Security Best Practices
Alternative: Proxy Keys
Consider using proxy keys instead of regenerating your main API key for:
- Temporary Access: Create time-limited keys for specific projects
- Team Management: Give each team member their own proxy key
- Service Isolation: Use different keys for different applications
- Easier Rotation: Rotate individual proxy keys without affecting others
See Create Proxy Key for more information.
Error Codes
Unauthorized - Invalid or missing API key
Rate Limited - Too many regeneration requests (limit: 1 per hour)
Internal Error - Failed to generate new key, try again
Related Endpoints
- Get Usage - Check account status with new key
- Create Proxy Key - Create additional keys for delegation
- List Proxy Keys - View all proxy keys (unaffected by regeneration)
Authorizations
Enter your API key (starts with 'ek-')
Response
New API key generated
The response is of type object
.