LogoLogo
SlackLogin
  • Overview
    • Welcome
  • Setup & Configuration
    • Connecting to Trunk
    • Managing Your Organization
      • GitHub App Permissions
  • Integration with Slack
  • Flaky Tests (Beta)
    • Overview
    • Get Started
      • Test Frameworks
        • Android
        • Bazel
        • Behave
        • cargo-nextest
        • Cypress
        • Dart Test
        • Go
        • GoogleTest
        • Gradle
        • Jasmine
        • Jest
        • Karma
        • Maven
        • minitest
        • Mocha
        • Nightwatch
        • NUnit
        • Pest
        • PHPUnit
        • Playwright
        • Pytest
        • Robot Framework
        • RSpec
        • Swift Testing
        • Vitest
        • XCTest
        • Other Test Frameworks
      • CI Providers
        • Azure DevOps Pipelines
        • BitBucket Pipelines
        • Buildkite
        • CircleCI
        • Drone CI
        • GitHub Actions
        • GitLab
        • Jenkins
        • Semaphore CI
        • TeamCity
        • Travis CI
        • Other CI Providers
    • Dashboard
    • Flaky Test Detection
    • Quarantining
    • PR Comments
    • Ticketing Integrations
      • Jira Integration
      • Linear Integration
      • Other Ticketing Platforms
    • Webhooks
      • Slack Integration
      • Microsoft Teams Integration
      • GitHub Issues Integration
      • Linear Integration
    • Uploader CLI Reference
  • Merge Queue
    • Overview
    • How does it work?
    • Setup
      • Quick Start
      • Settings
      • Integration for Slack
    • Concepts and Optimizations
      • Predictive Testing
      • Optimistic Merging
      • Pending Failure Depth
      • Anti-Flake Protection
      • Batching
      • Parallel Queues
        • Bazel
        • Nx
        • API
      • FAQ
    • Priority
    • Managing Merge Queue
      • Using the Merge UI
      • Metrics
      • Command Line
    • Webhooks
    • Reference
  • Code Quality
    • Overview
    • Why Metalinters?
      • How does it work?
      • Why Code Quality?
    • Setup & Installation
      • Initialize Trunk
      • Local Linting
      • Linting in CI
      • Nightly Report (Deprecated)
    • IDE Integration
      • VSCode
      • Neovim
      • GitHub Codespaces
    • Linters
      • Supported Linters
        • Actionlint
        • Ansible-lint
        • Autopep8
        • Bandit
        • Biome
        • Black
        • Brakeman
        • buf
        • Buildifier
        • cfnlint
        • Checkov
        • circleci
        • ClangFormat
        • clang-tidy
        • Clippy
        • cmake-format
        • codespell
        • cspell
        • cue-fmt
        • dart
        • deno
        • Detekt
        • djlint
        • dotenv-linter
        • dotnet-format
        • dustilock
        • ESLint
        • Flake8
        • git-diff-check
        • Gitleaks
        • Gofmt
        • gofumpt
        • goimports
        • gokart
        • golangci-lint
        • golines
        • google-java-format
        • graphql-schema-linter
        • hadolint
        • haml-lint
        • isort
        • iwyu
        • ktlint
        • kube-linter
        • markdown-link-check
        • markdown-table-prettify
        • Markdownlint
        • markdownlint-cli2
        • mypy
        • nancy
        • nixpkgs-fmt
        • opa
        • OSV-Scanner
        • Oxipng
        • perlcritic
        • perltidy
        • php-cs-fixer
        • phpstan
        • pmd
        • pragma-once
        • pre-commit-hooks
        • Prettier
        • prisma
        • psscriptanalyzer
        • Pylint
        • pyright
        • regal
        • remark-lint
        • renovate
        • rome
        • rubocop
        • Ruff
        • rufo
        • rustfmt
        • scalafmt
        • semgrep
        • ShellCheck
        • shfmt
        • sort-package-json
        • sourcery
        • sql-formatter
        • SQLFluff
        • sqlfmt
        • squawk
        • standardrb
        • stringslint
        • stylelint
        • stylua
        • SVGO
        • swiftformat
        • swiftlint
        • taplo
        • Terraform
        • terragrunt
        • terrascan
        • TFLint
        • tfsec
        • tofu
        • Trivy
        • Trufflehog
        • txtpbfmt
        • vale
        • Yamllint
        • yapf
      • Run Linters
      • Manage Linters
      • Configure Linters
      • Ignoring Issues and Files
      • Custom Linters
      • Shared Configs
      • Upgrades
    • Debugging
    • Licensing
  • CLI & API References
    • CLI Reference
      • Install
      • Getting Started
        • Code Quality
        • Merge Queue
        • Flaky Tests
        • Tools
        • Actions
          • Git Hooks
        • Announce
      • Compatibility
      • Caching
      • Commands Reference
        • Code Quality
        • Actions
        • Merge
      • Configuration
        • Plugins
          • Share Config Between Codebases
          • Exporting Linter Configs
        • Runtimes
        • Tools
        • Lint
          • Definitions
          • Commands
          • Output
          • Output Parsing
          • Files and Caching
          • Dependencies
          • Auto-Enable
        • Actions
          • Notifications
          • Logging and Troubleshooting
        • Merge
        • Telemetry
        • Per User Overrides
    • API Reference
      • Flaky Tests
      • Merge Queue
      • Webhooks Reference
  • Pricing & Security
    • Security
  • Billing
  • Community & Support
  • Links
    • Open App
    • Slack Community
    • Changelog
    • Feature Requests
On this page
Edit on GitHub
  1. CLI & API References
  2. API Reference

Flaky Tests

Last updated 21 days ago

The Trunk Flaky Tests API provides access to check the status of Trunk services and fetch tests in your project. The API is an HTTP REST API, returns JSON from all requests, and uses standard HTTP response codes.

All requests must be by providing the x-api-token header.

quarantined
authenticated
  • POSTGet a list of quarantined tests
  • POSTGet a list of quarantined tests
  • POSTLink a ticket to a test case

Get a list of quarantined tests

post
Authorizations
Body
org_url_slugstringRequired

The slug of your organization. Find this at https://app.trunk.io/trunk/settings under "Organization Name" > "Slug"

Example: my-trunk-org-slug
Responses
200
OK
application/json
401
Unauthorized
application/plain-text
post
POST /v1/flaky-tests/list-quarantined-tests HTTP/1.1
Host: api.trunk.io
x-api-token: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 151

{
  "repo": {
    "host": "github.com",
    "owner": "my-github-org",
    "name": "my-repo"
  },
  "org_url_slug": "my-trunk-org-slug",
  "page_query": {
    "page_size": 1,
    "page_token": ""
  }
}
{
  "quarantined_tests": [
    {
      "name": "text",
      "parent": null,
      "file": null,
      "classname": null,
      "status": "HEALTHY",
      "codeowners": [
        "text"
      ],
      "quarantine_setting": "ALWAYS_QUARANTINE",
      "status_last_updated_at": "2025-05-12T21:02:56.857Z",
      "test_case_id": "text",
      "variant": "text"
    }
  ],
  "page": {
    "total_rows": 1,
    "total_pages": 1,
    "next_page_token": "text",
    "prev_page_token": "text",
    "last_page_token": "text",
    "page_index": 1
  }
}

Get a list of quarantined tests

post
Authorizations
Body
org_url_slugstringRequired

The slug of your organization. Find this at https://app.trunk.io/trunk/settings under "Organization Name" > "Slug"

Example: my-trunk-org-slug
Responses
200
OK
application/json
401
Unauthorized
application/plain-text
post
POST /v1/flaky-tests/list-quarantined-tests HTTP/1.1
Host: api.trunk.io
x-api-token: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 151

{
  "repo": {
    "host": "github.com",
    "owner": "my-github-org",
    "name": "my-repo"
  },
  "org_url_slug": "my-trunk-org-slug",
  "page_query": {
    "page_size": 1,
    "page_token": ""
  }
}
{
  "quarantined_tests": [
    {
      "name": "text",
      "parent": null,
      "file": null,
      "classname": null,
      "status": "HEALTHY",
      "codeowners": [
        "text"
      ],
      "quarantine_setting": "ALWAYS_QUARANTINE",
      "status_last_updated_at": "2025-05-12T21:02:56.857Z",
      "test_case_id": "text",
      "variant": "text"
    }
  ],
  "page": {
    "total_rows": 1,
    "total_pages": 1,
    "next_page_token": "text",
    "prev_page_token": "text",
    "last_page_token": "text",
    "page_index": 1
  }
}

Link a ticket to a test case

post
Authorizations
Body
test_case_idstring ยท uuidRequired

The id of the test case. Should be a UUID.

Example: 01234567-0123-0123-0123-0123456789ab
external_ticket_idstringRequired

The external identifier of the ticket. For Jira this is the ticket number prefixed by the Project Key. For Linear this is the ticket number prefixed by the Team Identifier

Example: KAN-123
Responses
200
OK
application/json
400
Bad Request
application/plain-text
401
Unauthorized
application/plain-text
404
Not Found
application/plain-text
500
Internal Server Error
application/plain-text
post
POST /v1/flaky-tests/link-ticket-to-test-case HTTP/1.1
Host: api.trunk.io
x-api-token: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 156

{
  "test_case_id": "01234567-0123-0123-0123-0123456789ab",
  "external_ticket_id": "KAN-123",
  "repo": {
    "host": "github.com",
    "owner": "my-github-org",
    "name": "my-repo"
  }
}

No content