For the complete documentation index, see llms.txt. This page is also available as Markdown.

Context

Retrieve structured test failure context for AI debugging.

The Context endpoint provides test failure data in JSON or Markdown format, suitable for feeding into AI tools and MCP integrations. It supports three detail levels:

  • Run-level: Summary of all failures across a run

  • Instance-level: Failures within a single spec file

  • Test-level: Full detail for a single test attempt

Get test failure context

get
/context

Retrieve structured test failure context for AI debugging. One of three query shapes is used:

  • Run-level: run_id only (omit instance_id and test_id). Paginate failed tests with limit and page. Add include_flaky=true to also list flaky tests after the failed ones.

  • Instance-level: run_id and instance_id (omit test_id). Paginate with limit and page.

  • Test-level: instance_id and test_id. The run is resolved server-side from the instance; optional run_id is ignored for lookup. Optional attempt selects a specific attempt; omit for the last attempt with an error (else the latest).

Responses can be large (for example, tests with many steps). There is a 1MB response limit. Include Accept-Encoding: gzip in your request when possible. You can also use detail=compact or detail=summary, or (for format=md) max_length, to reduce response size.

Authorizations
AuthorizationstringRequired

An organization API key, sent as Authorization: Bearer <key>. A key carries one scope for the whole API: a read key reaches the GET endpoints, a write key reaches all of them.

Query parameters
run_idstringOptional

Run identifier. Required for run-level (run_id only) and instance-level (run_id + instance_id, no test_id). For test-level (instance_id + test_id), ignored; the server resolves the run from the instance.

instance_idstringOptional

Instance identifier. Required for instance-level and test-level. Omit for run-level (use run_id only).

test_idstringOptional

Test identifier. When set, selects test-level detail and requires instance_id.

attemptintegerOptional

Attempt number (0-indexed); defaults to the last attempt with an error, or the latest attempt when none reported one. Test-level only: sending it without both instance_id and test_id is rejected with 400 rather than ignored.

formatstring · enumOptional

Response format. Falls back to Accept header when absent.

Default: jsonPossible values:
detailstring · enumOptional

Controls output verbosity to limit token count. 'default' returns all available data. 'compact' reduces output size by omitting the full steps array and limiting assets to 3 per category while preserving failure context and analysis. 'summary' minimizes output by including only error info and metadata.

Default: defaultPossible values:
limitinteger · min: 1 · max: 50Optional

Maximum number of failed tests per page (run-level and instance-level only)

Default: 10
pageintegerOptional

Page number for failed tests pagination, 0-indexed (run-level and instance-level only)

Default: 0
max_lengthinteger · min: 1 · max: 50000Optional

Truncate markdown response to this character limit (only applies when format=md). Useful for fitting context into AI prompts.

include_flakybooleanOptional

Run-level only. When true, flaky tests are listed after the failed ones (each with the error from its last failed attempt) and totalFlakyTests is set.

Default: false
Responses
200

Context data

statusstring · enumRequiredPossible values:
dataone ofRequired
or
or
get/context
GET /v1/context HTTP/1.1
Host: api.currents.dev
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "status": "OK",
  "data": {
    "level": "test",
    "spec": "text",
    "test": {
      "title": [
        "text"
      ],
      "status": "text",
      "attempt": 1,
      "totalAttempts": 1,
      "duration": 1
    },
    "error": {
      "message": "text",
      "stack": "text",
      "location": {
        "file": "text",
        "line": 1,
        "column": 1
      },
      "snippet": "text"
    },
    "otherAttempts": [
      {
        "attempt": 1,
        "status": "text",
        "sameError": true,
        "error": {
          "message": "text",
          "location": {
            "file": "text",
            "line": 1,
            "column": 1
          }
        }
      }
    ],
    "errorContext": {
      "name": "text",
      "url": "text"
    },
    "traceErrorAnalysis": {
      "consoleEntries": [
        {
          "time": 1,
          "messageType": "text",
          "text": "text",
          "location": {
            "url": "text",
            "lineNumber": 1,
            "columnNumber": 1
          }
        }
      ],
      "networkRequests": [
        {
          "time": 1,
          "url": "text",
          "status": 1,
          "method": "text"
        }
      ]
    },
    "failureContext": {
      "failedStepIndex": 1,
      "stepBefore": {
        "title": "text",
        "category": "text",
        "duration": 1,
        "error": {
          "message": "text",
          "stack": "text",
          "location": {
            "file": "text",
            "line": 1,
            "column": 1
          },
          "snippet": "text"
        },
        "steps": "[Circular Reference]"
      },
      "failedStep": {
        "title": "text",
        "category": "text",
        "duration": 1,
        "error": {
          "message": "text",
          "stack": "text",
          "location": {
            "file": "text",
            "line": 1,
            "column": 1
          },
          "snippet": "text"
        },
        "steps": [
          "[Circular Reference]"
        ]
      },
      "stepAfter": {
        "title": "text",
        "category": "text",
        "duration": 1,
        "error": {
          "message": "text",
          "stack": "text",
          "location": {
            "file": "text",
            "line": 1,
            "column": 1
          },
          "snippet": "text"
        },
        "steps": "[Circular Reference]"
      }
    },
    "steps": [
      {
        "title": "text",
        "category": "text",
        "duration": 1,
        "error": {
          "message": "text",
          "stack": "text",
          "location": {
            "file": "text",
            "line": 1,
            "column": 1
          },
          "snippet": "text"
        },
        "steps": [
          "[Circular Reference]"
        ]
      }
    ],
    "stdout": [
      "text"
    ],
    "stderr": [
      "text"
    ],
    "assets": {
      "traces": [
        {
          "name": "text",
          "url": "text"
        }
      ],
      "screenshots": [
        {
          "name": "text",
          "url": "text"
        }
      ],
      "videos": [
        {
          "name": "text",
          "url": "text"
        }
      ],
      "attachments": [
        {
          "name": "text",
          "filename": "text",
          "contentType": "text",
          "url": "text"
        }
      ],
      "totals": {
        "traces": 1,
        "screenshots": 1,
        "videos": 1,
        "attachments": 1
      }
    },
    "meta": {
      "projectId": "text",
      "runId": "text",
      "instanceId": "text",
      "testId": "text",
      "signature": "text",
      "attempt": 1
    },
    "environment": {
      "framework": {
        "type": "text",
        "version": "text"
      },
      "platform": {
        "osName": "text",
        "osVersion": "text",
        "browserName": "text",
        "browserVersion": "text"
      },
      "project": "text"
    },
    "git": {
      "repository": "text",
      "branch": "text",
      "sha": "text",
      "pullRequest": {
        "number": "text",
        "url": "text",
        "baseBranch": "text"
      }
    }
  }
}

Last updated

Was this helpful?