> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CodeRabbit API

> Authenticate with the CodeRabbit API and find endpoints for metrics, learnings, users, roles, and audit logs.

export const EnterprisePlanBadge = ({tip = "This feature is available exclusively as part of the Enterprise plan. Please refer to our pricing page for more information about our plans and features.", title = "Enterprise Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="building-2" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<EnterprisePlanBadge />

The CodeRabbit API provides programmatic access to review data and administrative operations. Use it to retrieve metrics and learnings, manage users and roles, or export audit logs.

## Base URL and authentication

Send API requests to `https://api.coderabbit.ai`. Authenticate with the `x-coderabbitai-api-key` header:

```bash theme={null}
curl "https://api.coderabbit.ai/v1/users" \
  -H "x-coderabbitai-api-key: $CODERABBIT_API_KEY"
```

The data and operations available to a request depend on the key's scope:

* **Organization-scoped API keys** are bound to one CodeRabbit organization.
* **Workspace API tokens** let Enterprise SSO workspace admins call supported endpoints across organizations in a workspace.
* **Self-hosted instance API keys** operate within a self-hosted CodeRabbit instance.

Review each endpoint's requirements before sending a request. Workspace API tokens have additional organization-scoping rules for some endpoints.

## Explore the API

<CardGroup cols={2}>
  <Card title="Workspace API tokens" icon="key-round" href="/api/workspace-api-tokens">
    Create a workspace-scoped token and review its endpoint-specific request requirements.
  </Card>

  <Card title="Metrics and learnings" icon="chart-line" href="/api-reference/metrics-data-api">
    Retrieve pull request metrics and CodeRabbit learnings for reporting or analysis.
  </Card>

  <Card title="Users and seats" icon="users" href="/api-reference/users-list">
    List users, manage seats, and configure seat assignment.
  </Card>

  <Card title="Roles" icon="shield-check" href="/api-reference/roles-list">
    List, create, update, and assign roles.
  </Card>

  <Card title="Audit logs" icon="scroll-text" href="/api-reference/audit-logs">
    Export administrative activity for security and compliance workflows.
  </Card>
</CardGroup>

## What's next

<CardGroup cols={1}>
  <Card title="Create a workspace API token" href="/api/workspace-api-tokens" icon="key-round" horizontal>
    Set up one token for supported APIs across an Enterprise SSO workspace.
  </Card>

  <Card title="Open the API reference" href="/api-reference/metrics-data-api" icon="braces" horizontal>
    Review endpoint parameters, request bodies, and response schemas.
  </Card>
</CardGroup>
