Skip to main content
The Trunk Flaky Tests API is an HTTP REST API, returns JSON from all requests, and uses standard HTTP response codes. Endpoints come in two scopes, and they are not interchangeable. Which one you want depends on how your tests are organized — see migrating to test collections if you are moving between them.

Test collection endpoints

Scoped to test collections, on /v2. Use these if your tests are organized into collections.

List test collections

Create a test collection

Get a test collection

List and search test cases

Get a test case

List a test case's status transitions

List a test case's runs

Authenticate with either an organization API key as Authorization: Bearer <key>, or a short-lived first-party token in the x-trunk-token header. Existing v1 API tokens work unchanged as organization API keys. Every 4xx and 5xx response is an error envelope — switch on its code, which is stable, rather than its prose message.

Repository endpoints

Scoped to repositories, on /v1. Use these if your tests are still organized by repository. All requests must be authenticated by providing the x-api-token header.

Get the details of a test case

Link a ticket to a test case

Get a list of distinct tests that failed in the given time range

Get a list of unhealthy tests

Get a list of quarantined tests

Choosing between them

The two scopes are separate APIs rather than two versions of one, so there is not a collection equivalent of every repository endpoint:
A test case’s ID is not the same value in both scopes, so an ID read from a repository endpoint cannot be passed to a collection endpoint or vice versa. The repository’s repository.id is the only identifier the two share.

Questions

Ask us in Slack or email support@trunk.io.