api-keys

Create API Token

Creates a new API token for programmatic access to the API. The token can be used for bearer authentication in API requests. Tokens are scoped based on user role: User role receives scope_token_user (basic access), while Admin/Manager/PowerUser roles receive scope_token_power_user (administrative access).

Security Note: Session-only authentication required to prevent token-based privilege escalation.

post/bodhi/v1/tokens

Request

  • Base URL: http://localhost:1135
  • URL: http://localhost:1135/bodhi/v1/tokens
  • Auth: OAuth 2 (authorization code, authorization URL /bodhi/v1/auth/initiate, token URL /bodhi/v1/auth/callback, scopes: resource_power_user)

Request body

namestring nullable

Descriptive name for the API token

scope'scope_token_user' | 'scope_token_power_user' required

Example request

{
  "name": "My Integration Token",
  "scope": "scope_token_user"
}

Response

API token created successfully

tokenstring required

API token with sk-bodhiapp_ prefix for programmatic access

Example response

{
  "token": "sk-bodhiapp_pMwZ1AbCdEfGhIjKlMnOpQrStUvWxYz0123456789_-AB3n7Qz.client-id"
}

Changes