What changes
- Credential. v1 uses the organization API token in
x-api-token. v2 uses an API key inAuthorization: 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 afterhttps://api.trunk.io. - Method. v1 endpoints are
POSTwith a JSON body. v2 reads areGETwith 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.trunk-io/analytics-uploader, and the Trunk MCP server’s token sign-in, still need the organization API token.