> ## 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.

# Learnings

> Programmatic access to an organization's CodeRabbit learnings. Returns paginated JSON or a CSV download. Enterprise plan only. Mirrors the auth, rate-limit and response-size contract of the Metrics public API.

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 />

Programmatic access to an organization's CodeRabbit learnings. Returns paginated JSON or a CSV download. Use the `repository_ids`, `user_ids`, `organization_ids`, `limit`, and `cursor` query parameters to filter and paginate results.

## CSV Format

When using `format=csv`, the API returns a flat CSV structure with one row per learning. For the complete list of CSV columns and field descriptions, see [Data Export - Exported fields](/guides/data-export#exported-fields).

For a guided overview of learnings, see the [Learnings documentation](/knowledge-base/learnings).


## OpenAPI

````yaml get /v1/learnings
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/learnings:
    get:
      tags:
        - Learnings
      summary: List learnings for an organization
      description: >-
        Programmatic access to an organization's CodeRabbit learnings. Returns
        paginated JSON or a CSV download. Enterprise plan only. Mirrors the
        auth, rate-limit and response-size contract of the Metrics public API.
      operationId: learnings-list
      parameters:
        - in: header
          name: x-coderabbitai-api-key
          required: true
          schema:
            type: string
          description: API key for authentication
        - in: query
          name: org_id
          required: false
          schema:
            type: string
          description: >-
            Workspace-scoped API tokens only. When provided, scopes learnings to
            that single git-provider organization within the token's workspace;
            when omitted, aggregates every organization in the workspace.
            Ignored for organization and self-hosted keys.
        - in: query
          name: repository_ids
          schema:
            type: string
            example: 1027529638,987654321
          description: Comma-separated provider repository IDs (max 10).
        - in: query
          name: user_ids
          schema:
            type: string
            example: 87397876,12345678
          description: Comma-separated provider user IDs (max 10).
        - in: query
          name: organization_ids
          schema:
            type: string
            example: 184456712,103539130
          description: >-
            Comma-separated provider organization IDs (max 10). Self-hosted
            instances only.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 1000
          description: Maximum number of records to return.
        - in: query
          name: cursor
          schema:
            type: string
          description: Pagination cursor returned as `next_cursor` on the previous page.
        - in: query
          name: format
          schema:
            type: string
            enum:
              - json
              - csv
            default: json
          description: >-
            Response format. `json` (default) returns paginated JSON; `csv`
            returns a CSV download.
      responses:
        '200':
          description: Successfully retrieved learnings.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - next_cursor
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      required:
                        - id
                        - learning
                        - repository_name
                        - author_username
                        - created_at
                        - updated_at
                        - usage_count
                      properties:
                        id:
                          type: string
                          description: Unique identifier for the learning.
                        learning:
                          type: string
                        organization_id:
                          type: string
                          nullable: true
                          description: Git provider organization ID.
                        organization_name:
                          type: string
                          nullable: true
                        repository_id:
                          type: string
                          nullable: true
                          description: Git provider repository ID.
                        repository_name:
                          type: string
                        author_id:
                          type: string
                          nullable: true
                          description: Git provider user ID of the learning author.
                        author_username:
                          type: string
                        file:
                          type: string
                          nullable: true
                        source_url:
                          type: string
                          nullable: true
                          description: >-
                            URL of the PR comment where the learning was
                            captured.
                        created_at:
                          type: string
                          format: date-time
                        updated_at:
                          type: string
                          format: date-time
                        usage_count:
                          type: integer
                        last_used_at:
                          type: string
                          format: date-time
                          nullable: true
                  next_cursor:
                    type: string
                    nullable: true
            text/csv:
              schema:
                type: string
                format: binary
                description: CSV file download.
        '400':
          description: Bad request — invalid parameters or cursor.
        '401':
          description: Unauthorized — invalid or inactive API key.
        '403':
          description: Forbidden — Enterprise plan required or agentic key not allowed.
        '404':
          description: >-
            Not found — self-hosted instance has no organizations matching the
            supplied `organization_ids`. Returned only for self-hosted callers
            when scope resolution narrows to an empty set.
        '413':
          description: Response exceeds 16 MB. Add filters or reduce `limit`.
        '429':
          description: Rate limit exceeded.
        '500':
          description: Internal server error.
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-coderabbitai-api-key
      description: >-
        API key for authentication. You can create an API key from the
        CodeRabbit dashboard.

````