> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trunk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Flaky Tests: Create tickets through the v2 API

> A new v2 endpoint files a ticket for a test in its collection's default ticketing integration and links it to the test.

**You can now create a ticket for a flaky or broken test from the v2 API, not only from the web app.**

### New features

* **Create a ticket for a test.** The new [Create a ticket for a test](https://docs.trunk.io/flaky-tests/reference/api-reference/v2/tests/create-a-ticket-for-a-test.md) endpoint files a ticket in the test collection's default ticketing integration and links it to the test. The ticket uses the field defaults saved on that integration, and any `fields` you pass override them.
* **Generated title and description.** Leave out `title` or `description` and Trunk writes them the way the web app does: the test's location, failure rate, owners and most common failure reasons, with a link back to the test.
* **One ticket per test.** If the test already has a ticket, the call is refused unless you set `replaceExisting`.

See the [API reference](https://docs.trunk.io/flaky-tests/reference/api-reference) for all v2 endpoints.
