Skip to main content

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.
Response: 200 OK
array

Get API Key Details

Retrieve details for a specific API key.
string
required
The API key to retrieve (starts with gw_)
Response: 200 OK
Error Response: 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)
Response: 200 OK
The old API key is immediately invalidated. Ensure you update all clients using the old key.

Disable API Key

Temporarily disable an API key without deleting it.
string
required
The API key to disable
Response: 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
Response: 200 OK

Delete API Key

Permanently delete an API key.
Deleted API keys cannot be recovered. Consider using disable instead for temporary suspension.
string
required
The API key to delete
Response: 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

Rotate API keys every 90 days or less. Implement automated rotation to ensure compliance.
Generate separate API keys for each project-user combination. Never share keys across projects.
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
Have a process for immediate key revocation in case of:
  • User termination
  • Security incidents
  • Key exposure
  • Suspicious activity
Never store API keys in:
  • Version control (git)
  • Plain text files
  • Client-side code
  • Unsecured databases
Use:
  • 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