# Suites API

## List all suites

Returns a [paginated list](/docs/rest-api#pagination) of an organization's suites.

```bash
curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites"
```

```json
[
  {
    "id": "3e979a94-a479-4a6e-ab8d-8b6607ffb62c",
    "graphql_id": "U3VpdGUtLS0zZTk3OWE5NC1hNDc5LTRhNmUtYWI4ZC04YjY2MDdmZmI2MmM=",
    "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "slug":"my_suite_slug",
    "name":"My suite name",
    "url":"https://api.buildkite.com/v2/analytics/organizations/my_great_org/suites/my_suite_slug",
    "web_url":"https://buildkite.com/organizations/my_great_org/analytics/suites/my_suite_slug",
    "default_branch":"main",
    "application_name": "Buildkite",
    "color": "#FFF700",
    "emoji": "🍋",
    "oidc_policy": null,
    "test_state_management": false,
    "allowed_test_states": []
  }
]
```

Optional [query string parameters](/docs/api#query-string-parameters):



| `show_api_token` | Return the suite's API token in the response. A 403 Forbidden error is returned if the user does not have permission to view the suite's API token. _Default value:_ `false`. _Example:_ `?show_api_token=true` |
| --- | --- |



Required scope: `read_suites`

Success response: `200 OK`

## List suites for a pipeline

Returns a [paginated list](/docs/rest-api#pagination) of the Buildkite Test Engine suites that have recorded at least one run attributed to a pipeline, ordered by creation time. Each suite is returned once, even if it has recorded several runs for the pipeline.

```bash
curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/pipelines/{pipeline.slug}/suites"
```

```json
[
  {
    "id": "3e979a94-a479-4a6e-ab8d-8b6607ffb62c",
    "graphql_id": "U3VpdGUtLS0zZTk3OWE5NC1hNDc5LTRhNmUtYWI4ZC04YjY2MDdmZmI2MmM=",
    "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "slug":"my_suite_slug",
    "name":"My suite name",
    "url":"https://api.buildkite.com/v2/analytics/organizations/my_great_org/suites/my_suite_slug",
    "web_url":"https://buildkite.com/organizations/my_great_org/analytics/suites/my_suite_slug",
    "default_branch":"main",
    "application_name": "Buildkite",
    "color": "#FFF700",
    "emoji": "🍋",
    "oidc_policy": null,
    "test_state_management": false,
    "allowed_test_states": []
  }
]
```

Required scope: `read_suites`

Success response: `200 OK`

## Get a suite

```bash
curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites/{suite.slug}"
```

```json
{
  "id": "3e979a94-a479-4a6e-ab8d-8b6607ffb62c",
  "graphql_id": "U3VpdGUtLS0zZTk3OWE5NC1hNDc5LTRhNmUtYWI4ZC04YjY2MDdmZmI2MmM=",
  "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "slug":"my_suite_slug",
  "name":"My suite name",
  "url":"https://api.buildkite.com/v2/analytics/organizations/my_great_org/suites/my_suite_slug",
  "web_url":"https://buildkite.com/organizations/my_great_org/analytics/suites/my_suite_slug",
  "default_branch":"main",
  "application_name": "Buildkite",
  "color": "#FFF700",
  "emoji": "🍋",
  "oidc_policy": null,
  "test_state_management": false,
  "allowed_test_states": []
}
```

Optional [query string parameters](/docs/api#query-string-parameters):



| `show_api_token` | Return the suite's API token in the response. A 403 Forbidden error is returned if the user does not have permission to view the suite's API token. _Default value:_ `false`. _Example:_ `?show_api_token=true` |
| --- | --- |



Required scope: `read_suites`

Success response: `200 OK`

## Create a suite

```bash
curl -H "Authorization: Bearer $TOKEN" \
  -X POST "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jasmine",
    "default_branch": "main",
    "application_name": "Buildkite",
    "color": "#FFF700",
    "emoji": "🍋",
    "show_api_token": true,
    "team_ids": ["3f4aa5ee-671b-41b0-9b44-b94831db6cc8"]
  }'
```

```json
{
  "id": "3e979a94-a479-4a6e-ab8d-8b6607ffb62c",
  "graphql_id": "U3VpdGUtLS0zZTk3OWE5NC1hNDc5LTRhNmUtYWI4ZC04YjY2MDdmZmI2MmM=",
  "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "slug": "jasmine",
  "name": "Jasmine",
  "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org/suites/jasmine",
  "web_url": "https://buildkite.com/organizations/my_great_org/analytics/suites/jasmine",
  "default_branch": "main",
  "application_name": "Buildkite",
  "color": "#FFF700",
  "emoji": "🍋",
  "api_token": "AAAAAAAAAAAAAAAAAAAAAAAA",
  "oidc_policy": null,
  "test_state_management": false,
  "allowed_test_states": []
}
```

Required [request body properties](/docs/api#request-body-properties):



| `name` | Name of the new suite. _Example:_ `"Jasmine"`. |
| --- | --- |
| `default_branch` | Your test suite will default to showing trends for this default branch, but collect data for all test runs. _Example:_ `"main"` or `"master"`. |



Optional [request body properties](/docs/api#request-body-properties):



| `show_api_token` | Return the suite's API token in the response. _Default value:_ `false`. |
| --- | --- |
| `team_ids` | An array of team UUIDs to add this suite to. You can find your team's UUID either using the [GraphQL API](/docs/apis/graphql-api), or on the Settings page for a team. This property is only available if your organization has enabled Teams, in which case it is a required field. _Example:_ `"team_ids": ["3f4aa5ee-671b-41b0-9b44-b94831db6cc8"]` |
| `application_name` | Application name for the suite. _Example:_ `"Buildkite"` |
| `repo_url` | HTTPS URL of the repository for the suite. _Example:_ `"https://example.com/acme/app"`. |
| `color` | Color for the suite navatar. _Example:_ `"#FFF700"` |
| `emoji` | Emoji for the suite navatar. Check out our [documentation for supported emoji](https://github.com/buildkite/emojis?tab=readme-ov-file#emoji-reference). _Example:_ `"🍋"`, `"\:lemon\:"` |
| `oidc_policy` | The [OIDC policy](/docs/pipelines/configure/tests/test-collection/oidc) for the suite, as a YAML string or a JSON array of policy statements. Pass `null` to clear the policy. _Example:_ `"- iss: \"https://agent.buildkite.com\"\n claims:\n organization_slug: my-org\n pipeline_slug: my-pipeline\n scopes:\n - read_suites\n - write_uploads\n"` |
| `flaky_detection` | Set to `false` if you don't want to create the `flaky` label and the default flaky test detection workflow. The default workflow is created only when your plan includes workflows. This option applies only when creating a suite. _Default value:_ `true`. |
| `test_state_management` | Enable [test state management](/docs/pipelines/configure/tests/test-suites/test-state-and-quarantine) for the suite. Requires a Pro or Enterprise plan. _Default value:_ `false`. |
| `allowed_test_states` | An array of allowed quarantine states: `"muted"`, `"skipped"`, or both. Requires `test_state_management` to be enabled to use these states. Do not include `"enabled"`, which is always available. _Default value:_ `[]`. _Example:_ `["muted", "skipped"]`. |



Required scope: `write_suites`

Success response: `201 Created`

## Update a suite

```bash
curl -H "Authorization: Bearer $TOKEN" \
  -X PATCH "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites/{suite.slug}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jasmine",
    "default_branch": "main"
  }'
```

```json
{
  "id": "3e979a94-a479-4a6e-ab8d-8b6607ffb62c",
  "graphql_id": "U3VpdGUtLS0zZTk3OWE5NC1hNDc5LTRhNmUtYWI4ZC04YjY2MDdmZmI2MmM=",
  "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "slug": "jasmine",
  "name": "Jasmine",
  "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org/suites/jasmine",
  "web_url": "https://buildkite.com/organizations/my_great_org/analytics/suites/jasmine",
  "default_branch": "main",
  "application_name": "Buildkite",
  "color": "#FFF700",
  "emoji": "🍋",
  "oidc_policy": null,
  "test_state_management": false,
  "allowed_test_states": []
}
```

Optional [request body properties](/docs/api#request-body-properties):



| `name` | Name of the suite. Changing the name regenerates the suite's `slug`. Use the returned `slug` or `url` for subsequent requests. _Example:_ `"Jasmine"`. |
| --- | --- |
| `default_branch` | Your test suite will default to showing trends for this default branch, but collect data for all test runs. _Example:_ `"main"` or `"master"`. |
| `application_name` | Application name for the suite. _Example:_ `"Buildkite"` |
| `repo_url` | HTTPS URL of the repository for the suite. _Example:_ `"https://example.com/acme/app"`. |
| `color` | Color for the suite navatar. _Example:_ `"#ffb7c5"` |
| `emoji` | Emoji for the suite navatar. Check out our [documentation for supported emoji.](https://github.com/buildkite/emojis?tab=readme-ov-file#emoji-reference) _Example:_ `"🌸"`, `"\:cherry_blossom\:"` |
| `show_api_token` | Return the suite's API token in the response. _Default value:_ `false`. |
| `oidc_policy` | The [OIDC policy](/docs/pipelines/configure/tests/test-collection/oidc) for the suite, as a YAML string or a JSON array of policy statements. Pass `null` to clear the policy. _Example:_ `"- iss: \"https://agent.buildkite.com\"\n claims:\n organization_slug: my-org\n pipeline_slug: my-pipeline\n scopes:\n - read_suites\n - write_uploads\n"` |
| `test_state_management` | Enable or disable test state management for the suite. Requires a Pro or Enterprise plan. Disabling permanently resets all muted and skipped tests to enabled. Re-enabling does not restore their previous states. |
| `allowed_test_states` | Replace the allowed quarantine states with an array containing `"muted"`, `"skipped"`, or both. Do not include `"enabled"`, which is always available. A state cannot be removed while tests use it or it is the automatic-quarantine default. Pass `[]` to allow only enabled tests. _Example:_ `["muted", "skipped"]`. |



Required scope: `write_suites`

Success response: `200 OK`

## Delete a suite

```bash
curl -H "Authorization: Bearer $TOKEN" \
  -X DELETE "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites/{suite.slug}"
```

Required scope: `write_suites`

Success response: `204 No Content`
