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

# Read an accessible pull request and its current checks

> Includes review and merge observations, with optional checks and review threads. Observations do not establish canonical CodeRabbit review completion. A head change during a read or thread continuation returns 409 head_changed.



## OpenAPI

````yaml /openapi.json get /v1/repositories/{repository_id}/pull-requests/{pull_request_number}
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/repositories/{repository_id}/pull-requests/{pull_request_number}:
    get:
      tags:
        - Pull requests
      summary: Read an accessible pull request and its current checks
      description: >-
        Includes review and merge observations, with optional checks and review
        threads. Observations do not establish canonical CodeRabbit review
        completion. A head change during a read or thread continuation returns
        409 head_changed.
      operationId: get_repository_pull_request
      parameters:
        - name: repository_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[1-9]\d*$
        - name: pull_request_number
          in: path
          required: true
          schema:
            type: integer
            minimum: 0
            maximum: 2147483647
            exclusiveMinimum: true
            description: >-
              Repository-local PR number, within the provider's GraphQL Int
              range.
        - name: org_id
          in: query
          schema:
            type: string
            minLength: 1
            description: >-
              Git-provider organization ID. Required for workspace keys; omit
              for organization keys.
          allowEmptyValue: true
          allowReserved: true
        - name: expected_head_sha
          in: query
          schema:
            type: string
            pattern: ^[a-f0-9]{40}$
          allowEmptyValue: true
          allowReserved: true
        - name: include
          in: query
          schema:
            anyOf:
              - enum:
                  - checks
                  - threads
                  - none
                type: string
              - type: array
                minItems: 1
                maxItems: 2
                items:
                  enum:
                    - checks
                    - threads
                    - none
                  type: string
            description: >-
              Optional sections; defaults to checks. Use none for core metadata
              only, or repeat the query parameter to include both checks and
              threads.
          style: form
          explode: true
          allowEmptyValue: true
          allowReserved: true
        - name: thread_author
          in: query
          schema:
            type: string
            pattern: ^[A-Za-z0-9][A-Za-z0-9-]{0,38}(?:\[bot\])?$
          allowEmptyValue: true
          allowReserved: true
        - name: thread_state
          in: query
          schema:
            enum:
              - unresolved
              - resolved
              - all
            type: string
          allowEmptyValue: true
          allowReserved: true
        - name: thread_page_size
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
          allowEmptyValue: true
          allowReserved: true
        - name: thread_page_token
          in: query
          schema:
            type: string
            minLength: 1
            maxLength: 4096
          allowEmptyValue: true
          allowReserved: true
        - name: thread_include_outdated
          in: query
          schema:
            type: boolean
          allowEmptyValue: true
          allowReserved: true
        - name: thread_include_replies
          in: query
          schema:
            type: boolean
          allowEmptyValue: true
          allowReserved: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformPullRequest'
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - invalid_request
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - unauthenticated
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '403':
          description: '403'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - forbidden
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '404':
          description: '404'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - not_found
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '409':
          description: '409'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - head_changed
                          - conflict
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '412':
          description: '412'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - precondition_failed
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '413':
          description: '413'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - payload_too_large
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '429':
          description: '429'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - rate_limit_exceeded
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '500':
          description: '500'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        enum:
                          - internal_error
                        type: string
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '503':
          description: '503'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - unavailable
                      message:
                        type: string
                      retry_after:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                        exclusiveMinimum: true
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
components:
  schemas:
    PlatformPullRequest:
      type: object
      properties:
        expected_head_sha:
          type: string
          pattern: ^[a-f0-9]{40}$
        pull_request:
          type: object
          properties:
            id:
              type: string
              description: >-
                Opaque Git-provider pull-request ID; distinct from its
                repository-local number.
            number:
              type: integer
              minimum: 0
              maximum: 9007199254740991
              exclusiveMinimum: true
              description: Pull-request number within the repository.
            url:
              type: string
              maxLength: 2048
              format: uri
            title:
              type: string
            repository:
              type: string
              description: Current GitHub owner/repository name.
            author:
              anyOf:
                - type: object
                  properties:
                    login:
                      type: string
                  required:
                    - login
                - type: string
                  nullable: true
                  enum:
                    - null
            state:
              enum:
                - open
                - closed
                - merged
              type: string
            draft:
              type: boolean
            head_branch:
              type: string
            head_owner:
              anyOf:
                - type: string
                - type: string
                  nullable: true
                  enum:
                    - null
              description: Source repository owner, or null when unavailable.
            base_branch:
              type: string
            head_sha:
              type: string
              pattern: ^[a-f0-9]{40}$
              description: Head commit observed for this read.
            base_sha:
              type: string
              pattern: ^[a-f0-9]{40}$
              description: Base commit observed for this read.
            updated_at:
              type: string
              description: Last update timestamp reported by the Git provider.
            description:
              type: string
          required:
            - id
            - number
            - url
            - title
            - repository
            - author
            - state
            - draft
            - head_branch
            - head_owner
            - base_branch
            - head_sha
            - base_sha
            - updated_at
            - description
        reviews:
          type: object
          properties:
            decision:
              anyOf:
                - type: string
                - type: string
                  nullable: true
                  enum:
                    - null
            items:
              type: array
              items:
                type: object
                properties:
                  author:
                    anyOf:
                      - type: object
                        properties:
                          login:
                            type: string
                        required:
                          - login
                      - type: string
                        nullable: true
                        enum:
                          - null
                  state:
                    type: string
                  commit_sha:
                    anyOf:
                      - type: string
                        pattern: ^[a-f0-9]{40}$
                      - type: string
                        nullable: true
                        enum:
                          - null
                required:
                  - author
                  - state
                  - commit_sha
            complete:
              type: boolean
            coderabbit:
              type: object
              properties:
                status:
                  enum:
                    - in_progress_observed
                    - unknown
                  type: string
                  description: >-
                    A progress marker is observed historical evidence, not proof
                    that a review is running on the current head. Unknown never
                    means completed.
                reviewed_sha:
                  anyOf:
                    - type: string
                      pattern: ^[a-f0-9]{40}$
                    - type: string
                      nullable: true
                      enum:
                        - null
                source_url:
                  anyOf:
                    - type: string
                      maxLength: 2048
                      format: uri
                    - type: string
                      nullable: true
                      enum:
                        - null
              required:
                - status
                - reviewed_sha
                - source_url
          required:
            - decision
            - items
            - complete
            - coderabbit
        checks:
          type: object
          properties:
            items:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  status:
                    type: string
                  conclusion:
                    anyOf:
                      - type: string
                      - type: string
                        nullable: true
                        enum:
                          - null
                  details_url:
                    anyOf:
                      - type: string
                        maxLength: 2048
                        format: uri
                      - type: string
                        nullable: true
                        enum:
                          - null
                  commit_sha:
                    type: string
                    pattern: ^[a-f0-9]{40}$
                  required:
                    anyOf:
                      - type: boolean
                      - type: string
                        nullable: true
                        enum:
                          - null
                    description: >-
                      Null when branch rules and actor bypass have not been
                      evaluated.
                required:
                  - id
                  - name
                  - status
                  - conclusion
                  - details_url
                  - commit_sha
                  - required
            complete:
              type: boolean
            requiredness_known:
              type: boolean
              description: >-
                Whether the required status of checks is established
                independently of their result.
          required:
            - items
            - complete
            - requiredness_known
        merge:
          type: object
          properties:
            mergeable:
              enum:
                - mergeable
                - conflicting
                - unknown
              type: string
            provider_state:
              anyOf:
                - type: string
                - type: string
                  nullable: true
                  enum:
                    - null
            queue_entry:
              anyOf:
                - type: string
                - type: string
                  nullable: true
                  enum:
                    - null
            queue_known:
              type: boolean
            requirements_known:
              type: boolean
              description: >-
                False unless all merge requirements and the current actor's
                bypass rules are established.
          required:
            - mergeable
            - provider_state
            - queue_entry
            - queue_known
            - requirements_known
        blockers:
          type: array
          items:
            type: object
            properties:
              kind:
                type: string
              source:
                type: string
            required:
              - kind
              - source
        coverage:
          type: object
          properties:
            complete:
              type: boolean
            limitations:
              type: array
              items:
                type: string
          required:
            - complete
            - limitations
        head_sha:
          type: string
          pattern: ^[a-f0-9]{40}$
        fetched_at:
          type: string
        head_changed:
          type: boolean
          description: >-
            Whether the observed head differs from expected_head_sha; not a
            review-completion signal.
        threads:
          type: object
          properties:
            returned:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            coverage:
              type: object
              properties:
                complete:
                  type: boolean
                limitations:
                  type: array
                  items:
                    type: string
              required:
                - complete
                - limitations
            head_sha:
              type: string
              pattern: ^[a-f0-9]{40}$
            fetched_at:
              type: string
            head_changed:
              type: boolean
              description: >-
                Whether the observed head differs from expected_head_sha; not a
                review-completion signal.
            data:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  path:
                    type: string
                  line:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: string
                        nullable: true
                        enum:
                          - null
                  start_line:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: string
                        nullable: true
                        enum:
                          - null
                  original_line:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: string
                        nullable: true
                        enum:
                          - null
                  original_start_line:
                    anyOf:
                      - type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                      - type: string
                        nullable: true
                        enum:
                          - null
                  side:
                    type: string
                  resolved:
                    type: boolean
                  outdated:
                    type: boolean
                  root:
                    type: object
                    properties:
                      id:
                        type: string
                      author:
                        anyOf:
                          - type: object
                            properties:
                              login:
                                type: string
                            required:
                              - login
                          - type: string
                            nullable: true
                            enum:
                              - null
                      body:
                        type: string
                      url:
                        type: string
                        maxLength: 2048
                        format: uri
                      created_at:
                        type: string
                      commit_sha:
                        anyOf:
                          - type: string
                            pattern: ^[a-f0-9]{40}$
                          - type: string
                            nullable: true
                            enum:
                              - null
                      original_commit_sha:
                        anyOf:
                          - type: string
                            pattern: ^[a-f0-9]{40}$
                          - type: string
                            nullable: true
                            enum:
                              - null
                    required:
                      - id
                      - author
                      - body
                      - url
                      - created_at
                      - commit_sha
                      - original_commit_sha
                  replies:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        author:
                          anyOf:
                            - type: object
                              properties:
                                login:
                                  type: string
                              required:
                                - login
                            - type: string
                              nullable: true
                              enum:
                                - null
                        body:
                          type: string
                        url:
                          type: string
                          maxLength: 2048
                          format: uri
                        created_at:
                          type: string
                        commit_sha:
                          anyOf:
                            - type: string
                              pattern: ^[a-f0-9]{40}$
                            - type: string
                              nullable: true
                              enum:
                                - null
                        original_commit_sha:
                          anyOf:
                            - type: string
                              pattern: ^[a-f0-9]{40}$
                            - type: string
                              nullable: true
                              enum:
                                - null
                      required:
                        - id
                        - author
                        - body
                        - url
                        - created_at
                        - commit_sha
                        - original_commit_sha
                  replies_complete:
                    type: boolean
                  reply_count:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                required:
                  - id
                  - path
                  - line
                  - start_line
                  - original_line
                  - original_start_line
                  - side
                  - resolved
                  - outdated
                  - root
                  - replies
                  - replies_complete
                  - reply_count
            next_page_token:
              anyOf:
                - type: string
                - type: string
                  nullable: true
                  enum:
                    - null
            applied_filters:
              type: object
              properties:
                author:
                  type: string
                  pattern: ^[A-Za-z0-9][A-Za-z0-9-]{0,38}(?:\[bot\])?$
                  default: coderabbit
                  description: >-
                    Filter the thread root author: coderabbit, all, or a GitHub
                    login. Replies retain all authors.
                state:
                  enum:
                    - unresolved
                    - resolved
                    - all
                  type: string
                  default: unresolved
                include_outdated:
                  type: boolean
                  default: false
                include_replies:
                  type: boolean
                  default: true
                  description: >-
                    Include bounded reply context. Check replies_complete and
                    reply_count; use the source link when truncated.
                page_size:
                  type: integer
                  minimum: 1
                  maximum: 100
              required:
                - page_size
              additionalProperties: false
          required:
            - returned
            - coverage
            - head_sha
            - fetched_at
            - head_changed
            - data
            - next_page_token
            - applied_filters
      required:
        - pull_request
        - reviews
        - merge
        - blockers
        - coverage
        - head_sha
        - fetched_at
        - head_changed
  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.