API Keys
Stable
Create and manage API keys for authentication.
List API Keys
GET/api/v1/api-keys
Get all your API keys.
Response
{
"keys": [
{
"id": "key_abc123",
"name": "Production Key",
"prefix": "ek_live_abc...",
"permissions": ["chat", "embeddings"],
"createdAt": "2024-01-15T10:30:00Z",
"lastUsed": "2024-01-16T15:45:00Z"
}
]
}Create API Key
POST/api/v1/api-keys
Create a new API key.
Request
{
"name": "Production Key",
"permissions": ["chat", "embeddings", "images"]
}Available Permissions
| Permission | Description |
|---|---|
chat | Chat completions |
embeddings | Generate embeddings |
images | Image generation |
video | Video generation |
voice | Voice/TTS |
knowledge | Knowledge base |
agents | Agent management |
apps | App management |
Response
{
"apiKey": {
"id": "key_abc123",
"name": "Production Key",
"description": null,
"key_prefix": "ek_live_abc...",
"created_at": "2024-01-15T10:30:00Z",
"permissions": ["chat", "embeddings", "images"],
"rate_limit": 1000,
"expires_at": null
},
"plainKey": "ek_live_abc123xyz..."
}The plainKey field contains the full API key and is only returned once at
creation time. Store it securely.
Get API Key
GET/api/v1/api-keys/{id}
Get API key details (without the secret).
Update API Key
PUT/api/v1/api-keys/{id}
Update API key name or permissions.
Request
{
"name": "Updated Key Name",
"permissions": ["chat", "embeddings"]
}Revoke API Key
DELETE/api/v1/api-keys/{id}
Revoke (delete) an API key.
Revoked keys stop working immediately.
Regenerate API Key
POST/api/v1/api-keys/{id}/regenerate
Generate a new secret for an existing key.
Response
{
"id": "key_abc123",
"key": "ek_live_newkey789...",
"regeneratedAt": "2024-01-16T10:30:00Z"
}Best Practices
- Use separate keys for development and production
- Limit permissions to only what’s needed
- Rotate keys regularly
- Never commit keys to version control
- Use environment variables to store keys