> ## 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 a saved Change Stack overview and layers

> Omit snapshot_id for the latest saved artifact or supply one to pin an exact retained snapshot. Outdated artifacts remain readable. Null means no saved artifact exists; this operation never starts generation.



## OpenAPI

````yaml /openapi.json get /v1/repositories/{repository_id}/pull-requests/{pull_request_number}/change-stack
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}/change-stack:
    get:
      tags:
        - Reviews
      summary: Read a saved Change Stack overview and layers
      description: >-
        Omit snapshot_id for the latest saved artifact or supply one to pin an
        exact retained snapshot. Outdated artifacts remain readable. Null means
        no saved artifact exists; this operation never starts generation.
      operationId: get_pull_request_change_stack
      parameters:
        - name: repository_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
        - name: pull_request_number
          in: path
          required: true
          schema:
            type: integer
            minimum: 0
            maximum: 2147483647
            exclusiveMinimum: true
        - name: org_id
          in: query
          schema:
            type: string
          allowEmptyValue: true
          allowReserved: true
        - name: snapshot_id
          in: query
          schema:
            type: string
            minLength: 1
          allowEmptyValue: true
          allowReserved: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  current_head_sha:
                    type: string
                  artifact:
                    anyOf:
                      - type: object
                        properties:
                          snapshot_id:
                            anyOf:
                              - type: string
                              - type: string
                                nullable: true
                                enum:
                                  - null
                          created_at:
                            type: string
                          base_sha:
                            anyOf:
                              - type: string
                              - type: string
                                nullable: true
                                enum:
                                  - null
                          reviewed_head_sha:
                            anyOf:
                              - type: string
                              - type: string
                                nullable: true
                                enum:
                                  - null
                          title:
                            type: string
                          summary:
                            type: string
                          groups:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                title:
                                  type: string
                                summary:
                                  type: string
                                layers:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: string
                                      title:
                                        type: string
                                      summary:
                                        type: string
                                      order:
                                        type: integer
                                        minimum: 0
                                        maximum: 9007199254740991
                                      depends_on:
                                        type: array
                                        items:
                                          type: string
                                      diagrams:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            format:
                                              enum:
                                                - mermaid
                                            title:
                                              type: string
                                            source:
                                              type: string
                                          required:
                                            - format
                                            - title
                                            - source
                                      files:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            path:
                                              type: string
                                            ranges:
                                              type: array
                                              items:
                                                type: object
                                                properties:
                                                  side:
                                                    enum:
                                                      - old
                                                      - new
                                                    type: string
                                                  start_line:
                                                    anyOf:
                                                      - type: integer
                                                        minimum: 0
                                                        maximum: 9007199254740991
                                                        exclusiveMinimum: true
                                                      - type: string
                                                        nullable: true
                                                        enum:
                                                          - null
                                                  end_line:
                                                    anyOf:
                                                      - type: integer
                                                        minimum: 0
                                                        maximum: 9007199254740991
                                                        exclusiveMinimum: true
                                                      - type: string
                                                        nullable: true
                                                        enum:
                                                          - null
                                                  summary:
                                                    type: string
                                                required:
                                                  - side
                                                  - start_line
                                                  - end_line
                                                  - summary
                                          required:
                                            - path
                                            - ranges
                                    required:
                                      - id
                                      - title
                                      - summary
                                      - order
                                      - depends_on
                                      - diagrams
                                      - files
                              required:
                                - id
                                - title
                                - summary
                                - layers
                          coverage:
                            type: object
                            properties:
                              unassigned_ranges:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    side:
                                      enum:
                                        - old
                                        - new
                                      type: string
                                    start_line:
                                      anyOf:
                                        - type: integer
                                          minimum: 0
                                          maximum: 9007199254740991
                                          exclusiveMinimum: true
                                        - type: string
                                          nullable: true
                                          enum:
                                            - null
                                    end_line:
                                      anyOf:
                                        - type: integer
                                          minimum: 0
                                          maximum: 9007199254740991
                                          exclusiveMinimum: true
                                        - type: string
                                          nullable: true
                                          enum:
                                            - null
                                    summary:
                                      type: string
                                    path:
                                      type: string
                                  required:
                                    - side
                                    - start_line
                                    - end_line
                                    - summary
                                    - path
                              excluded_files:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    path:
                                      type: string
                                  required:
                                    - path
                            required:
                              - unassigned_ranges
                              - excluded_files
                          freshness:
                            enum:
                              - current
                              - outdated
                              - unknown
                            type: string
                        required:
                          - snapshot_id
                          - created_at
                          - base_sha
                          - reviewed_head_sha
                          - title
                          - summary
                          - groups
                          - coverage
                          - freshness
                      - type: string
                        nullable: true
                        enum:
                          - null
                required:
                  - current_head_sha
                  - artifact
        '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:
  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.