> ## Documentation Index
> Fetch the complete documentation index at: https://trunk-4cab4936-mintlify-4e02f272.mintlify.site/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
                  extensionEnabled:
                    type: boolean
                    description: >-
                      Whether the Trunk Merge Queue browser extension is enabled
                      (shown) for this repository.
                  bisectionConcurrency:
                    type: number
                  requiredStatuses:
                    type: array
                    items:
                      type: string
                  allowedBotSubmitters:
                    type: array
                    items:
                      type: string
                    description: >-
                      The GitHub logins of bot/app accounts (e.g.
                      `dependabot[bot]`) whose PRs are allowed to be submitted
                      to the merge queue.
                  batchingRules:
                    type: array
                    items:
                      type: object
                      properties:
                        targetPattern:
                          type: string
                          minLength: 1
                          description: >-
                            The impacted-target label this rule applies to.
                            Matched exactly, or as a prefix when it ends in a
                            single `*` (e.g. `//db/migrations:*`). A `*`
                            anywhere other than the last character is rejected,
                            and `*` on its own is rejected — a rule matching
                            every target is a queue-wide setting rather than a
                            rule.
                        policy:
                          type: string
                          enum:
                            - isolate
                          description: >-
                            What to do with a PR whose impacted targets match.
                            `isolate` tests it on its own, exactly as `/trunk
                            merge --no-batch` does.
                      required:
                        - targetPattern
                        - policy
                      description: >-
                        A rule that changes how a PR is batched based on the
                        build targets it impacts. Evaluated from the impacted
                        targets uploaded for the PR's head commit each time the
                        queue forms batches, so it follows pushes that add or
                        remove a matching target. A PR that reports impacting
                        all targets matches no rule.
                    description: >-
                      Rules changing how PRs are batched based on the build
                      targets they impact.
                  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.
                  testBranchConstructionMode:
                    type: string
                    enum:
                      - rename_temp_branch
                      - push_new_branch_from_temp
                    description: >-
                      How the merge queue turns its built temporary branch into
                      the `trunk-merge` branch CI runs on. `rename_temp_branch`
                      renames the ref. `push_new_branch_from_temp` creates the
                      final ref at the temporary branch's head commit and
                      deletes the temporary ref, which needs no rename
                      permission — use it when an organization- or
                      enterprise-level ruleset targets these branches, since
                      GitHub's rename restriction is the one rule an exempt
                      bypass actor cannot lift.
                  enqueueingLabel:
                    type: string
                    description: >-
                      The GitHub label whose application enqueues a PR onto the
                      merge queue.
                  labelCommandsEnabled:
                    type: boolean
                    description: >-
                      Whether label-based commands (e.g. enqueue/dequeue via
                      labels) are enabled on the merge queue.
                  stateLabelsEnabled:
                    type: boolean
                    description: >-
                      Whether the merge queue applies labels to PRs reflecting
                      their merge queue state.
                  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
                  notReadyTimeoutHours:
                    type: number
                required:
                  - state
                  - branch
                  - concurrency
                  - testingTimeoutMinutes
                  - mode
                  - canOptimisticallyMerge
                  - pendingFailureDepth
                  - batch
                  - batchingMaxWaitTimeMinutes
                  - batchingMinSize
                  - createPrsForTestingBranches
                  - commentsEnabled
                  - commandsEnabled
                  - statusCheckEnabled
                  - extensionEnabled
                  - bisectionConcurrency
                  - requiredStatuses
                  - allowedBotSubmitters
                  - batchingRules
                  - directMergeMode
                  - optimizationMode
                  - mergeMethod
                  - testBranchConstructionMode
                  - enqueueingLabel
                  - labelCommandsEnabled
                  - stateLabelsEnabled
                  - enqueuedPullRequests
                  - notReadyTimeoutHours
        '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

````