---
title: "Search test failures"
method: GET
path: "/api/v1/user/projects/{projectId}/search-failures"
tags: ["Analytics"]
---

# Search test failures

`GET /api/v1/user/projects/{projectId}/search-failures`

## Request

- Base URL: `https://app.gaffer.sh`
- URL: `https://app.gaffer.sh/api/v1/user/projects/{projectId}/search-failures`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in header `X-API-Key`
  - HTTP bearer

Search across test failures by error message, stack trace, or test name.
Returns matching failed test cases with context from their test runs.
Omit `query` to return every failed test case in the window.
The analysis period is clamped by your plan tier.

## Path parameters

- `projectId` string, required

## Query parameters

- `query` string
- `searchIn` 'errors' | 'names' | 'all'
- `days` integer
- `branch` string
- `limit` integer

## Response `200`

Matching test failures

- SearchFailuresResponse
  - `matches` SearchFailureMatch[], required
    - `testName` string, required: Full test name
    - `testRunId` string, required: ID of the test run containing the failure
    - `branch` string, nullable, required: Git branch name
    - `commitSha` string, nullable, required: Git commit SHA
    - `errorMessage` string, nullable, required: Error message from the test failure
    - `errorStack` string, nullable, required: Error stack trace (truncated to 500 chars)
    - `createdAt` string, date-time, required: When the test run was created
  - `total` integer, required: Number of matches returned
  - `truncated` boolean, required: True when the scan caps (at most 100 test runs, plus `limit`) stopped the scan short of the full window, so the list is incomplete
  - `query` string, nullable, required: The search query used, or null when every failure was returned

## Other responses

- `400`: Invalid request parameters
- `401`: Missing or invalid API key
- `404`: Resource not found

---

[API](https://skmtc.dev/gaffer/apis/gaffer-api.md) · [All operations](https://skmtc.dev/gaffer/apis/gaffer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/gaffer/apis/gaffer-api/revisions/d742ab303118?raw)
