> ## 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.

# Linear integration

> Triage your flaky tests faster by creating automatically assigned and labeled tickets with the Linear integration

When Trunk Flaky Tests [detects a flaky test](../../detection/index), you can create an automatically generated Linear ticket for your team to pick up and fix the test.

Webhook payloads will also contain ticket information when a Linear ticket is created with the integration or when [existing tickets are linked](https://docs.trunk.io/flaky-tests/management/ticketing/linear-integration.md#link-existing-tickets-to-tests).

## Connecting to Linear

![](https://mintcdn.com/trunk-4cab4936/WAR0qJ1WO0rtUlqz/assets/flaky-tests/management/ticketing/linear-integration-light.png?fit=max\&auto=format\&n=WAR0qJ1WO0rtUlqz\&q=85\&s=d5cdf61066f0ff1bc16235949e97d3ef)

To connect a Linear project:

1. Navigate to **Settings** → **Organization** → **Ticketing**.
2. Select **Linear** as your Ticketing System.
3. Add a [Linear API key](https://docs.trunk.io/flaky-tests/management/ticketing/linear-integration.md#api-key-permissions)
4. Select a Team and **Connect to Linear**.

After connecting, you can configure field defaults for auto-created tickets — including Priority, Labels, Estimate, Project, and Assignee — all scoped to the selected team. See [Field defaults](#field-defaults) below.

### API Key permissions

The following project permissions must be granted to your Linear API key so Trunk can read, create, and assign tickets automatically:

* *Read*
* *Create issues*

Selecting *Full Access* will also grant the required permissions.

## Ticket automation

Once the integration is fully configured, you can enable [automatic ticketing](https://docs.trunk.io/flaky-tests/management/ticketing/automatic-ticketing.md) from the same settings page: Trunk will create Linear issues when tests become flaky or broken, reopen them on regression, and close them when tests return to healthy.

## Create a new ticket

You can create a new ticket for any test listed in Flaky Tests.&#x20;

To create one, open the test from your collection's **Tests** tab and click the **Create Ticket** button on its [details page](https://docs.trunk.io/flaky-tests/dashboard.md#test-case-details).

Before you create the ticket, you get a preview of the title and description.

![](https://mintcdn.com/trunk-4cab4936/WAR0qJ1WO0rtUlqz/assets/flaky-tests/management/ticketing/linear-ticket-creation-light.png?fit=max\&auto=format\&n=WAR0qJ1WO0rtUlqz\&q=85\&s=b7eb10207bed23c9f68e302ac95227ed)

### Create with Linear

If you are connected to Linear, you can click the **Create Linear Ticket** button at the end of the modal to automatically create a ticket with the configured team and any field defaults you have set.

Note: You can use [Flaky Tests webhooks](https://docs.trunk.io/flaky-tests/webhooks/linear-integration.md) to automate ticket creation, or if you need more control over how tickets are created in Linear. This integration is not required when using webhooks.

## Field defaults

After selecting a team, you can configure default values that pre-populate whenever a new Linear ticket is created from Flaky Tests:

| Field | Description |
| - | - |
| **Priority** | Default issue priority (Urgent, High, Medium, Low, No priority) |
| **Labels** | One or more team-level or workspace-level labels to apply |
| **Estimate** | Default story point estimate (scale matches your team's estimation type: Fibonacci, T-shirt, linear, or exponential) |
| **Project** | Default Linear project, filtered to projects accessible by the selected team |
| **Assignee** | Default assignee, chosen from team members |

Changing the selected team clears and reloads all field options automatically.

Field defaults are saved with the integration, so every collection that uses it gets the same defaults. When you open the **Create Ticket** modal, all configured defaults are pre-filled and can be overridden before submitting.

### Requiring fields at ticket creation

For each field, you can check **Require user to fill at creation** instead of setting a default value. When this option is on, the field appears in the **Create Ticket** modal as a required input. The **Create Linear Ticket** button stays disabled until the user fills every required field.

This is useful for fields like **Project** or **Assignee** where the right value depends on the specific test being triaged and should not be pre-set globally.

## Link existing tickets to tests

If you already have a Linear ticket for a test, you can link it directly from the Test Details page without creating a new one.

**From the UI:**

1. Open the test case details page.
2. Click **Link Ticket** in the top-left corner.
3. Enter the Linear ticket URL or ID and click **Submit**.

The ticket appears on the test details page and its metadata (title, status, assignee) syncs from Linear.

**Via API:**

You can also link tickets programmatically using the [Link a ticket to a test API](https://docs.trunk.io/api/tests/link-a-ticket-to-a-test.md).
