Skip to content

API Keys API

API keys provide an alternative to JWT tokens for programmatic access.

List all API keys for the organization. Requires api_keys:read permission.

[
{
"id": "uuid",
"name": "CI/CD Pipeline",
"key_prefix": "biz_live_abc",
"scopes": {},
"last_used_at": "2024-01-15T14:30:00Z",
"expires_at": "2024-04-15T10:00:00Z",
"created_at": "2024-01-15T10:00:00Z",
"created_by_name": "John Doe"
}
]

Note: The full key is never returned - only the prefix is shown for identification.

Create a new API key. Requires api_keys:write permission.

{
"name": "CI/CD Pipeline",
"expires_in_days": 90
}

Important: The full key is returned only once in this response. Store it securely - it cannot be retrieved again.

expires_in_daysDescription
301 month
903 months (recommended)
1806 months
3651 year
nullNever expires

Revoke an API key. Requires api_keys:write permission.

Returns 204 No Content.

Revoked keys can no longer be used for authentication. This performs a soft delete - the key record is retained with a revoked_at timestamp for audit purposes.

Include the API key in the X-API-Key header:

Terminal window
curl http://localhost:8000/api/pipelines \
-H "X-API-Key: biz_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
biz_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
├──────┘ └─────────────────────────────────┘
Prefix Random (32 chars)
(9 chars)
  • Total length: 44 characters
  • Prefix: biz_live_ (identifies as Bizon Platform key)
  • Random: 32 characters from secrets.token_urlsafe(24)
  • Storage: Only the bcrypt hash is stored in the database
  • Lookup: The key prefix (first 12 chars) is used for lookup
  • Verification: Full key is verified against the bcrypt hash
  • Audit: last_used_at is updated on each use
  • Revocation: Soft delete via revoked_at timestamp

API keys inherit the permissions of the user who created them:

Creator RoleAPI Key Permissions
OwnerFull access
AdminFull access (except ownership)
MemberCreate/edit pipelines
ViewerRead-only
  1. Use descriptive names - Include the use case (e.g., “GitHub Actions Deploy”)
  2. Set expiration - Use 90 days for most use cases
  3. Rotate regularly - Delete and recreate keys periodically
  4. Limit scope - Create separate keys for different integrations
  5. Monitor usage - Check last_used_at for unused keys
  6. Revoke immediately - Delete compromised keys right away