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

# Link a ticket to a test case



## OpenAPI

````yaml /openapi.json post /flaky-tests/link-ticket-to-test-case
openapi: 3.1.0
info:
  title: Trunk APIs
  version: 1.0.0
  license:
    name: UNLICENSED
servers:
  - url: https://api.trunk.io/v1
security: []
paths:
  /flaky-tests/link-ticket-to-test-case:
    post:
      summary: Link a ticket to a test case
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                test_case_id:
                  type: string
                  format: uuid
                  description: The id of the test case. Should be a UUID.
                  examples:
                    - 01234567-0123-0123-0123-0123456789ab
                external_ticket_id:
                  type: string
                  description: >-
                    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
                  examples:
                    - KAN-123
                    - TRUNK-1234
                repo:
                  type: object
                  properties:
                    host:
                      type: string
                      description: >-
                        The host of the repository. For example, `github.com` or
                        `gitlab.com`. If self-hosting, this will be the hostname
                        of your instance.
                      examples:
                        - github.com
                        - gitlab.com
                        - github-enterprise.my-org-tld.com
                        - gitlab-enterprise.my-org-tld.com
                    owner:
                      type: string
                      description: >-
                        The owner of the repository. For example,
                        `my-github-org` or `my-gitlab-org/my/sub/group`. `owner`
                        for GitLab will include the GitLab org, plus the project
                        path, but excluding the repo name itself.
                      examples:
                        - my-github-org
                        - my-gitlab-org/my/sub/group
                    name:
                      type: string
                      description: The name of the repository.
                      examples:
                        - my-repo
                  required:
                    - host
                    - owner
                    - name
                  description: The repository to list tests for.
              required:
                - test_case_id
                - external_ticket_id
                - repo
      responses:
        '200':
          description: OK
          content:
            application/json: {}
        '400':
          description: Bad Request
          content:
            application/plain-text:
              schema:
                type: string
        '401':
          description: Unauthorized
          content:
            application/plain-text:
              schema:
                type: string
        '404':
          description: Not Found
          content:
            application/plain-text:
              schema:
                type: string
        '500':
          description: Internal Server Error
          content:
            application/plain-text:
              schema:
                type: string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-token

````