API Keys
Create and manage API keys for programmatic access.
Create API keys for programmatic access to Supascale's REST API.
API Key Overview
API keys allow external applications to access Supascale without user credentials. Each key has:
- Unique identifier
- Granular permissions
- Optional expiration date
- Activity tracking
Create API Key
Via Web UI
- Go to Settings > API Keys
- Click Create API Key
- Enter name and select permissions
- Set expiration (optional)
- Click Create
- Copy the key (shown only once!)
Via API
curl -X POST https://supascale.example.com/api/v1/settings/api-keys \
-H "X-API-Key: existing-admin-key" \
-H "Content-Type: application/json" \
-d '{
"name": "CI/CD Integration",
"permissions": {
"projects": "write",
"backups": "write",
"tasks": "read",
"cloudStorage": "none",
"system": "read"
},
"expiresAt": "2027-01-19T00:00:00Z"
}'
Response:
{
"success": true,
"apiKey": {
"id": "key-123",
"name": "CI/CD Integration",
"key": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"permissions": {
"projects": "write",
"backups": "write",
"tasks": "read",
"cloudStorage": "none",
"system": "read"
},
"expiresAt": "2027-01-19T00:00:00Z",
"createdAt": "2026-01-19T12:00:00Z"
}
}
The full API key is only shown once. Store it securely immediately.
API Key Format
sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
- Prefix:
sk_live_(live key) - Length: 32 characters after prefix
- Characters: Alphanumeric
Permissions
Permission Levels
| Level | Access |
|---|---|
none | No access to resource |
read | GET operations only |
write | All operations (GET, POST, PUT, DELETE) |
Resources
| Resource | Endpoints |
|---|---|
projects | /api/v1/projects/* |
backups | /api/v1/backups/* |
tasks | /api/v1/tasks/* |
cloudStorage | /api/v1/cloud-storage/* |
system | /api/v1/system/* |
Example Permission Sets
Read-only monitoring:
{
"projects": "read",
"backups": "read",
"tasks": "read",
"cloudStorage": "read",
"system": "read"
}
Backup automation:
{
"projects": "read",
"backups": "write",
"tasks": "none",
"cloudStorage": "read",
"system": "none"
}
Full access:
{
"projects": "write",
"backups": "write",
"tasks": "write",
"cloudStorage": "write",
"system": "write"
}
List API Keys
curl https://supascale.example.com/api/v1/settings/api-keys \ -H "X-API-Key: your-api-key"
Response:
{
"apiKeys": [
{
"id": "key-123",
"name": "CI/CD Integration",
"keyPreview": "sk_live_xxxx...xxxx",
"permissions": { ... },
"expiresAt": "2027-01-19T00:00:00Z",
"lastUsed": "2026-01-19T11:00:00Z",
"createdAt": "2026-01-19T10:00:00Z"
}
]
}
Note: Full key is never returned in list requests.
Delete API Key
Via Web UI
- Go to Settings > API Keys
- Find the key
- Click Delete
- Confirm deletion
Via API
curl -X DELETE "https://supascale.example.com/api/v1/settings/api-keys?id=key-123" \ -H "X-API-Key: your-api-key"
Using API Keys
HTTP Header
Include in requests:
curl https://supascale.example.com/api/v1/projects \ -H "X-API-Key: sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Authentication Flow
- Request includes
X-API-Keyheader - Supascale validates key exists and not expired
- Permissions checked against requested operation
- Request proceeds or returns 403
Key Expiration
Set Expiration
{
"expiresAt": "2027-01-19T00:00:00Z"
}
No Expiration
Omit expiresAt for keys that don't expire:
{
"name": "Permanent Key",
"permissions": { ... }
}
Expired Key Behavior
- Returns 401 Unauthorized
- Message: "API key has expired"
- Must create new key
Security Best Practices
Key Management
- Use descriptive names - Know what each key is for
- Minimum permissions - Only grant what's needed
- Set expirations - Rotate keys periodically
- One key per integration - Easier to revoke
Storage
- Never commit to code - Use environment variables
- Encrypt at rest - Use secrets management
- Limit access - Only give to those who need it
Monitoring
- Review usage - Check
lastUsedregularly - Audit permissions - Verify they're still needed
- Delete unused keys - Reduce attack surface
Rotation Schedule
| Environment | Rotation |
|---|---|
| Production | Every 90 days |
| Staging | Every 180 days |
| Development | As needed |
Troubleshooting
"Invalid API key"
- Verify key is correct (no typos)
- Check key hasn't been deleted
- Verify key format is correct
"API key expired"
- Check expiration date
- Create new key with fresh expiration
- Update integrations with new key
"Permission denied"
- Check key permissions
- Verify endpoint requires available permission
- Consider creating key with additional permissions
"Rate limited"
- Reduce request frequency
- Implement request batching
- Contact support for limit increase