> ## 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 a monitor

> Returns one monitor, its configuration and how many tests it holds. A deleted monitor, or one in another organization, is reported as `404`.



## OpenAPI

````yaml /openapi-v2.json get /v2/monitors/{monitorId}
openapi: 3.1.0
info:
  title: Trunk API
  version: 2.0.0
  description: >-
    The Trunk public API. Every endpoint is scoped to a single organization and
    requires a credential.


    ## Authentication


    For automation, send an API key as `Authorization: Bearer <key>`. An
    organization admin creates one in the Trunk app under **Settings → Developer
    → API Keys**, and chooses the permissions it holds. A key with no
    permissions can read merge queues but change nothing in them. Each write's
    description names the permission it needs, if any. Permissions cover merge
    queues and test-result uploads, including the quarantine lookups a CI run
    makes before it uploads; any key can call the other Flaky Tests and Dynamic
    CI endpoints, including their writes.


    A short-lived token in the `x-trunk-token` header is what Trunk's own tools
    send, such as the `trunk` CLI after `trunk auth login`. Your own
    integrations should use an API key.


    A GitHub Actions job can upload impacted targets with no Trunk secret: the
    `trunk-io/login` action exchanges the run's own GitHub credential (its OIDC
    token, or on a pull request from a fork its `GITHUB_TOKEN`) for a
    short-lived first-party token. That token is accepted only by `PUT
    /v2/impacted-targets`, for the run's own repository — and on a fork pull
    request, only for that pull request and its head sha.


    ## Errors


    Errors from the API are an `ErrorResponse`: `{ "error": { "code", "message"
    } }`. Switch on `code`, which is stable; `message` is prose and may change
    at any time.


    Some responses don't have this shape. Trunk's edge answers `401`, `403` for
    some credential problems (including a request with no credential), `429`,
    and gateway errors such as `503` before the request reaches the API. The API
    itself answers `413` for a body over 512 KB and `504` for a request that
    runs past its time limit (usually 5 seconds), both as plain text. Read
    `error.code` only when the body is JSON with an `error` object, and
    otherwise branch on the status code.


    **An authorization denial on a read is reported as `404`, not `403`** —
    whether a resource exists must not leak across organizations, so a resource
    in another organization is indistinguishable from one that does not exist.
    `403 INSUFFICIENT_PERMISSIONS` means the credential is valid but is not
    permitted the action (or carries no organization).


    Every response from the API carries an `X-Request-Id` header; edge responses
    may not. Quote it in support requests.


    ## Rate limiting


    Most requests share one limit per organization (currently 100 requests per
    second), across every API key, user, and CLI session in it. Some requests
    have limits of their own and don't count toward it: `GET` requests on paths
    that start with `/v2/pull-requests`, `/v2/ci-jobs`, `/v2/ci-workflow-runs`,
    or `/v2/ci-failure-clusters` (5 per second per API key or user); the merge
    queue metrics endpoints (5 per second per organization); impacted-target
    uploads from a GitHub Actions login (10 per second per repository, and
    separately for its fork pull requests); test-result uploads (1000 per second
    per organization) and quarantine lookups (250 per second per organization).
    Exceeding a limit returns `429`; retry with backoff. The limit is enforced
    at the edge, which does not yet wrap its `429` in the `ErrorResponse`
    envelope or send `Retry-After`, so treat any `429` as rate limiting
    regardless of body.


    ## Compatibility


    Within v2, Trunk may add: new endpoints, new **optional** response fields,
    new members to any enum (including new `code` values, new queue-entry
    states, and new providers), and new optional request parameters. **Clients
    must tolerate values and fields they do not recognize** rather than failing
    closed — a client that switches exhaustively over an enum will break when a
    member is added. Removals and semantic changes require a new major version.


    ## Provider support


    Merge queues, verification runs and checks are **GitHub-only** today;
    `Check.provider` has a single member for that reason. `PUT
    /v2/impacted-targets` accepts GitHub and GitLab repositories. A GitHub
    Actions login (the `trunk-io/login` action, or `trunk auth login
    --github-actions`) uploads only for its own GitHub repository. The
    `Provider` enum lists values the repository index can store, not surfaces
    that are fully supported.


    ## Not yet available


    A pull request's numeric **position** in its queue is not exposed, and list
    responses are not ordered by queue position. `GET
    /v2/merge-queues/{id}/order` returns the order the engine will consider pull
    requests in, but an array index there is not a wait: use a pending entry's
    `directlyAhead` rather than counting, and `GET
    /v2/pull-requests/{id}/queue-entry-estimate` for when it is expected to
    merge (on queues that serve estimates). This API delivers no events of its
    own — poll it, or subscribe to [Merge Queue's
    webhooks](https://docs.trunk.io/merge-queue/webhooks). `Idempotency-Key` is
    not yet honored, so a mutation that times out must be reconciled by reading
    the resource back rather than blindly retried.
  contact:
    name: Trunk Support
    url: https://docs.trunk.io
servers:
  - url: https://api.trunk.io
    description: Production
security:
  - apiKey: []
  - trunkToken: []
tags:
  - name: mergeQueues
    x-group: Merge Queues
  - name: pullRequests
    x-group: Pull Requests
  - name: mergeQueueVerificationRuns
    x-group: Verification Runs
  - name: impactedTargets
    x-group: Impacted Targets
  - name: repositories
    x-group: Repositories
  - name: dynamicCi
    x-group: Dynamic CI
  - name: ciJobs
    x-group: CI Jobs
  - name: ciWorkflowRuns
    x-group: CI Workflow Runs
  - name: ciFailureClusters
    x-group: CI Failure Clusters
  - name: testCollections
    x-group: Test Collections
  - name: tests
    x-group: Tests
  - name: testUploads
    x-group: Test Uploads
  - name: detectionEvents
    x-group: Detection Events
  - name: monitors
    x-group: Monitors
  - name: monitorTests
    x-group: Monitor Tests
paths:
  /v2/monitors/{monitorId}:
    get:
      tags:
        - monitors
      summary: Get a monitor
      description: >-
        Returns one monitor, its configuration and how many tests it holds. A
        deleted monitor, or one in another organization, is reported as `404`.
      operationId: monitors.get
      parameters:
        - schema:
            type: string
            minLength: 1
            description: The monitor's id.
            example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
          required: true
          description: The monitor's id.
          name: monitorId
          in: path
      responses:
        '200':
          description: The monitor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Monitor'
        '400':
          description: '`VALIDATION_FAILED`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                VALIDATION_FAILED:
                  summary: VALIDATION_FAILED
                  value:
                    error:
                      code: VALIDATION_FAILED
                      message: 'Invalid input: expected string, received undefined'
        '401':
          description: >-
            `AUTHENTICATION_REQUIRED` | `INVALID_TOKEN`. A malformed, expired,
            or deleted credential. Trunk's edge usually answers this before the
            request reaches the API, with a body that is not this envelope
            (`{"error": "unauthorized: invalid api key"}` for a bad API key, or
            plain text for a bad `x-trunk-token`), so branch on the status. A
            request with no credential at all gets `403` from the edge.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                AUTHENTICATION_REQUIRED:
                  summary: AUTHENTICATION_REQUIRED
                  value:
                    error:
                      code: AUTHENTICATION_REQUIRED
                      message: No credential was supplied
                INVALID_TOKEN:
                  summary: INVALID_TOKEN
                  value:
                    error:
                      code: INVALID_TOKEN
                      message: The supplied token failed verification
        '404':
          description: '`MONITOR_NOT_FOUND`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                MONITOR_NOT_FOUND:
                  summary: MONITOR_NOT_FOUND
                  value:
                    error:
                      code: MONITOR_NOT_FOUND
                      message: Monitor not found
        '429':
          description: >-
            `RATE_LIMIT_EXCEEDED`. Trunk's edge answers this, and does not yet
            wrap it in the error envelope or send `Retry-After`: treat any `429`
            as rate limiting, whatever its body, and retry with backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                RATE_LIMIT_EXCEEDED:
                  summary: RATE_LIMIT_EXCEEDED
                  value:
                    error:
                      code: RATE_LIMIT_EXCEEDED
                      message: Rate limit exceeded; retry with backoff
        '500':
          description: '`INTERNAL_ERROR`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                INTERNAL_ERROR:
                  summary: INTERNAL_ERROR
                  value:
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
components:
  schemas:
    Monitor:
      oneOf:
        - $ref: '#/components/schemas/FailureRateMonitor'
        - $ref: '#/components/schemas/PassOnRetryMonitor'
        - $ref: '#/components/schemas/FailureCountMonitor'
        - $ref: '#/components/schemas/NewTestMonitor'
        - $ref: '#/components/schemas/SkippedTestMonitor'
        - $ref: '#/components/schemas/SlowTestMonitor'
        - $ref: '#/components/schemas/TimeoutInflationMonitor'
      discriminator:
        propertyName: monitorType
        mapping:
          failureRate: '#/components/schemas/FailureRateMonitor'
          passOnRetry: '#/components/schemas/PassOnRetryMonitor'
          failureCount: '#/components/schemas/FailureCountMonitor'
          newTest: '#/components/schemas/NewTestMonitor'
          skippedTest: '#/components/schemas/SkippedTestMonitor'
          slowTest: '#/components/schemas/SlowTestMonitor'
          timeoutInflation: '#/components/schemas/TimeoutInflationMonitor'
      description: >-
        A monitor on one test collection. `config` holds the fields of its
        `monitorType`.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
              description: >-
                Human-readable description of what went wrong. Not stable — do
                not parse.
              example: An unexpected error occurred
          required:
            - code
            - message
      required:
        - error
      description: >-
        The error envelope. Every error this API itself returns has this shape,
        except a `413` for a body over 512 KB and a `504` for a request that
        runs past its time limit, which are plain text. Responses from Trunk's
        edge, such as a `401`, a `403` for a missing credential, a `429` or a
        `503`, can arrive before the request reaches the API and may not have
        it, so read `error.code` only when the body is JSON with an `error`
        object.
    FailureRateMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - failureRate
        config:
          $ref: '#/components/schemas/FailureRateMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    PassOnRetryMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - passOnRetry
        config:
          $ref: '#/components/schemas/PassOnRetryMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    FailureCountMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - failureCount
        config:
          $ref: '#/components/schemas/FailureCountMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    NewTestMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - newTest
        config:
          $ref: '#/components/schemas/NewTestMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    SkippedTestMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - skippedTest
        config:
          $ref: '#/components/schemas/SkippedTestMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    SlowTestMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - slowTest
        config:
          $ref: '#/components/schemas/SlowTestMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    TimeoutInflationMonitor:
      type: object
      properties:
        id:
          type: string
          example: 1a2b3c4d-5e6f-4a1b-8c9d-0e1f2a3b4c5d
        testCollectionId:
          type: string
          description: The id of the test collection the monitor belongs to.
          example: aB3xY9kQ
        name:
          type: string
          example: Broken on main
        enabled:
          type: boolean
          example: true
        activeTestCount:
          type: integer
          description: Tests the monitor is active on and has not muted.
          example: 3
        mutedTestCount:
          type: integer
          description: >-
            Tests whose mute on this monitor is in force, whether or not the
            monitor is active on them.
          example: 1
        actions:
          type: array
          items:
            $ref: '#/components/schemas/MonitorAction'
          maxItems: 100
          description: >-
            What the monitor does to a test it detects, oldest first. A label
            action is one entry per label. At most the first 100 are returned.
        createdAt:
          type: string
          format: date-time
          example: '2026-06-01T00:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-06-02T00:00:00.000Z'
        monitorType:
          type: string
          enum:
            - timeoutInflation
        config:
          $ref: '#/components/schemas/TimeoutInflationMonitorConfig'
      required:
        - id
        - testCollectionId
        - name
        - enabled
        - activeTestCount
        - mutedTestCount
        - actions
        - createdAt
        - updatedAt
        - monitorType
        - config
    ErrorCode:
      type: string
      enum:
        - AUTHENTICATION_REQUIRED
        - INVALID_TOKEN
        - INSUFFICIENT_PERMISSIONS
        - INTERNAL_ERROR
        - VALIDATION_FAILED
        - NOT_FOUND
        - INVALID_CURSOR
        - MERGE_QUEUE_NOT_FOUND
        - PR_ALREADY_ENQUEUED
        - PR_NOT_ENQUEUEABLE
        - UPSTREAM_ERROR
        - VERIFICATION_RUN_NOT_FOUND
        - PR_NOT_FOUND
        - IMPACTED_TARGETS_NOT_FOUND
        - REPOSITORY_NOT_FOUND
        - IMPACTED_TARGETS_UNSUPPORTED
        - QUEUE_ALREADY_EXISTS
        - QUEUE_HAS_ACTIVE_ENTRIES
        - MODE_CHANGE_IN_PROGRESS
        - PR_NOT_IN_ACTIVE_STATE
        - MERGE_QUEUE_NOT_CREATABLE
        - PR_TESTS_NOT_RESTARTABLE
        - ALLOWED_BOT_SUBMITTERS_FROZEN
        - ESTIMATE_NOT_ENABLED
        - PR_RERUN_FEATURE_DISABLED
        - PR_RERUN_NOT_PENDING_FAILURE
        - PR_RERUN_QUEUE_DOES_NOT_KEEP_FAILED_RUNS
        - PR_RERUN_NOT_A_REQUIRED_CHECK_FAILURE
        - PR_RERUN_CHECK_NOT_RERUNNABLE
        - PR_RERUN_RUN_TORN_DOWN
        - PR_RERUN_HOLD_LIMIT_REACHED
        - PR_RERUN_FORGE_NOT_SUPPORTED
        - PROVIDER_URL_NOT_FOUND
        - CI_HOST_UNSUPPORTED
        - CI_SCOPE_NOT_FOUND
        - PATHS_FILTER_CONFLICT
        - CI_JOB_NOT_FOUND
        - CI_FAILURE_CLUSTER_NOT_FOUND
        - TEST_COLLECTION_NOT_FOUND
        - TEST_NOT_FOUND
        - TEST_UPLOAD_NOT_FOUND
        - MONITOR_NOT_FOUND
        - MONITOR_LIMIT_EXCEEDED
        - MONITOR_NOT_ACTIVE
        - OUT_OF_RANGE
        - TEST_UNAVAILABLE
        - TICKETING_NOT_CONFIGURED
        - TICKETING_CREDENTIALS_INVALID
        - TICKETING_SITE_REFUSED
        - TICKET_NOT_FOUND
        - TICKET_NOT_LINKED
        - TICKET_LINK_CONFLICT
        - TEST_ALREADY_LINKED
        - TICKET_FIELDS_REJECTED
        - TICKET_CONTENT_UNAVAILABLE
        - TICKETING_CREATE_REFUSED
        - RATE_LIMIT_EXCEEDED
      description: >-
        Stable machine-readable error identifier. Switch on this, never on
        `message`. A shipped code's meaning never changes, but **new codes may
        be added within v2** — treat an unrecognized code as a generic failure
        of its HTTP status rather than failing closed.
      example: INTERNAL_ERROR
    MonitorAction:
      type: object
      properties:
        id:
          type: string
          example: 3c4d5e6f-7081-4a1b-8c9d-0e1f2a3b4c5d
        actionType:
          type: string
          enum:
            - classify
            - label
          description: >-
            `classify` sets the test's status while the monitor is active on it;
            `label` applies labels.
          example: classify
      required:
        - id
        - actionType
      description: Something the monitor does to a test it detects.
    FailureRateMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        windowMinutes:
          type: integer
          description: The window the rate is computed over.
          example: 1440
        minSampleSize:
          type: integer
          description: Runs needed in the window before the monitor decides.
          example: 10
        activationFailureThreshold:
          type: number
          description: The failure rate, 0 to 1, at or above which it detects.
          example: 0.9
        resolutionFailureThreshold:
          type:
            - number
            - 'null'
          description: >-
            The failure rate below which a detected test resolves. Null uses
            `activationFailureThreshold`.
          example: 0.5
        staleAfterMinutes:
          type:
            - integer
            - 'null'
          description: >-
            Resolves a test that has not run for this many minutes. Null keeps
            it active until it runs again.
          example: 1440
      required:
        - branches
        - pullRequestOnly
        - windowMinutes
        - minSampleSize
        - activationFailureThreshold
        - resolutionFailureThreshold
        - staleAfterMinutes
    PassOnRetryMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        minPorCount:
          type: integer
          description: Passes on retry needed to detect.
          example: 1
        windowMinutes:
          type:
            - integer
            - 'null'
          description: >-
            The rolling window the passes on retry are counted over. Null counts
            only the runs each detection pass is given.
          example: 10080
        resolveAfterMinutes:
          type: integer
          description: Resolves a test with no pass on retry for this many minutes.
          example: 10080
      required:
        - branches
        - pullRequestOnly
        - minPorCount
        - windowMinutes
        - resolveAfterMinutes
    FailureCountMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        minFailureCount:
          type: integer
          description: Failures needed to detect.
          example: 1
        windowMinutes:
          type:
            - integer
            - 'null'
          description: >-
            The rolling window the failures are counted over. Null counts only
            the runs each detection pass is given.
          example: 1440
        resolveAfterMinutes:
          type: integer
          description: Resolves a test with no failure for this many minutes.
          example: 4320
      required:
        - branches
        - pullRequestOnly
        - minFailureCount
        - windowMinutes
        - resolveAfterMinutes
    NewTestMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        newDays:
          type: integer
          description: A test counts as new for this many days after it first ran.
          example: 14
      required:
        - branches
        - pullRequestOnly
        - newDays
    SkippedTestMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        minSkippedCount:
          type: integer
          description: Skips needed to detect.
          example: 1
        windowMinutes:
          type:
            - integer
            - 'null'
          description: >-
            The rolling window the skips are counted over. Null counts only the
            runs each detection pass is given.
          example: 10080
        resolutionDays:
          type: integer
          description: Resolves a test not skipped for this many days.
          example: 14
      required:
        - branches
        - pullRequestOnly
        - minSkippedCount
        - windowMinutes
        - resolutionDays
    SlowTestMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        windowMinutes:
          type: integer
          description: The window the duration is computed over.
          example: 1440
        minSampleSize:
          type: integer
          description: Runs needed in the window before the monitor decides.
          example: 10
        percentile:
          type: number
          description: The duration percentile compared, 0 to 1.
          example: 0.95
        activationDurationMs:
          type: integer
          description: The duration, in milliseconds, at or above which it detects.
          example: 60000
        resolutionDurationMs:
          type: integer
          description: >-
            The duration, in milliseconds, below which a detected test resolves.
            At most `activationDurationMs`.
          example: 30000
        staleAfterMinutes:
          type:
            - integer
            - 'null'
          description: >-
            Resolves a test that has not run for this many minutes. Null keeps
            it active until it runs again.
          example: 1440
      required:
        - branches
        - pullRequestOnly
        - windowMinutes
        - minSampleSize
        - percentile
        - activationDurationMs
        - resolutionDurationMs
        - staleAfterMinutes
    TimeoutInflationMonitorConfig:
      type: object
      properties:
        branches:
          type: array
          items:
            type: string
          maxItems: 100
          description: >-
            Branch name patterns the monitor watches. Empty, with
            `pullRequestOnly` false, watches every branch. At most the first 100
            are returned.
          example:
            - main
            - release/*
        pullRequestOnly:
          type: boolean
          description: >-
            True when the monitor watches only pull-request runs; `branches` is
            then empty.
          example: false
        windowMinutes:
          type: integer
          description: The window the durations are computed over.
          example: 1440
        passPercentile:
          type: number
          description: The percentile of passing durations compared, 0 to 1.
          example: 0.95
        failPercentile:
          type: number
          description: The percentile of failing durations compared, 0 to 1.
          example: 0.5
        activationRatio:
          type: number
          description: >-
            Detects when the failing duration is at least this many times the
            passing one.
          example: 3
        resolutionRatio:
          type: number
          description: Resolves when the ratio falls below this. At most `activationRatio`.
          example: 2
        minPassSampleSize:
          type: integer
          description: Passing runs needed in the window.
          example: 5
        minFailSampleSize:
          type: integer
          description: Failing runs needed in the window.
          example: 5
        minAbsoluteGapMs:
          type: integer
          description: >-
            The failing duration must also exceed the passing one by at least
            this many milliseconds.
          example: 5000
        staleAfterMinutes:
          type:
            - integer
            - 'null'
          description: >-
            Resolves a test that has not run for this many minutes. Null keeps
            it active until it runs again.
          example: 1440
      required:
        - branches
        - pullRequestOnly
        - windowMinutes
        - passPercentile
        - failPercentile
        - activationRatio
        - resolutionRatio
        - minPassSampleSize
        - minFailSampleSize
        - minAbsoluteGapMs
        - staleAfterMinutes
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An API key, sent as `Authorization: Bearer <key>`. An organization admin
        creates one in the Trunk app under **Settings → Developer → API Keys**
        and chooses the permissions it holds. A key with none can read merge
        queues but change nothing in them. Permissions cover merge queues and
        test-result uploads, including the quarantine lookups a CI run makes
        before it uploads; any key can call the other Flaky Tests and Dynamic CI
        endpoints, including their writes.
    trunkToken:
      type: apiKey
      in: header
      name: x-trunk-token
      description: >-
        A short-lived token that Trunk's own tools send in the `x-trunk-token`
        header: the `trunk` CLI after `trunk auth login`, and the
        `trunk-io/login` action in a GitHub Actions run. Your own integrations
        should use an API key instead. Never send `Authorization` and
        `x-trunk-token` on the same request.


        **A token from a GitHub Actions run can only upload impacted targets**
        (`PUT /v2/impacted-targets`), for the repository the run belongs to;
        every other endpoint refuses it.

````