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

# Update the merge queue.



## OpenAPI

````yaml /openapi.json post /updateQueue
openapi: 3.1.0
info:
  title: Trunk APIs
  version: 1.0.0
  license:
    name: UNLICENSED
servers:
  - url: https://api.trunk.io/v1
security: []
paths:
  /updateQueue:
    post:
      summary: Update 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
                  description: The branch that the merge queue is targeting.
                state:
                  type: string
                  enum:
                    - running
                    - paused
                    - draining
                  description: >-
                    The desired state of the merge queue. Valid values: RUNNING,
                    PAUSED, DRAINING.
                concurrency:
                  type: integer
                  minimum: 1
                  maximum: 4294967295
                  description: >-
                    The number of PRs or batches of PRs the queue can test at
                    once.
                bisectionConcurrency:
                  type: integer
                  minimum: 1
                  maximum: 4294967295
                  description: >-
                    The number of tests the merge queue can run when bisecting a
                    batch to figure out what PR in the batch failed.
                testingTimeoutMinutes:
                  type: integer
                  minimum: 1
                  maximum: 4294967295
                  description: >-
                    The maximum number of minutes the merge queue will wait for
                    tests to complete before timing out.
                pendingFailureDepth:
                  type: integer
                  minimum: 1
                  maximum: 4294967295
                  description: >-
                    When enabled, PRs that fail tests will wait for the
                    specified number of PRs below them to finish testing before
                    getting kicked from the queue. This works best with
                    optimistic merging enabled.
                canOptimisticallyMerge:
                  type: boolean
                  description: >-
                    When enabled, a PR that passes tests will also cause any PR
                    ahead of it in the queue to also get marked as passing,
                    since tests have passed with those commits.
                batch:
                  type: boolean
                  description: >-
                    Enable or disable batching. When enabled, the merge queue
                    will group PRs into batches for testing.
                batchingMaxWaitTimeMinutes:
                  type: integer
                  minimum: 1
                  maximum: 4294967295
                  description: >-
                    The maximum number of minutes the merge queue will wait to
                    collect PRs into a batch before starting tests.
                batchingMinSize:
                  type: integer
                  minimum: 1
                  maximum: 4294967295
                  description: The minimum number of PRs required to form a batch.
                mode:
                  type: string
                  enum:
                    - single
                    - parallel
                  description: >-
                    The queue mode. 'single' processes PRs one at a time.
                    'parallel' processes multiple PRs concurrently.
                commentsEnabled:
                  type: boolean
                  description: Whether or not Merge Queue will post GitHub comments on PRs.
                commandsEnabled:
                  type: boolean
                  description: >-
                    Whether or not users are allowed to submit PRs to the merge
                    queue by commenting `/trunk merge`.
                createPrsForTestingBranches:
                  type: boolean
                  description: >-
                    Whether or not the merge queue will create PRs for its
                    testing branches, allowing CI to run on them.
                directMergeMode:
                  type: string
                  enum:
                    - 'off'
                    - always
                  description: >-
                    Allow PRs to merge directly into the target branch if
                    they're up to date with the target branch when submitting
                    them to the queue instead of running tests on them in the
                    merge queue.
                optimizationMode:
                  type: string
                  enum:
                    - 'off'
                    - bisection_skip_redundant_tests
                  description: >-
                    The optimization strategy for the merge queue. 'off'
                    disables optimizations. 'bisection_skip_redundant_tests'
                    uses bisection and skips redundant tests.
                mergeMethod:
                  type: string
                  enum:
                    - merge_commit
                    - squash
                    - rebase
                  description: >-
                    The Git merge method used when merging PRs into the target
                    branch. Valid values: merge_commit, squash, rebase.
                statusCheckEnabled:
                  type: boolean
                  description: >-
                    Post a GitHub status check on PRs with the status of the PR
                    in the merge queue.
                requiredStatuses:
                  type: array
                  items:
                    type: string
                  description: >-
                    Allows setting the statuses that must pass when the merge
                    queue performs tests in order for a PR to merge. Setting the
                    statuses here will override GitHub branch protection
                    settings or your `.trunk/trunk.yaml`.
                deleteRequiredStatuses:
                  type: boolean
                  description: >-
                    Removes a manually specified set of required statuses. After
                    this, the statuses that must pass when the merge queue
                    performs testing will be pulled from either GitHub branch
                    protection settings or your `.trunk/trunk.yaml`.
              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.
                required:
                  - state
                  - branch
                  - concurrency
                  - testingTimeoutMinutes
                  - mode
                  - canOptimisticallyMerge
                  - pendingFailureDepth
                  - batch
                  - batchingMaxWaitTimeMinutes
                  - batchingMinSize
                  - createPrsForTestingBranches
                  - commentsEnabled
                  - commandsEnabled
                  - statusCheckEnabled
                  - bisectionConcurrency
                  - requiredStatuses
                  - directMergeMode
                  - optimizationMode
                  - mergeMethod
        '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

````