> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runaether.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the whole stack a reviewed pull request belongs to

> Reads the tree of tracked open pull requests a pull request is stacked in, from its bottom layer up, depth first, forks included.

Use this tool when you need to:
- See which pull requests a stacked pull request builds on and which build on it
- Find the bottom of a stack, the layer to merge first

Examples:
- GET /pull-requests/{pullRequestID}/review/stack
- GET /pull-requests/6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21/review/stack?org_id=0b9d3e57-2c1a-4f6e-8d7b-5a4c3e2f1d09

Hints:
- pullRequestID is the pull request's uuid and org_id (uuid) is optional, resolved as getPullRequest resolves it; the schema answers 422 for either when malformed.
- layers run depth first from the bottom layer, each layer's children in ascending number, so every parent precedes its children; each has pull_request_id, parent_pull_request_id (absent only at the bottom), depth (0 at the bottom), pr_number, title, html_url, state, ci_status, ready_for_merge and has_review (whether the caller's organization has a review page for it). base_branch is the bottom layer's base. A pull request in no stack is one layer.
- A loop is 409 stack_cycle, a layer based on a branch two open pull requests head 409 stack_two_parents, and more than 64 layers 409 stack_too_large, each with pr_number naming the pull request where it breaks and none returning a partial stack.
- Use getPullRequest instead for this pull request's own stack_parent and stack_children edges.
- Any member of an owning organization (one with a review run of the pull request or a non-archived project on its repository) may call it, a viewer included, and no GitHub connection is needed. A pull request that does not exist, one no organization of the caller owns and an org_id that does not own it answer the same 404.
- When no owner admits the caller, a billing member is refused with 403 org_role_insufficient and a member of a suspended organization with 403 org_suspended; an agent host's grant is refused with 403 agent_host_route_not_allowed, and 503 answers when the membership check is unavailable.



## OpenAPI

````yaml api-reference/openapi.json GET /pull-requests/{pullRequestID}/review/stack
openapi: 3.1.0
info:
  title: Aether API
  version: 0.1.0
servers:
  - url: https://api.runaether.dev
security:
  - bearerAuth: []
paths:
  /pull-requests/{pullRequestID}/review/stack:
    get:
      tags:
        - pull-requests
      summary: Get the whole stack a reviewed pull request belongs to
      description: >-
        Reads the tree of tracked open pull requests a pull request is stacked
        in, from its bottom layer up, depth first, forks included.


        Use this tool when you need to:

        - See which pull requests a stacked pull request builds on and which
        build on it

        - Find the bottom of a stack, the layer to merge first


        Examples:

        - GET /pull-requests/{pullRequestID}/review/stack

        - GET
        /pull-requests/6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21/review/stack?org_id=0b9d3e57-2c1a-4f6e-8d7b-5a4c3e2f1d09


        Hints:

        - pullRequestID is the pull request's uuid and org_id (uuid) is
        optional, resolved as getPullRequest resolves it; the schema answers 422
        for either when malformed.

        - layers run depth first from the bottom layer, each layer's children in
        ascending number, so every parent precedes its children; each has
        pull_request_id, parent_pull_request_id (absent only at the bottom),
        depth (0 at the bottom), pr_number, title, html_url, state, ci_status,
        ready_for_merge and has_review (whether the caller's organization has a
        review page for it). base_branch is the bottom layer's base. A pull
        request in no stack is one layer.

        - A loop is 409 stack_cycle, a layer based on a branch two open pull
        requests head 409 stack_two_parents, and more than 64 layers 409
        stack_too_large, each with pr_number naming the pull request where it
        breaks and none returning a partial stack.

        - Use getPullRequest instead for this pull request's own stack_parent
        and stack_children edges.

        - Any member of an owning organization (one with a review run of the
        pull request or a non-archived project on its repository) may call it, a
        viewer included, and no GitHub connection is needed. A pull request that
        does not exist, one no organization of the caller owns and an org_id
        that does not own it answer the same 404.

        - When no owner admits the caller, a billing member is refused with 403
        org_role_insufficient and a member of a suspended organization with 403
        org_suspended; an agent host's grant is refused with 403
        agent_host_route_not_allowed, and 503 answers when the membership check
        is unavailable.
      operationId: getPullRequestReviewStack
      parameters:
        - in: path
          name: pullRequestID
          required: true
          schema:
            format: uuid
            type: string
        - description: >-
            The pull request's owning organization to act in: the org_id the
            PullRequest carries. Omitted, getPullRequest and the review page's
            operations (its review, file, head snapshot and stack) act in the
            owning organization getPullRequest ranks first, and a console
            operation refuses with 422 org_id_required when more than one of the
            caller's organizations owns the pull request.
          explode: false
          in: query
          name: org_id
          schema:
            description: >-
              The pull request's owning organization to act in: the org_id the
              PullRequest carries. Omitted, getPullRequest and the review page's
              operations (its review, file, head snapshot and stack) act in the
              owning organization getPullRequest ranks first, and a console
              operation refuses with 422 org_id_required when more than one of
              the caller's organizations owns the pull request.
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestStack'
          description: OK
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestsErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PullRequestsErrorResponse'
                  - $ref: '#/components/schemas/OrgAuthorizationErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestsErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestStackRefusalErrorResponse'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestsErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestsErrorResponse'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PullRequestsErrorResponse'
          description: Service Unavailable
components:
  schemas:
    PullRequestStack:
      additionalProperties: false
      properties:
        base_branch:
          type: string
        layers:
          items:
            $ref: '#/components/schemas/PRReviewStackLayer'
          minItems: 1
          type: array
      required:
        - layers
      type: object
    PullRequestsErrorResponse:
      additionalProperties: false
      properties:
        code:
          enum:
            - account_deleting
            - aether_inference_unserved
            - agent_pr_blocked
            - agent_pr_pending
            - agent_profile_changed
            - agent_starts_off
            - app_identity_missing
            - attribution_unavailable
            - bad_gateway
            - bad_request
            - caller_inactive
            - chat_archived
            - computer_connection_stale
            - computer_starts_no_agents
            - computer_starts_no_forks
            - computer_unreachable
            - conflict
            - connection_harness_mismatch
            - connection_not_held
            - contents_write_required
            - continuation_failed
            - continuation_unavailable
            - control_forbidden
            - embeddings_unavailable
            - fix_not_requested
            - fix_requests_unrecorded
            - forbidden
            - fork_branch_delete_unsupported
            - fork_forbidden
            - gateway_timeout
            - github_failed
            - github_identity_required
            - github_push_access_required
            - gone
            - handed_branch_protected
            - head_moved
            - html_render_nul_byte
            - html_render_too_large
            - idempotency_key_conflict
            - idempotency_key_reused
            - idle_compaction_not_pending
            - idle_compaction_skipped
            - inference_proxy_unavailable
            - insufficient_credits
            - insufficient_inference_balance
            - internal_error
            - invalid_request
            - last_queued_message
            - main_chat_permanent
            - mcp_server_not_connected
            - merge_when_ready_requires_pr_review
            - message_not_queued
            - method_not_allowed
            - mode_forbidden
            - no_checkout_on_computer
            - no_dispatch_target
            - not_acceptable
            - not_found
            - not_implemented
            - onboarding_already_completed
            - onboarding_requirements_missing
            - org_id_required
            - org_role_insufficient
            - org_suspended
            - payment_required
            - pr_review_actor_required
            - pr_review_publish_forbidden
            - precondition_failed
            - project_has_no_repository
            - project_required
            - pull_request_closed
            - pull_request_mirror_failed
            - pull_request_not_mirrored
            - queued_stop_requires_discard
            - rate_limited
            - request_canceled
            - request_timeout
            - request_too_large
            - service_unavailable
            - stack_cycle
            - stack_too_large
            - stack_two_parents
            - stale_execution
            - stale_or_indeterminate
            - stale_pending_input
            - stream_delivery_gap
            - stream_event_conflict
            - task_awaiting_message
            - task_awaiting_tool_response
            - task_backed_by_work_tree
            - task_connection_disconnected
            - task_creator_deleted
            - task_fork_refused
            - task_has_no_repository
            - task_ineligible
            - task_not_accepting_messages
            - task_not_pinnable
            - task_settings_changed
            - teleport_unavailable
            - terminal_chat_continuation_refused
            - unauthenticated
            - unsigned_aether_head
            - unsigned_commit
            - unsupported_changes
            - unsupported_media_type
            - untyped_error
            - validation_failed
            - workspace_git_unavailable
            - workspace_rejected
          minLength: 1
          type: string
        error:
          minLength: 1
          type: string
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
      required:
        - error
        - code
      type: object
    OrgAuthorizationErrorResponse:
      additionalProperties: false
      properties:
        code:
          enum:
            - org_membership_required
            - org_role_insufficient
            - org_suspended
            - account_deleting
            - agent_host_route_not_allowed
            - credential_kind_not_admitted
            - grant_scope_insufficient
          type: string
        error:
          minLength: 1
          type: string
      required:
        - error
        - code
      type: object
    PullRequestStackRefusalErrorResponse:
      additionalProperties: false
      properties:
        code:
          enum:
            - stack_cycle
            - stack_two_parents
            - stack_too_large
          type: string
        error:
          minLength: 1
          type: string
        pr_number:
          format: int64
          minimum: 1
          type: integer
      required:
        - error
        - code
        - pr_number
      type: object
    PRReviewStackLayer:
      additionalProperties: false
      properties:
        ci_status:
          $ref: '#/components/schemas/TaskCIStatus'
        depth:
          format: int64
          minimum: 0
          type: integer
        has_review:
          type: boolean
        html_url:
          type: string
        parent_pull_request_id:
          format: uuid
          type: string
        pr_number:
          format: int64
          minimum: 1
          type: integer
        pull_request_id:
          format: uuid
          type: string
        ready_for_merge:
          type: boolean
        state:
          $ref: '#/components/schemas/TaskGitHubPRState'
        title:
          type: string
      required:
        - pull_request_id
        - depth
        - pr_number
        - title
        - html_url
        - ready_for_merge
        - has_review
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    TaskCIStatus:
      enum:
        - pending
        - passed
        - failed
      type: string
    TaskGitHubPRState:
      enum:
        - open
        - closed
        - merged
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````

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