> ## 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 test-results upload

> Returns where an upload is (waiting for its bundle, received, ingested or skipped) and the problems ingestion found in it. Requires read access to the upload's test collection.



## OpenAPI

````yaml /openapi-v2.json get /v2/test-uploads/{id}
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 merge-queue permissions it holds. A key with
    no permissions can read merge queues but change nothing. Those permissions
    scope merge queue only: every key can use the Flaky Tests and Dynamic CI
    endpoints, including their writes, whatever permissions it holds.


    A short-lived first-party token in the `x-trunk-token` header is what the
    `trunk` CLI sends after `trunk auth login`.


    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


    Every 4xx and 5xx response is a `ErrorResponse`: `{ "error": { "code",
    "message" } }`. Switch on `code`, which is stable; `message` is prose and
    may change at any time.


    **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 carries an `X-Request-Id` header. Quote it in support
    requests.


    ## Rate limiting


    Requests are limited per organization (currently 100 requests/second).
    Exceeding it returns `429` with `RATE_LIMIT_EXCEEDED`; retry with backoff.
    Note that the limit is enforced at the edge, which does not yet wrap its
    `429` in the `ErrorResponse` envelope described above — 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. Impacted-target
    uploads additionally require a `github.com` repository named `owner/repo`.
    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
paths:
  /v2/test-uploads/{id}:
    get:
      tags:
        - testUploads
      summary: Get a test-results upload
      description: >-
        Returns where an upload is (waiting for its bundle, received, ingested
        or skipped) and the problems ingestion found in it. Requires read access
        to the upload's test collection.
      operationId: testUploads.get
      parameters:
        - schema:
            type: string
            format: uuid
            description: The upload's id, as its create returned it.
            example: f47ac10b-58cc-4372-a567-0e02b2c3d479
          required: true
          description: The upload's id, as its create returned it.
          name: id
          in: path
      responses:
        '200':
          description: The upload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestUpload'
        '400':
          description: '`VALIDATION_FAILED`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: '`AUTHENTICATION_REQUIRED` | `INVALID_TOKEN`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            `TEST_UPLOAD_NOT_FOUND`: no such upload in your organization, or it
            is more than 45 days old. A new upload also reads as not found until
            its record is written, usually within a second of the create, so a
            `404` shortly after the create means "not visible yet", not a
            failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: '`RATE_LIMIT_EXCEEDED`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: '`INTERNAL_ERROR`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    TestUpload:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The upload's id.
          example: f47ac10b-58cc-4372-a567-0e02b2c3d479
        testCollectionId:
          type: string
          description: The id of the test collection the upload belongs to.
          example: aB3xY9kQ
        repositoryId:
          type: string
          format: uuid
          description: >-
            The repository the tests are stored under. The nil UUID for an
            upload without a repository.
          example: 7a1f0e3d-2b4c-4d5e-8f90-123456789abc
        status:
          $ref: '#/components/schemas/TestUploadStatus'
        defects:
          type: array
          items:
            $ref: '#/components/schemas/TestUploadDefect'
          maxItems: 1000
          description: >-
            The problems ingestion found, oldest first. Empty until the bundle
            has been read. At most 1000; past that, every `invalid` defect is
            kept before any `suboptimal` one.
        clientVersion:
          type: string
          description: >-
            The version of the client that built the bundle, as ingestion read
            it from the bundle. Empty until the bundle has been read. It is not
            the `clientVersion` sent on the create.
          example: trunk-analytics-cli 0.12.3
        createdAt:
          type: string
          format: date-time
          description: When the upload was created.
          example: '2026-10-06T16:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          description: >-
            The last time ingestion touched the upload. Each ingestion attempt
            moves it, even when `status` stays the same.
          example: '2026-10-06T16:00:04.000Z'
      required:
        - id
        - testCollectionId
        - repositoryId
        - status
        - defects
        - clientVersion
        - createdAt
        - updatedAt
      description: 'A test-results upload: where it is, and what ingestion found.'
    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: No merge queue found with ID xK9mP2nQ
          required:
            - code
            - message
      required:
        - error
      description: >-
        The uniform error envelope. Every 4xx and 5xx response in this API has
        this shape.
    TestUploadStatus:
      type: string
      enum:
        - awaitingData
        - received
        - ingested
        - skipped
      description: >-
        Where an upload is. `awaitingData`: Trunk has not read the bundle. Past
        `expiresAt` on the create, it was never uploaded or could not be read.
        `received`: ingestion has started and not finished. Ingestion retries
        for about 10 minutes, so an upload still `received` with `updatedAt`
        more than 15 minutes old was not ingested and will not change.
        `ingested`: ingestion has recorded the upload. Its results and defects
        are written just after, so `defects` can still grow for a few seconds;
        each one moves `updatedAt`. If writing them fails, the upload stays
        `ingested` with its results incomplete. An `invalid` defect names a part
        of the bundle that was left out. `skipped`: it was read, but so many of
        its tests failed that Trunk treated the run as an infrastructure failure
        and stored no results.
      example: ingested
    TestUploadDefect:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/TestUploadDefectType'
        level:
          $ref: '#/components/schemas/TestUploadDefectLevel'
        source:
          type: string
          description: Where in the upload the defect is, such as a report path.
          example: reports/junit.xml
        message:
          type: string
          description: What is wrong.
          example: Test case `login` has no timestamp
      required:
        - type
        - level
        - source
        - message
      description: A problem ingestion found in an upload.
    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
        - 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
        - PROVIDER_URL_NOT_FOUND
        - CI_HOST_UNSUPPORTED
        - CI_SCOPE_NOT_FOUND
        - CI_JOB_NOT_FOUND
        - CI_FAILURE_CLUSTER_NOT_FOUND
        - TEST_COLLECTION_NOT_FOUND
        - TEST_NOT_FOUND
        - TEST_UPLOAD_NOT_FOUND
        - TICKETING_NOT_CONFIGURED
        - TICKETING_CREDENTIALS_INVALID
        - TICKETING_SITE_REFUSED
        - TICKET_NOT_FOUND
        - TICKET_LINK_CONFLICT
        - 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: MERGE_QUEUE_NOT_FOUND
    TestUploadDefectType:
      type: string
      enum:
        - unspecified
        - junit
        - env
        - repo
        - bundleSize
        - reportLimit
        - meta
        - deprecatedCli
      description: What part of the upload a defect is about.
      example: junit
    TestUploadDefectLevel:
      type: string
      enum:
        - suboptimal
        - invalid
      description: >-
        `invalid`: Trunk could not use the part of the bundle the defect names
        (`type`, `source`), and ingested the rest. `suboptimal`: that part was
        used, with less information than it could have had.
      example: suboptimal
  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 merge-queue permissions it holds; a key with none can
        read merge queues but change nothing. Those permissions scope merge
        queue only: every key can use the Flaky Tests and Dynamic CI endpoints,
        including their writes, whatever permissions it holds.
    trunkToken:
      type: apiKey
      in: header
      name: x-trunk-token
      description: >-
        A short-lived first-party token, sent in the `x-trunk-token` header. The
        `trunk` CLI sends one after `trunk auth login`, and the `trunk-io/login`
        action obtains one for a GitHub Actions run.


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

````