API Authentication
The Onvera API uses API key authentication for all requests.
API Key Format
API keys have the following format:
onv_sk_live_<random_token>Example:
onv_sk_live_abc123def456ghi789jkl012mno345pqr678stu901vwx234yzAuthentication Header
Include your API key in the X-API-Key header:
curl -H "X-API-Key: onv_sk_live_..." \
https://api.onvera.io/api/v1/deploymentsCreating API Keys
Create API keys in the Onvera dashboard (opens in a new tab):
- Navigate to Organization > API Keys
- Click "Create API Key"
- Copy the key immediately (it's only shown once)
- Store securely
API keys are only displayed once when created. Store them securely.
API Key Scopes
API keys can have scopes that limit what they can do:
Available Scopes
deployments:read- Read deploymentsdeployments:write- Create/update deploymentsdeployments:delete- Delete deploymentsoperations:read- Read operationsorg:read- Read organization information
Default Scopes
By default, API keys have all scopes unless restricted. You can restrict scopes when creating a key in the dashboard.
Scope Requirements
Each endpoint requires specific scopes:
GET /v1/deployments- Requiresdeployments:readPOST /v1/deployments- Requiresdeployments:writeGET /v1/deployments/{id}- Requiresdeployments:readDELETE /v1/deployments/{id}- Requiresdeployments:writeGET /v1/operations- Requiresoperations:readGET /v1/operations/{id}- Requiresoperations:readGET /v1/environments- Requiresorg:read
API Key Expiration
API keys can have expiration dates:
- No expiration - Key is valid until revoked (default)
- Expiration date - Key expires on specified date
Expired keys cannot be used and must be replaced.
Revoking API Keys
Revoke API keys in the dashboard:
- Navigate to Organization > API Keys
- Find the key you want to revoke
- Click "Revoke"
Revoked keys cannot be used and cannot be restored.
Authentication Errors
401 Unauthorized
Invalid API key:
{
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key"
}
}Missing API key:
{
"error": {
"code": "MISSING_API_KEY",
"message": "API key required"
}
}Expired API key:
{
"error": {
"code": "API_KEY_EXPIRED",
"message": "API key has expired"
}
}Revoked API key:
{
"error": {
"code": "API_KEY_REVOKED",
"message": "API key has been revoked"
}
}403 Forbidden
Insufficient scope:
{
"error": {
"code": "INSUFFICIENT_SCOPE",
"message": "Insufficient scope. Required: deployments:write"
}
}Security Best Practices
- Never commit API keys to version control
- Use environment variables for API keys in CI/CD
- Rotate keys regularly (every 90 days recommended)
- Revoke unused keys immediately
- Use scoped keys when possible (limit permissions)
- Monitor key usage via audit logs
Audit Visibility
All API key usage is logged:
- When the key was used
- Which endpoint was accessed
- Which organization/user context was used
View audit logs in the dashboard under Organization > Audit Logs.
Related Concepts
- Concepts: Authentication - Learn about authentication methods
- Security: API Keys - Security best practices