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

# Review comment metrics

> Returns JSON with one entry per merged pull request that has stored CodeRabbit review comment metrics. The inclusive UTC date window selects pull requests by merge date, regardless of when comments were posted. Pull requests without stored comments are excluded before pagination. Pagination is in write order rather than by merge date, so a pull request written after your cursor already passed its merge date (a backfill, or a reopen/reclose) still appears on a later page instead of being silently skipped. Each nested comment entry represents a stored finding; a comment URL may occur more than once when the posted comment contains multiple findings. Comment text is not returned. Unknown query parameters, including format and status, are rejected. Available on the Enterprise plan. Self-hosted CodeRabbit deployments can use this API when configured to send metrics to CodeRabbit Cloud. Requests include all organizations authorized by the API token unless narrowed by an organization selector.

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

Use this endpoint for finding-level metadata. For pull-request-level aggregates, use the [Metrics Data API](/api-reference/metrics-data-api).

Self-hosted CodeRabbit deployments can use this API when configured to send metrics to CodeRabbit Cloud.

Workspace API tokens include all authorized workspace organizations by default. Use `org_id` to select one provider organization. Instance-scoped API keys include authorized organizations in their Git provider instance. Organization-scoped API keys remain bound to their authenticated organization, including organizations connected to a self-hosted Git provider instance.


## OpenAPI

````yaml get /v1/metrics/review-comments
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/metrics/review-comments:
    get:
      tags:
        - Metrics
      summary: Get review comment metrics for merged pull requests
      description: >-
        Returns JSON with one entry per merged pull request that has stored
        CodeRabbit review comment metrics. The inclusive UTC date window selects
        pull requests by merge date, regardless of when comments were posted.
        Pull requests without stored comments are excluded before pagination.
        Pagination is in write order rather than by merge date, so a pull
        request written after your cursor already passed its merge date (a
        backfill, or a reopen/reclose) still appears on a later page instead of
        being silently skipped. Each nested comment entry represents a stored
        finding; a comment URL may occur more than once when the posted comment
        contains multiple findings. Comment text is not returned. Unknown query
        parameters, including format and status, are rejected. Available on the
        Enterprise plan. Self-hosted CodeRabbit deployments can use this API
        when configured to send metrics to CodeRabbit Cloud. Requests include
        all organizations authorized by the API token unless narrowed by an
        organization selector.
      operationId: review-comment-metrics
      parameters:
        - in: header
          name: x-coderabbitai-api-key
          required: true
          schema:
            type: string
          description: API key for authentication
        - in: query
          name: org_id
          schema:
            type: string
          description: >-
            Workspace-scoped API tokens only. Selects one provider organization
            in the token's workspace. When omitted, includes all organizations
            authorized by the workspace token. Ignored for organization-scoped
            and Git-provider instance-scoped keys.
        - in: query
          name: start_date
          required: true
          schema:
            type: string
            format: date
            example: '2026-09-01'
          description: Inclusive UTC merge date in YYYY-MM-DD format
        - in: query
          name: end_date
          required: true
          schema:
            type: string
            format: date
            example: '2026-09-09'
          description: >-
            Inclusive UTC merge date in YYYY-MM-DD format; must not precede
            start_date
        - in: query
          name: repository_ids
          schema:
            type: string
            example: 1027529638,987654321
          description: Comma-separated provider repository IDs. Maximum 10.
        - in: query
          name: user_ids
          schema:
            type: string
            example: 87397876,12345678
          description: >-
            Comma-separated provider PR author IDs from stored PR metrics.
            Maximum 10.
        - in: query
          name: organization_ids
          schema:
            type: string
            example: 184456712,103539130
          description: >-
            Comma-separated provider organization IDs for self-hosted Git
            provider instance-scoped API keys. Maximum 10 input values. When
            omitted, includes all authorized organizations in the instance. The
            filter cannot expand the scope authorized by the API token. Not
            supported for organization-scoped or workspace-scoped API keys.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 1000
          description: >-
            Maximum number of pull requests per page, not the number of nested
            comments
        - in: query
          name: cursor
          schema:
            type: string
          description: >-
            Opaque next_cursor from the previous response. Keep the same date
            window and filters when fetching subsequent pages.
      responses:
        '200':
          description: Review comment metrics for eligible merged pull requests
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - next_cursor
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      required:
                        - pr_url
                        - organization_id
                        - repository_id
                        - author_id
                        - merged_at
                        - coderabbit_comments
                      properties:
                        pr_url:
                          type: string
                          example: https://github.com/org/repo/pull/123
                        organization_id:
                          type: string
                          description: Provider organization ID
                        repository_id:
                          type: string
                          description: Provider repository ID
                        author_id:
                          type: string
                          nullable: true
                          description: >-
                            Provider PR author ID from stored PR metrics; null
                            when unavailable
                        merged_at:
                          type: string
                          format: date-time
                          nullable: true
                          description: Pull request merge timestamp
                        coderabbit_comments:
                          type: array
                          minItems: 1
                          description: >-
                            Stored findings; multiple entries may share the same
                            posted comment URL
                          items:
                            type: object
                            required:
                              - url
                              - severity
                              - category
                              - accepted
                            properties:
                              url:
                                type: string
                                description: >-
                                  Link to the posted review comment; not a
                                  unique finding identifier
                              severity:
                                type: string
                                nullable: true
                                enum:
                                  - critical
                                  - major
                                  - minor
                                  - trivial
                                  - info
                                  - null
                                description: >-
                                  Finding severity; null for absent, unknown, or
                                  none values
                              category:
                                type: string
                                nullable: true
                                enum:
                                  - data_integrity_and_integration
                                  - functional_correctness
                                  - maintainability_and_code_quality
                                  - performance_and_scalability
                                  - security_and_privacy
                                  - stability_and_availability
                                  - null
                                description: >-
                                  Content category, not the issue type; null
                                  when absent or unknown
                              accepted:
                                type: boolean
                                nullable: true
                                description: >-
                                  Stored resolution outcome from AI detection or
                                  user confirmation, not necessarily acceptance
                                  by the PR author. False is not proof of
                                  rejection; null means unknown. This value can
                                  change after the comment is posted.
                  next_cursor:
                    type: string
                    nullable: true
                    description: >-
                      Opaque cursor for the next page; null when no more
                      eligible pull requests remain
        '400':
          description: >-
            Invalid dates, filters, limit, cursor, or unsupported query
            parameters
        '401':
          description: Invalid or missing API key
        '403':
          description: >-
            Enterprise access required, agentic key forbidden, organization
            outside the permitted scope, or review comment metrics unavailable
            for an organization in the requested scope.
        '404':
          description: >-
            Selected organization not found in the workspace, or no
            organizations match the self-hosted Git provider instance filter
        '413':
          description: >-
            JSON response exceeds 16 MiB. Reduce limit, narrow the date window,
            or add filters. A single pull request's comments cannot be split
            across pages; excluding that pull request may be necessary.
        '429':
          description: Metrics API rate limit exceeded
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying
        '500':
          description: Internal server error
        '503':
          description: Review comment metrics temporarily unavailable; retry later
          headers:
            Retry-After:
              schema:
                type: integer
              description: >-
                Seconds to wait when isolated metrics are preparing
                (METRICS_PREPARING)
      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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.