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

# Get the merge queue.



## OpenAPI

````yaml /openapi.json post /getQueue
openapi: 3.1.0
info:
  title: Trunk APIs
  version: 1.0.0
  license:
    name: UNLICENSED
servers:
  - url: https://api.trunk.io/v1
security: []
paths:
  /getQueue:
    post:
      summary: Get the merge queue.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                repo:
                  type: object
                  properties:
                    host:
                      type: string
                    owner:
                      type: string
                    name:
                      type: string
                  required:
                    - host
                    - owner
                    - name
                targetBranch:
                  type: string
              required:
                - repo
                - targetBranch
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  state:
                    type: string
                    enum:
                      - running
                      - paused
                      - draining
                      - switching_modes
                    description: >-
                      The state of the merge queue. See
                      https://docs.trunk.io/merge-queue/administration/advanced-settings#merge-queue-state
                      for the full description of each state.
                  branch:
                    type: string
                  concurrency:
                    type: number
                  testingTimeoutMinutes:
                    type: number
                  mode:
                    type: string
                    enum:
                      - single
                      - parallel
                  canOptimisticallyMerge:
                    type: boolean
                  pendingFailureDepth:
                    type: number
                  batch:
                    type: boolean
                  batchingMaxWaitTimeMinutes:
                    type: number
                  batchingMinSize:
                    type: number
                  createPrsForTestingBranches:
                    type: boolean
                  commentsEnabled:
                    type: boolean
                  commandsEnabled:
                    type: boolean
                  statusCheckEnabled:
                    type: boolean
                  bisectionConcurrency:
                    type: number
                  requiredStatuses:
                    type: array
                    items:
                      type: string
                  directMergeMode:
                    type: string
                    enum:
                      - 'off'
                      - always
                    description: >-
                      Controls whether PRs can skip the queue's test run and
                      merge directly when already up to date with the target
                      branch. See
                      https://docs.trunk.io/merge-queue/administration/advanced-settings#direct-merge-to-main
                      for details.
                  optimizationMode:
                    type: string
                    enum:
                      - 'off'
                      - bisection_skip_redundant_tests
                    description: >-
                      The optimization strategy for the merge queue. `off` — no
                      optimizations. See
                      https://docs.trunk.io/merge-queue/optimizations/batching#test-caching-during-bisection
                      for details on `bisection_skip_redundant_tests`.
                  mergeMethod:
                    type: string
                    enum:
                      - merge_commit
                      - squash
                      - rebase
                    description: >-
                      The Git strategy used to merge a PR into the target
                      branch. See
                      https://docs.trunk.io/merge-queue/administration/advanced-settings#merge-method
                      for details.
                  enqueuedPullRequests:
                    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
                required:
                  - state
                  - branch
                  - concurrency
                  - testingTimeoutMinutes
                  - mode
                  - canOptimisticallyMerge
                  - pendingFailureDepth
                  - batch
                  - batchingMaxWaitTimeMinutes
                  - batchingMinSize
                  - createPrsForTestingBranches
                  - commentsEnabled
                  - commandsEnabled
                  - statusCheckEnabled
                  - bisectionConcurrency
                  - requiredStatuses
                  - directMergeMode
                  - optimizationMode
                  - mergeMethod
                  - enqueuedPullRequests
        '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

````