Skip to main content
The Flaky Tests v1 endpoints are scoped to a repository. The v2 endpoints are scoped to a test collection. If your tests are still organized by repository, first move them into test collections. The two scopes are separate APIs, not two versions of one API. So not every v1 endpoint has a v2 equivalent with the same shape.

What changes

  • Credential. v1 uses the organization API token in x-api-token. v2 uses an API key in Authorization: Bearer <key>. Any API key can call the Flaky Tests endpoints. They need no permission.
  • Base URL. v1 paths go after https://api.trunk.io/v1. v2 paths already start with /v2, so they go after https://api.trunk.io.
  • Method. v1 endpoints are POST with a JSON body. v2 reads are GET with query parameters.
  • Lists. v2 lists are paginated with cursors.
  • Errors. v2 errors use the error envelope. Switch on error.code.

Endpoint map

A test’s ID is not the same value in both scopes, so an ID read from a repository endpoint can’t be passed to a collection endpoint or vice versa. The repository’s repository.id is the only identifier the two share.
Tools that don’t accept API keys yet, including the Trunk Analytics CLI, trunk-io/analytics-uploader, and the Trunk MCP server’s token sign-in, still need the organization API token.