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

# Get review comment metrics for merged pull requests

> 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. Each page request consumes one token when admitted by the request rate limiter. Reviews, review comments, and MCP share the Metrics quota for the configured quota owner. With verified owner scope, coordinate calls across API keys for the same organization, workspace, or Git-provider instance; changing an organization selector does not add quota.



## OpenAPI

````yaml /openapi.json 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. Each page request consumes one token when
        admitted by the request rate limiter. Reviews, review comments, and MCP
        share the Metrics quota for the configured quota owner. With verified
        owner scope, coordinate calls across API keys for the same organization,
        workspace, or Git-provider instance; changing an organization selector
        does not add quota.
      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: >-
            Request rate limit exceeded (RATE_LIMIT_EXCEEDED), active metrics
            query capacity reached (METRICS_BUSY), or an identical authorized
            query is still running (METRICS_QUERY_IN_PROGRESS). Wait at least
            the full Retry-After interval after receiving the response, then
            retry the same cursor and query parameters. Do not advance the
            cursor on an error. Other calls sharing the quota can cause another
            rejection after the wait. X-RateLimit headers are present only for
            RATE_LIMIT_EXCEEDED, not for the other 429 errors.
          headers:
            Retry-After:
              schema:
                type: integer
              description: >-
                Seconds to wait before retrying; dynamic for request rate
                limits, 5 for METRICS_BUSY or METRICS_QUERY_IN_PROGRESS
            X-RateLimit-Limit:
              required: false
              schema:
                type: integer
              description: >-
                Token bucket burst capacity, not the number of requests allowed
                per minute
            X-RateLimit-Remaining:
              required: false
              schema:
                type: integer
              description: Whole tokens remaining; 0 on request rate rejection
            X-RateLimit-Reset:
              required: false
              schema:
                type: integer
              description: >-
                Estimated Unix timestamp in seconds when the bucket will be full
                if no more tokens are consumed, or when a temporary local rate
                block ends. Use Retry-After to schedule the next retry.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                        code:
                          type: string
                          enum:
                            - RATE_LIMIT_EXCEEDED
                            - METRICS_BUSY
                            - METRICS_QUERY_IN_PROGRESS
        '500':
          description: Internal server error
        '503':
          description: >-
            Metrics are preparing (METRICS_PREPARING), active-query admission
            cannot safely proceed (METRICS_UNAVAILABLE), or API quota custody
            cannot be proved (POLICY_SCOPE_UNAVAILABLE). Retry the same request
            after Retry-After when present; otherwise retry later.
          headers:
            Retry-After:
              required: false
              schema:
                type: integer
              description: >-
                Seconds to wait for METRICS_PREPARING, or 5 for
                METRICS_UNAVAILABLE; absent for POLICY_SCOPE_UNAVAILABLE
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          enum:
                            - METRICS_PREPARING
                            - METRICS_UNAVAILABLE
                            - POLICY_SCOPE_UNAVAILABLE
                        message:
                          type: string
      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.