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

# List pull requests in a merge queue.

> Returns a paginated list of pull requests in the merge queue. Optionally filter by state and/or by a time range for concluded pull requests.



## OpenAPI

````yaml /openapi.json post /listPullRequests
openapi: 3.1.0
info:
  title: Trunk APIs
  version: 1.0.0
  license:
    name: UNLICENSED
servers:
  - url: https://api.trunk.io/v1
security: []
paths:
  /listPullRequests:
    post:
      summary: List pull requests in a merge queue.
      description: >-
        Returns a paginated list of pull requests in the merge queue. Optionally
        filter by state and/or by a time range for concluded pull requests.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                repo:
                  type: object
                  properties:
                    host:
                      type: string
                      description: The host of the repository (e.g., github.com).
                      examples:
                        - github.com
                    owner:
                      type: string
                      description: The owner of the repository.
                      examples:
                        - trunk-io
                    name:
                      type: string
                      description: The name of the repository.
                      examples:
                        - trunk
                  required:
                    - host
                    - owner
                    - name
                targetBranch:
                  type: string
                  description: The target branch of the merge queue.
                  examples:
                    - main
                state:
                  type: string
                  enum:
                    - not_ready
                    - pending
                    - testing
                    - tests_passed
                    - merged
                    - failed
                    - cancelled
                    - pending_failure
                  description: >-
                    Optional filter for the state of pull requests. If not
                    provided, pull requests of all states will be returned.
                since:
                  type: string
                  format: date-time
                  description: >-
                    Optional ISO 8601 timestamp. When provided, returns pull
                    requests that concluded (merged, failed, or cancelled) since
                    this time. Defaults to the beginning of time when only
                    `until` is provided.
                  examples:
                    - '2024-01-01T00:00:00Z'
                until:
                  type: string
                  format: date-time
                  description: >-
                    Optional ISO 8601 timestamp bounding the upper end of the
                    concluded time range. When either `since` or `until` is
                    provided, only pull requests that concluded (merged, failed,
                    or cancelled) within the range are returned. Defaults to
                    now.
                  examples:
                    - '2024-02-01T00:00:00Z'
                cursor:
                  type: string
                  format: uuid
                  description: >-
                    Optional cursor for pagination. Use the nextCursor from the
                    previous response.
                take:
                  type: integer
                  minimum: 1
                  maximum: 100
                  default: 50
                  description: Number of pull requests to return (1-100). Defaults to 50.
              required:
                - repo
                - targetBranch
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  pullRequests:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        state:
                          type: string
                          enum:
                            - not_ready
                            - pending
                            - testing
                            - tests_passed
                            - merged
                            - failed
                            - cancelled
                            - pending_failure
                          description: >-
                            The state of a pull request in the merge queue. See
                            https://docs.trunk.io/merge-queue/using-the-queue/reference#pull-request-states
                            for the full description of each state.
                        stateChangedAt:
                          type: string
                        priorityValue:
                          type: number
                        priorityName:
                          type: string
                        usedDefaultPriorityName:
                          type: string
                        skipTheLine:
                          type: boolean
                        noBatch:
                          type: boolean
                        prNumber:
                          type: number
                        prTitle:
                          type: string
                        prSha:
                          type: string
                        prBaseBranch:
                          type: string
                        prAuthor:
                          type: string
                      required:
                        - stateChangedAt
                        - priorityValue
                        - priorityName
                        - skipTheLine
                        - noBatch
                        - prNumber
                        - prTitle
                        - prSha
                        - prBaseBranch
                        - prAuthor
                    description: List of pull requests in the merge queue.
                  nextCursor:
                    type: string
                    format: uuid
                    description: >-
                      Cursor for the next page of results. If absent, there are
                      no more results.
                required:
                  - pullRequests
        '400':
          description: Bad Request
          content:
            application/plain-text:
              schema:
                type: string
        '401':
          description: Unauthorized
          content:
            application/plain-text:
              schema:
                type: string
        '404':
          description: Not Found
          content:
            application/plain-text:
              schema:
                type: string
        '500':
          description: Internal Server Error
          content:
            application/plain-text:
              schema:
                type: string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-token

````