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

# Cancel a test session

> Cancels in-progress Playwright runs within the specified test session. Use the optional `sequenceId` field in the request body to cancel only specific results within the session; omit it to cancel everything still running.

Returns `204 No Content` once the cancellation requests have been dispatched. Returns `404 Not Found` if the test session does not exist.

Test sessions are recorded with `checkly test`, `checkly trigger`, and `checkly pw-test`. Cancellation applies only to the session's Playwright Check Suite runs — any URL, API, Browser, Multistep, Heartbeat, TCP, DNS, or ICMP runs continue until they finish normally.

See [Cancellation](/concepts/cancellation) for how cancelled runs affect alerts, metrics, and the `CANCELLED` session status.


## OpenAPI

````yaml post /v1/test-sessions/{testSessionId}/cancel
openapi: 3.0.0
info:
  title: Checkly Public API
  version: v1
  description: >-
    These are the docs for the newly released Checkly Public API. If you have
    any questions, please do not hesitate to get in touch with us.
servers:
  - url: https://api.checklyhq.com
security:
  - Bearer: []
tags: []
paths:
  /v1/test-sessions/{testSessionId}/cancel:
    post:
      tags:
        - Test sessions
      summary: Cancel a test session
      description: >-
        Cancels in-progress Playwright runs within the specified test session.
        Use the optional `sequenceId` field in the request body to cancel only
        specific results within the session; omit it to cancel everything still
        running.


        Returns `204 No Content` once the cancellation requests have been
        dispatched. Returns `404 Not Found` if the test session does not exist.
      operationId: postV1TestsessionsTestsessionidCancel
      parameters:
        - schema:
            type: string
            format: uuid
            description: Test session ID.
          required: true
          description: Test session ID.
          name: testSessionId
          in: path
        - schema:
            type: string
            format: uuid
            description: >-
              Your Checkly account ID, you can find it at
              https://app.checklyhq.com/settings/account/general
          required: false
          description: >-
            Your Checkly account ID, you can find it at
            https://app.checklyhq.com/settings/account/general
          name: x-checkly-account
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestSessionsV1CancelRequest'
      responses:
        '204':
          description: Cancellation accepted.
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    TestSessionsV1CancelRequest:
      type: object
      properties:
        sequenceId:
          type: array
          items:
            type: string
            format: uuid
          minItems: 1
          description: >-
            Subset of sequence IDs to cancel. Omit to cancel all in-progress
            sequences.
      additionalProperties: false
    ApiError:
      type: object
      properties:
        statusCode:
          type: number
        error:
          type: string
        message:
          type: string
      required:
        - statusCode
        - error
        - message
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: Bearer
      description: >-
        The Checkly Public API uses API keys to authenticate requests. You can
        get the API Key
        [here](https://app.checklyhq.com/settings/user/api-keys). Your API key
        is like a password:  keep it secure!

        Authentication to the API is performed using the Bearer auth method in
        the Authorization header and using the account ID.

        For example, set **Authorization** header while using cURL: `curl -H
        "Authorization: Bearer [apiKey]" "X-Checkly-Account: [accountId]"` 

````