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

# Cancel a browser test run

> Requires run.cancel and exact runId confirmation. Active records become cancelled transactionally and reject late results/captures. The isolated driver stops at its next worker poll (3 seconds) or remaining execution lease (15 seconds plus a 250ms expiry check). Durable reconciliation cancels only the exact recorded world interaction; cleanup retries are scheduled every minute. Previously persisted action events remain, but unfinished capture bundles are not accepted.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/projects/{projectId}/browser-runs/{runId}/cancel
openapi: 3.1.0
info:
  title: Firedrill Control API
  version: 1.0.0
  description: >-
    The control plane for drills, drill runs, and the worlds they run in. Errors
    always carry the canonical envelope; unsafe operations require an
    Idempotency-Key; long work returns an operation resource.
servers:
  - url: https://api.firedrill.run
security:
  - controlCredential: []
tags:
  - name: authentication
    description: Sessions, CLI exchange, credentials, and verification keys.
    x-group: Authentication
  - name: organizations
    description: Organization members, billing, usage, retention, audit, and exports.
    x-group: Organizations
  - name: projects
    description: Project lifecycle, access, grants, and repository bindings.
    x-group: Projects
  - name: builds
    description: Immutable builds, uploads, source drafts, and world definitions.
    x-group: Builds and source
  - name: tools
    description: Project Tool discovery, approval, source, and revocation.
    x-group: Tool library
  - name: worlds
    description: >-
      Managed environments, world sessions, state, time, reset, faults, forks,
      and snapshots.
    x-group: Environments and sessions
  - name: runs
    description: >-
      Hosted runs, comparisons, attachments, reports, evidence bundles, sharing,
      and exports.
    x-group: Runs and evidence
  - name: browser
    description: Managed browser tests, runs, messages, streams, frames, and artifacts.
    x-group: Browser testing
  - name: callbacks
    description: Callback receiver approval, revocation, and signing material.
    x-group: Callbacks
  - name: github-ci
    description: >-
      GitHub installations, repository automation, CI suites, cases, evidence,
      and checks.
    x-group: GitHub and CI
  - name: authoring
    description: Authoring sessions, proposals, turns, and scenario proposals.
    x-group: Cloud authoring
paths:
  /v1/projects/{projectId}/browser-runs/{runId}/cancel:
    post:
      tags:
        - browser
      summary: Cancel a browser test run
      description: >-
        Requires run.cancel and exact runId confirmation. Active records become
        cancelled transactionally and reject late results/captures. The isolated
        driver stops at its next worker poll (3 seconds) or remaining execution
        lease (15 seconds plus a 250ms expiry check). Durable reconciliation
        cancels only the exact recorded world interaction; cleanup retries are
        scheduled every minute. Previously persisted action events remain, but
        unfinished capture bundles are not accepted.
      operationId: browserRuns.cancel
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
            pattern: ^prj_[0-9a-z]{12,32}$
        - name: runId
          in: path
          required: true
          schema:
            type: string
            pattern: ^brun_[a-z0-9]{12,64}$
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 8
            maxLength: 128
            pattern: ^[A-Za-z0-9._:-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelBrowserRunRequest'
      responses:
        '200':
          description: Mutation result or original idempotency receipt
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelBrowserRunResponse'
        '400':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '409':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        default:
          description: Canonical error envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    CancelBrowserRunRequest:
      type: object
      properties:
        confirm:
          type: string
          pattern: ^brun_[a-z0-9]{12,64}$
      required:
        - confirm
      additionalProperties: false
    CancelBrowserRunResponse:
      type: object
      properties:
        run:
          type: object
          properties:
            schemaVersion:
              type: number
              enum:
                - 1
            runId:
              type: string
              pattern: ^brun_[a-z0-9]{12,64}$
            sourceRunId:
              type: string
              pattern: ^brun_[a-z0-9]{12,64}$
            organizationId:
              type: string
            projectId:
              type: string
            testId:
              type: string
              pattern: ^btest_[a-z0-9]{12,64}$
            testVersion:
              type: integer
              minimum: 0
              exclusiveMinimum: true
              maximum: 9007199254740991
            definition:
              type: object
              properties:
                schemaVersion:
                  type: number
                  enum:
                    - 1
                id:
                  type: string
                  pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,95}$
                title:
                  type: string
                  minLength: 1
                  maxLength: 200
                startUrl:
                  type: string
                  maxLength: 4000
                  format: uri
                task:
                  type: string
                  minLength: 1
                  maxLength: 20000
                steps:
                  default: []
                  maxItems: 500
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          action:
                            type: string
                            enum:
                              - navigate
                          url:
                            type: string
                            minLength: 1
                            maxLength: 4000
                        required:
                          - action
                          - url
                        additionalProperties: false
                      - type: object
                        properties:
                          action:
                            type: string
                            enum:
                              - click
                          selector:
                            anyOf:
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - role
                                  role:
                                    type: string
                                    enum:
                                      - button
                                      - link
                                      - textbox
                                      - checkbox
                                      - radio
                                      - combobox
                                      - option
                                      - heading
                                      - alert
                                      - status
                                      - tab
                                      - menuitem
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - role
                                  - name
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - label
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - text
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - testId
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - css
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                        required:
                          - action
                          - selector
                        additionalProperties: false
                      - type: object
                        properties:
                          action:
                            type: string
                            enum:
                              - fill
                          selector:
                            anyOf:
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - role
                                  role:
                                    type: string
                                    enum:
                                      - button
                                      - link
                                      - textbox
                                      - checkbox
                                      - radio
                                      - combobox
                                      - option
                                      - heading
                                      - alert
                                      - status
                                      - tab
                                      - menuitem
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - role
                                  - name
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - label
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - text
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - testId
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - css
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                          value:
                            type: string
                            maxLength: 20000
                          parameter:
                            type: string
                            pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,95}$
                        required:
                          - action
                          - selector
                        additionalProperties: false
                      - type: object
                        properties:
                          action:
                            type: string
                            enum:
                              - press
                          selector:
                            anyOf:
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - role
                                  role:
                                    type: string
                                    enum:
                                      - button
                                      - link
                                      - textbox
                                      - checkbox
                                      - radio
                                      - combobox
                                      - option
                                      - heading
                                      - alert
                                      - status
                                      - tab
                                      - menuitem
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - role
                                  - name
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - label
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - text
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - testId
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - css
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                          key:
                            type: string
                            minLength: 1
                            maxLength: 80
                        required:
                          - action
                          - selector
                          - key
                        additionalProperties: false
                      - type: object
                        properties:
                          action:
                            type: string
                            enum:
                              - wait
                          milliseconds:
                            type: integer
                            minimum: 0
                            maximum: 10000
                        required:
                          - action
                          - milliseconds
                        additionalProperties: false
                assertions:
                  default: []
                  maxItems: 100
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          id:
                            type: string
                            pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,95}$
                          kind:
                            type: string
                            enum:
                              - visible
                          selector:
                            anyOf:
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - role
                                  role:
                                    type: string
                                    enum:
                                      - button
                                      - link
                                      - textbox
                                      - checkbox
                                      - radio
                                      - combobox
                                      - option
                                      - heading
                                      - alert
                                      - status
                                      - tab
                                      - menuitem
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - role
                                  - name
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - label
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - text
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - testId
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - css
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                          expected:
                            default: true
                            type: boolean
                        required:
                          - id
                          - kind
                          - selector
                          - expected
                        additionalProperties: false
                      - type: object
                        properties:
                          id:
                            type: string
                            pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,95}$
                          kind:
                            type: string
                            enum:
                              - text
                          selector:
                            anyOf:
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - role
                                  role:
                                    type: string
                                    enum:
                                      - button
                                      - link
                                      - textbox
                                      - checkbox
                                      - radio
                                      - combobox
                                      - option
                                      - heading
                                      - alert
                                      - status
                                      - tab
                                      - menuitem
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - role
                                  - name
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - label
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - text
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - testId
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - css
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                          expected:
                            type: string
                            maxLength: 20000
                          contains:
                            default: false
                            type: boolean
                        required:
                          - id
                          - kind
                          - selector
                          - expected
                          - contains
                        additionalProperties: false
                      - type: object
                        properties:
                          id:
                            type: string
                            pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,95}$
                          kind:
                            type: string
                            enum:
                              - value
                          selector:
                            anyOf:
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - role
                                  role:
                                    type: string
                                    enum:
                                      - button
                                      - link
                                      - textbox
                                      - checkbox
                                      - radio
                                      - combobox
                                      - option
                                      - heading
                                      - alert
                                      - status
                                      - tab
                                      - menuitem
                                  name:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - role
                                  - name
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - label
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - text
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - testId
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                              - type: object
                                properties:
                                  by:
                                    type: string
                                    enum:
                                      - css
                                  value:
                                    type: string
                                    minLength: 1
                                    maxLength: 4000
                                required:
                                  - by
                                  - value
                                additionalProperties: false
                          expected:
                            type: string
                            maxLength: 20000
                        required:
                          - id
                          - kind
                          - selector
                          - expected
                        additionalProperties: false
                      - type: object
                        properties:
                          id:
                            type: string
                            pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,95}$
                          kind:
                            type: string
                            enum:
                              - url
                          expected:
                            type: string
                            minLength: 1
                            maxLength: 4000
                        required:
                          - id
                          - kind
                          - expected
                        additionalProperties: false
              required:
                - schemaVersion
                - id
                - startUrl
                - steps
                - assertions
              additionalProperties: false
            mode:
              type: string
              enum:
                - replay
                - agent
            interactive:
              type: boolean
            capture:
              type: object
              properties:
                screenshot:
                  default: 'off'
                  type: string
                  enum:
                    - 'off'
                    - always
                    - retain-on-failure
                video:
                  default: 'off'
                  type: string
                  enum:
                    - 'off'
                    - always
                    - retain-on-failure
                trace:
                  default: 'off'
                  type: string
                  enum:
                    - 'off'
                    - always
                    - retain-on-failure
              required:
                - screenshot
                - video
                - trace
              additionalProperties: false
            captureConsent:
              type: string
              enum:
                - include-sensitive-content
            captureMask:
              maxItems: 32
              type: array
              items:
                anyOf:
                  - type: object
                    properties:
                      by:
                        type: string
                        enum:
                          - role
                      role:
                        type: string
                        enum:
                          - button
                          - link
                          - textbox
                          - checkbox
                          - radio
                          - combobox
                          - option
                          - heading
                          - alert
                          - status
                          - tab
                          - menuitem
                      name:
                        type: string
                        minLength: 1
                        maxLength: 4000
                    required:
                      - by
                      - role
                      - name
                    additionalProperties: false
                  - type: object
                    properties:
                      by:
                        type: string
                        enum:
                          - label
                      value:
                        type: string
                        minLength: 1
                        maxLength: 4000
                    required:
                      - by
                      - value
                    additionalProperties: false
                  - type: object
                    properties:
                      by:
                        type: string
                        enum:
                          - text
                      value:
                        type: string
                        minLength: 1
                        maxLength: 4000
                    required:
                      - by
                      - value
                    additionalProperties: false
                  - type: object
                    properties:
                      by:
                        type: string
                        enum:
                          - testId
                      value:
                        type: string
                        minLength: 1
                        maxLength: 4000
                    required:
                      - by
                      - value
                    additionalProperties: false
                  - type: object
                    properties:
                      by:
                        type: string
                        enum:
                          - css
                      value:
                        type: string
                        minLength: 1
                        maxLength: 4000
                    required:
                      - by
                      - value
                    additionalProperties: false
            state:
              type: string
              enum:
                - queued
                - running
                - passed
                - failed
                - completed
                - cancelled
            worldVerified:
              type: boolean
            worldBinding:
              type: object
              properties:
                hostedRunId:
                  type: string
                  pattern: ^hrun_[0-9a-z]{12,32}$
                expectedRevision:
                  type: integer
                  minimum: 0
                  exclusiveMinimum: true
                  maximum: 9007199254740991
                packageId:
                  type: string
                  minLength: 1
                  maxLength: 255
                sessionId:
                  type: string
                  minLength: 1
                  maxLength: 255
                actorId:
                  type: string
                  minLength: 1
                  maxLength: 255
                interactionId:
                  type: string
                  minLength: 1
                  maxLength: 255
                buildHash:
                  type: string
                  pattern: ^sha256:[0-9a-f]{64}$
              required:
                - hostedRunId
                - expectedRevision
                - packageId
                - sessionId
                - actorId
                - interactionId
                - buildHash
              additionalProperties: false
            worldVerification:
              type: object
              properties:
                state:
                  type: string
                  enum:
                    - pending
                    - verified
                    - failed
                    - cancelled
                evidenceBundleId:
                  type: string
                  minLength: 1
                  maxLength: 255
                verdict:
                  type: string
                  enum:
                    - passed
                    - failed
                    - inconclusive
              required:
                - state
              additionalProperties: false
            version:
              type: integer
              minimum: 0
              exclusiveMinimum: true
              maximum: 9007199254740991
            createdAtMs:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            updatedAtMs:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            startedAtMs:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            finishedAtMs:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            cancelRequestedAtMs:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            error:
              type: object
              properties:
                code:
                  type: string
                message:
                  type: string
              required:
                - code
                - message
              additionalProperties: false
            result:
              type: object
              additionalProperties: {}
            artifact:
              type: object
              properties:
                bytes:
                  type: integer
                  minimum: 0
                  exclusiveMinimum: true
                  maximum: 9007199254740991
                sha256:
                  type: string
                  pattern: ^[0-9a-f]{64}$
                mediaType:
                  type: string
                  enum:
                    - application/gzip
                expiresAtMs:
                  type: integer
                  minimum: -9007199254740991
                  maximum: 9007199254740991
              required:
                - bytes
                - sha256
                - mediaType
              additionalProperties: false
          required:
            - schemaVersion
            - runId
            - organizationId
            - projectId
            - definition
            - mode
            - interactive
            - state
            - worldVerified
            - version
            - createdAtMs
            - updatedAtMs
          additionalProperties: false
        replayed:
          type: boolean
      required:
        - run
        - replayed
      additionalProperties: false
    ErrorEnvelope:
      type: object
      properties:
        code:
          type: string
          pattern: ^(control|world)\.[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$
        message:
          type: string
          minLength: 1
        correlationId:
          type: string
          minLength: 1
        retryable:
          type: boolean
        retryAfterMs:
          type: integer
          exclusiveMinimum: 0
          maximum: 9007199254740991
        operationId:
          type: string
        source:
          type: string
          enum:
            - platform
            - simulated_provider
        issues:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              code:
                type: string
              message:
                type: string
            required:
              - path
              - code
              - message
            additionalProperties: false
        details:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        evidence:
          type: object
          properties:
            sessionId:
              type: string
            runId:
              type: string
            journalSeq:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            buildHash:
              type: string
          additionalProperties: false
      required:
        - code
        - message
        - correlationId
        - retryable
        - source
      additionalProperties: true
  securitySchemes:
    controlCredential:
      type: http
      scheme: bearer
      description: Opaque control credential

````