Create a ticket for a test
Files a new ticket in the test collection’s default ticketing connection and links it to a test, returning the ticket as Trunk now holds it. A collection with no default connection is refused with TICKETING_NOT_CONFIGURED.
The ticket gets the default fields saved on that connection, with fields merged over them. The provider may still refuse the ticket: a field it does not accept, or a required one neither sets, is 422 TICKET_FIELDS_REJECTED with the provider’s own message, and a connection the provider will not let create tickets (no access to its project, a missing scope, a plan limit) is 409 TICKETING_CREATE_REFUSED.
A title or description you leave out is generated the way the web app generates it: the test’s location, failure rate, owners and most common failure reasons, with a link back to the test. Failure summaries are left out while your organization has AI features turned off. A test with no data to generate from is refused with TICKET_CONTENT_UNAVAILABLE; pass both to create its ticket anyway.
A test carries at most one ticket. If one is already linked, the call is refused with TEST_ALREADY_LINKED and files nothing, unless replaceExisting is true.
Idempotency-Key is not honored. The call files the ticket with the provider and answers 504 if that takes longer than five seconds; a 504 does not mean nothing was filed. Before retrying, read the test (GET /v2/tests/{testId}): if its ticket is set, the ticket was created and linked. A 502 UPSTREAM_ERROR means the provider did not answer; when it was rate-limiting, Retry-After says how long to wait.
A test in another organization is reported as 404, not 403, and so is a malformed id.
Authorizations
An API key, sent as Authorization: Bearer <key>. An organization admin creates one in the Trunk app under Settings → Developer → API Keys and chooses the merge-queue permissions it holds; a key with none can read merge queues but change nothing. Those permissions scope merge queue only: every key can use the Flaky Tests and Dynamic CI endpoints, including their writes, whatever permissions it holds.
Path Parameters
The test's globally unique id.
1"bfeebcf4-0000-8000-8000-000000000001"
Body
The ticket to create for a test in a test collection.
The ticket's title. Defaults to the one the web app generates, such as [Flaky Test] suite::test_case_name.
1 - 250"[Flaky Test] suite::test_case_name"
The ticket's body, in Markdown. Defaults to the one the web app generates: the test's location, failure rate, owners and most common failure reasons, with a link back to the test in Trunk.
"See all details on the [Trunk Test Detail page](https://app.trunk.io/acme/flaky-tests/collections/ab12cd34/tests/bfeebcf4-0000-8000-8000-000000000001)"
Provider fields to set on the ticket, keyed by the provider's field id (a Jira custom field id, assignee, a Linear project id), in the shape the provider takes. Merged over the default fields saved on the collection's ticketing connection; a field set here wins.
Replace a ticket already linked to the test. When false or absent, a test that has a ticket is refused with TEST_ALREADY_LINKED.
false
Response
The created and linked ticket
Trunk's id for the linked ticket.
"5d4c3b2a-1f0e-4a1b-8c9d-0e1f2a3b4c5d"
The ticketing system a ticket lives in.
jiraCloud, linear, asana, jiraDataCenter "jiraCloud"
The provider's human-readable key. Mutable on some providers (a Jira issue moved between projects gets a new one).
"TRUNK-1234"
"https://acme.atlassian.net/browse/TRUNK-1234"
"[Flaky Test] suite::test_case_name"
The provider's status name, as last synced.
"In Progress"
The provider's assignee display name; null when unassigned.
"Ada Lovelace"
When Trunk last read the ticket back from its provider.
"2026-09-15T14:45:01.000Z"