> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdino.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get debug bundle

> Bundled debugging payload for a run, suite, or test case, as JSON or Markdown.

This endpoint returns a debug bundle for a run, suite, or test case.

<Warning>
  **Warning**

  This endpoint replaces `GET /{projectId}/context`, which now returns `404`. The old query parameters `format`, `detail`, and `maxLength` return `400 VALIDATION_ERROR` instead of being ignored. Update clients to the names below.
</Warning>

## Quick Reference

| Input                         | Scope returned | Notes                                                   |
| :---------------------------- | :------------- | :------------------------------------------------------ |
| `runId`                       | `run`          | Run-wide failing suites and deduplicated failing tests. |
| `suiteId` + `runId`           | `suite`        | Failing tests for 1 suite inside 1 run.                 |
| `caseId` (+ optional `runId`) | `test`         | Full payload for 1 test attempt.                        |

## Pick the scope

At least 1 of `runId`, `suiteId`, or `caseId` is required.\
If multiple IDs are passed, the most-specific scope wins.

| Priority | ID combination                | Result  |
| :------- | :---------------------------- | :------ |
| 1        | `caseId` (+ optional `runId`) | `test`  |
| 2        | `suiteId` + `runId`           | `suite` |
| 3        | `runId`                       | `run`   |

## Parent ID rules

* `suiteId` requires `runId`. The API returns `400` if `suiteId` is passed without `runId`.
* `caseId` can be sent without `runId`. The service resolves the latest run for that case and returns it in `data.meta.runId`.

## Response formats and view modes

```bash theme={null}
curl "https://api.testdino.com/api/v1/public/${PROJECT_ID}/debug-bundle?caseId=${CASE_ID}&as=markdown&view=brief&budgetChars=4000" \
  -H "Authorization: Bearer $TESTDINO_API_TOKEN"
```

| Parameter     | Values                                | Effect                                                                                                                                                                                                                                |
| :------------ | :------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `as`          | `json` (default), `markdown`          | `markdown` returns a plain `text/markdown` body for AI prompts.                                                                                                                                                                       |
| `view`        | `full` (default), `brief`, `headline` | Test scope: `brief` removes `steps[]`; `headline` also removes `stdout` and `stderr` and caps `artifacts.*` arrays at 5 with totals. Suite scope: both set each item's `failureWindow` to `null`. Run scope: only `full` is accepted. |
| `budgetChars` | 1 to 50000                            | Truncates the Markdown response. Requires `as=markdown`.                                                                                                                                                                              |

## Parameters that do not apply are rejected

A parameter that cannot take effect at the resolved scope returns `400 VALIDATION_ERROR` rather than being ignored:

* `view` other than `full` at run scope.
* `attempt` without `caseId`.
* `page` or `limit` with a non-default value at test scope.
* `budgetChars` without `as=markdown`.
* Any parameter sent more than once.

Sending a default value (`view=full`, `page=1`, `limit=10`) is accepted at every scope.

## Response fields by scope

| Scope   | Fields                                                                                                                                                         |
| :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `run`   | `scope`, `runId`, `runStatus`, `suites[]`, `items[]` (each with `alsoFailedIn[]`), `count`, `total`, `nextPage`, `meta`, `environment`, `links`                |
| `suite` | `scope`, `spec`, `suiteStatus`, `items[]` (each with `failureWindow`), `count`, `total`, `nextPage`, `meta`, `environment`, `links`                            |
| `test`  | `scope`, `spec`, `test`, `error`, `attemptHistory[]`, `traceLink`, `failureWindow`, `steps[]`, `stdout`, `stderr`, `artifacts`, `meta`, `environment`, `links` |

`failureWindow` contains the `before`, `failed`, and `after` steps around the failure. Each `attemptHistory` entry carries its own 0-based `attempt` index, so you can request that attempt directly with `attempt=N`.

## Links block in every response

Each scope includes `links.uiUrl` and `links.retryCommand`.\
Test-scope responses also include `links.traceViewerUrl`, or `null` when trace data is unavailable.


## OpenAPI

````yaml api-reference/openapi.yml GET /{projectId}/debug-bundle
openapi: 3.0.3
info:
  title: TestDino Public API
  version: 1.0.0
  description: >
    Public API for TestDino: read access to test analytics, manual tests, and
    project data, plus

    manual-testing write endpoints.


    **Read (GET) endpoints** cover analytics, runs, cases, and project data.
    **Write endpoints

    (POST/PATCH)** create and update manual-testing entities: suites, cases,
    releases, sessions, and

    manual runs (including per-case verdicts). Query parameters are
    **endpoint-specific**; see each

    operation for supported filters, enums, and defaults.


    Writes require a PAT whose owner holds a writer role (owner/admin/member) on
    the project's

    organization; a viewer-role token gets `403`.


    ## Authentication


    All endpoints require a Bearer token in the `Authorization` header:

    ```

    Authorization: Bearer td_pat_<token>

    ```


    Use a user PAT (`td_pat_` prefix) scoped to the organization/project.


    ## Rate Limiting


    - **Reads (per-token):** 100 requests/minute

    - **Writes (per-token):** 60 requests/minute

    - **Manual run creation (per-token):** 10 requests/minute

    - **Per-IP (pre-auth):** 200 requests/minute

    - **PDF generation:** 1 request/minute per token


    Standard headers: `RateLimit-Limit`, `RateLimit-Remaining`,
    `RateLimit-Reset`


    ## Response Format


    **Success:**

    ```json

    { "success": true, "data": { ... }, "pagination": { ... } }

    ```


    **Error:**

    ```json

    { "success": false, "error": { "code": "ERROR_CODE", "message":
    "Human-readable message" } }

    ```


    ## Time windows and date filters


    There is **no global date-filter convention**. Each endpoint documents its
    own parameters:


    | Endpoint family | Parameter | Allowed values |

    |-----------------|-----------|------------------|

    | Test runs list | `start_date`, `end_date` | RFC3339 timestamps (both
    required together) |

    | Explorer, specs, analytics | `days` | Integer snapped to **7, 30, or 90**
    (see each endpoint) |

    | Test runs list | — | No preset `period` / `dateRange` params |

    | Dashboard, filters | — | **No query params** (fixed snapshot) |


    ## Served by
  contact:
    name: TestDino Support
    url: https://docs.testdino.com
servers:
  - url: https://api.testdino.com/api/v1/public
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Token Info
    description: Token introspection and project metadata
  - name: Test Runs
    description: List, inspect, and drill into test runs
  - name: Test Cases
    description: Automated test case details and history
  - name: Specs
    description: Project-level spec file health
  - name: Manual Tests
    description: Manual test suites and cases (read-only)
  - name: Test Case Explorer
    description: Aggregated test case metrics explorer
  - name: Debug Bundle
    description: >-
      Debugging payload at 3 scopes (run, suite, test): error, steps, failure
      window, attempt history, artifacts, trace, deep links, and a copy-paste
      retry command. Designed for AI agents and CI scripts.
  - name: Dashboard
    description: Project health overview
  - name: Filters
    description: Available filter values (environments, branches, developers, tags)
  - name: Reports
    description: PDF report generation and download
  - name: Analytics
    description: Consolidated analytics summary and test case execution performance
  - name: Webhooks
    description: Outbound webhook subscriptions and delivery history
  - name: Usage
    description: Subscription usage and limits
  - name: Workflows
    description: Rules that skip, quarantine, or tag tests on the next test run
paths:
  /{projectId}/debug-bundle:
    get:
      tags:
        - Debug Bundle
      summary: Get a debug bundle for a run, suite, or test case
      description: >
        Returns a debugging payload at run, suite, or test scope.

        Pass `runId`, `suiteId` + `runId`, or `caseId` (+ optional `runId`).

        Use `as=markdown` for Markdown output and `budgetChars` to cap its size.


        This endpoint replaces `GET /{projectId}/context`, which now returns
        `404`. The retired

        query parameters `format`, `detail`, and `maxLength` return `400
        VALIDATION_ERROR`

        instead of being ignored.
      operationId: getDebugBundle
      parameters:
        - $ref: '#/components/parameters/projectId'
        - name: runId
          in: query
          schema:
            type: string
          description: Run ID. Required for run scope and required with `suiteId`.
        - name: suiteId
          in: query
          schema:
            type: string
          description: Suite ID. Requires `runId`.
        - name: caseId
          in: query
          schema:
            type: string
          description: >-
            Test case ID. `runId` is optional; when omitted, the latest run is
            resolved and echoed in `data.meta.runId`.
        - name: attempt
          in: query
          schema:
            type: integer
            minimum: 0
          description: >-
            Zero-indexed attempt number. Requires `caseId`; sending it at run or
            suite scope returns `400`. Defaults to the latest attempt.
        - name: as
          in: query
          schema:
            type: string
            enum:
              - json
              - markdown
            default: json
          description: >-
            Response format: `json` (default) or `markdown` (`text/markdown`
            body).
        - name: view
          in: query
          schema:
            type: string
            enum:
              - full
              - brief
              - headline
            default: full
          description: >-
            Payload size mode. Test scope: `brief` drops `steps[]`; `headline`
            also drops `stdout` and `stderr` and caps `artifacts.*` arrays at 5
            with a `totals` field. Suite scope: `brief` and `headline` set each
            item's `failureWindow` to `null`. Run scope: only `full` is
            accepted; any other value returns `400`.
        - name: page
          in: query
          schema:
            type: integer
            default: 1
            minimum: 1
            maximum: 1000000
          description: >-
            Pagination (run and suite scopes only). A non-default value with
            `caseId` returns `400`. Out-of-range or non-integer values return
            `400`.
        - name: limit
          in: query
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 50
          description: >-
            Pagination size (run and suite scopes only), 1 to 50. A non-default
            value with `caseId` returns `400`. Out-of-range or non-integer
            values return `400`.
        - name: budgetChars
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 50000
          description: >-
            Truncate the Markdown response to N characters, 1 to 50000. Requires
            `as=markdown`; sending it with a JSON response returns `400`.
      responses:
        '200':
          description: >
            Standard envelope: `{ success, data }`. `data` is discriminated by
            `data.scope`:

            - `"run"`: `{ scope, runId, runStatus, suites[], items[] (each with
            alsoFailedIn[]), count, total, nextPage, meta, environment, links }`

            - `"suite"`: `{ scope, spec, suiteStatus, items[] (each with
            failureWindow; null under view=brief or headline), count, total,
            nextPage, meta, environment, links }`

            - `"test"`: `{ scope, spec, test, error, attemptHistory[] (each with
            its own 0-based attempt index; the selected attempt is excluded),
            traceLink, failureWindow, steps[], stdout, stderr, artifacts, meta,
            environment, links }`


            `failureWindow` has `before`, `failed`, and `after` steps.


            With `?as=markdown` the body is a Markdown document whose sections
            depend on scope:

            run: Failing suites, Failing tests, Actions. Suite: Failing tests
            (each with Error and

            Failure window), Actions. Test: Error, Failure window, Steps,
            stdout, stderr, Attempt

            history, Artifacts, Actions.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    description: >-
                      Shape varies by `scope`. See the response description for
                      per-scope fields.
                    properties:
                      scope:
                        type: string
                        enum:
                          - run
                          - suite
                          - test
                        description: >-
                          Discriminator: tells the caller which shape they
                          received.
                      links:
                        type: object
                        description: Present at every scope.
                        properties:
                          uiUrl:
                            type: string
                            description: >-
                              Deep-link to the corresponding page in the
                              TestDino UI.
                          traceViewerUrl:
                            type: string
                            nullable: true
                            description: >-
                              Test scope only. Pre-loaded `trace.playwright.dev`
                              URL. `null` when no trace zip is attached.
                          retryCommand:
                            type: string
                            description: >-
                              Copy-paste `npx playwright test ...` command to
                              reproduce locally.
            text/markdown:
              schema:
                type: string
                description: Markdown document. Returned when `?as=markdown`.
        '400':
          description: >
            Validation failure. Codes: `VALIDATION_ERROR` (none of `runId`,
            `suiteId`, or `caseId` provided; bad `as`, `view`, or `budgetChars`;
            a retired `format`, `detail`, or `maxLength` parameter; a parameter
            that cannot apply to the resolved scope; or any parameter given more
            than once), `INVALID_ATTEMPT` (attempt index out of range).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            Codes: `TEST_RUN_NOT_FOUND`, `TEST_SUITE_NOT_FOUND`,
            `TEST_CASE_NOT_FOUND`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    projectId:
      name: projectId
      in: path
      required: true
      schema:
        type: string
      description: >-
        The project identifier (e.g. `project_abc123`). Must match the project
        associated with your PAT.
  schemas:
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  responses:
    Unauthorized:
      description: Missing, invalid, expired, or revoked token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Invalid or unknown user PAT
    RateLimited:
      description: Rate limit exceeded
      headers:
        RateLimit-Limit:
          description: Max requests allowed in the current window
          schema:
            type: integer
            example: 100
        RateLimit-Remaining:
          description: Requests remaining in the current window
          schema:
            type: integer
            example: 0
        RateLimit-Reset:
          description: Seconds until the current window resets
          schema:
            type: integer
            example: 42
        Retry-After:
          description: Seconds to wait before retrying
          schema:
            type: integer
            example: 60
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              code: RATE_LIMIT_EXCEEDED
              message: Too many requests
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: User PAT (td_pat_) scoped to the target project

````