Overview
API key endpoints allow you to manage user API keys used for gateway authentication. User API keys are distinct from the admin API key - they grant users access to the MCP gateway within specific projects, while the admin API key is used for REST API management.API Key Types
Understanding the difference between admin and user API keys is critical:
List All API Keys
Retrieve all user API keys across the entire system.200 OK
array
Get API Key Details
Retrieve details for a specific API key.string
required
The API key to retrieve (starts with
gw_)200 OK
404 Not Found
Rotate API Key
Rotate (replace) an existing API key with a new one.Rotation generates a new API key while immediately invalidating the old one. Use this for security incidents or regular key rotation policies.
string
required
The existing API key to rotate (will be invalidated)
200 OK
Disable API Key
Temporarily disable an API key without deleting it.string
required
The API key to disable
200 OK
Disabled keys can be re-enabled using the enable endpoint. This is useful for temporary access suspension.
Enable API Key
Re-enable a previously disabled API key.string
required
The API key to enable
200 OK
Delete API Key
Permanently delete an API key.string
required
The API key to delete
200 OK
API Key Lifecycle Management
Key Rotation Strategy
Implement automated key rotation for enhanced security:Access Control Patterns
Temporary Access
Grant temporary access by enabling/disabling keys:Emergency Key Revocation
Quickly revoke all keys for a compromised user:Audit and Monitoring
Key Usage Tracking
Monitor API key usage for security auditing:Inactive Key Detection
Security Best Practices
Regular Key Rotation
Regular Key Rotation
Rotate API keys every 90 days or less. Implement automated rotation to ensure compliance.
Principle of Least Privilege
Principle of Least Privilege
Generate separate API keys for each project-user combination. Never share keys across projects.
Monitor for Anomalies
Monitor for Anomalies
Track API key usage patterns and alert on unusual activity:
- Sudden increase in requests
- Requests from unexpected IP addresses
- Failed authentication attempts
- Key usage outside business hours
Immediate Revocation
Immediate Revocation
Have a process for immediate key revocation in case of:
- User termination
- Security incidents
- Key exposure
- Suspicious activity
Secure Key Storage
Secure Key Storage
Never store API keys in:
- Version control (git)
- Plain text files
- Client-side code
- Unsecured databases
- Environment variables
- Secret management systems (AWS Secrets Manager, HashiCorp Vault)
- Encrypted configuration files
Next Steps
User Endpoints
Manage users who own API keys
Project Endpoints
Manage project access
Authentication
Learn about admin API key authentication
System Operations
Backup and restore operations