Availability
Workspace API tokens are available only in Enterprise SSO workspaces. Open Workspace Settings > API Tokens or go to/workspace/api-keys in the CodeRabbit app.
Only workspace admins can create, list, or delete workspace API tokens. Non-admin workspace members cannot manage tokens, and CodeRabbit re-checks workspace admin access every time a workspace token is used.
Create a token
1
Open Workspace API Tokens
In the CodeRabbit app, open Workspace Settings > API Tokens.
2
Create the token
Choose Create API token, enter a name, and select an expiration date.
3
Copy the token
Copy the token value immediately. CodeRabbit shows the token only once.
x-coderabbitai-api-key header:
Supported APIs
Workspace API tokens are supported on these public APIs:
The organization inventory endpoints use
organization_id, a CodeRabbit UUID returned by GET /v1/organizations. This differs from the Git provider org_id used by the endpoints below.
Organization scoping with org_id
org_id is the Git provider organization ID for an organization inside the tokenâs workspace. It controls which organization a workspace token targets:
The organization inventory APIs do not use
org_id. Pass the CodeRabbit organization UUID returned in the id field from GET /v1/organizations as the organization_id path parameter when listing repositories.- Endpoints that require
org_id(POST /v1/users/roles, the/v1/rolesoperations, and Learnings create, update, and delete operations) act on the single organization you name. CodeRabbit returns400when a requiredorg_idis omitted,404when the ID does not match an active organization in the workspace, and403when the token owner is no longer a workspace admin. - Endpoints that omit
org_id(users, seats, audit logs, review metrics, MCP usage metrics, andGET /v1/learnings) operate workspace-wide across every organization. Passorg_idon these read endpoints to scope the result to one organization instead.
org_id differently:
- Organization-scoped API keys remain bound to their authenticated organization and ignore
org_id. - Self-hosted instance API keys ignore
org_idon the workspace-token read and custom-role endpoints above. The one exception isPOST /v1/users/roles, which accepts a self-hosted-only"ALL"sentinelâsee Assign roles for details.
Whatâs next
Review the API reference
Explore request parameters and response schemas for the supported public APIs
Manage custom roles
Define role permissions for organizations in your Enterprise SSO workspace
Review audit logs
Track administrative activity across the workspace