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

# Cancel Run

> Cancel an in-flight run.

Idempotent: a run already in a terminal state (completed / failed /
cancelled) is returned as-is. Once cancelled, the gateway refuses
every subsequent `chat_completions` call from the worker — so the
project cannot be billed further regardless of whether the worker
subprocess notices the cancel itself.

The worker keeps running for at most one more bcode step
(consuming no LLM tokens because CP 409s them) and then exits when
bcode realizes the next tool call has no model behind it.



## OpenAPI

````yaml /cloud/openapi/v4.json post /runs/{run_id}/cancel
openapi: 3.1.0
info:
  title: Browser Use Public API v4
  summary: Browser Use agent runs API (v4)
  version: 4.0.0
servers:
  - url: https://api.browser-use.com/api/v4
    description: Production server
security: []
tags:
  - name: Runs
  - name: Sessions
  - name: Workspaces
  - name: Browsers
  - name: Profiles
paths:
  /runs/{run_id}/cancel:
    post:
      tags:
        - Runs
      summary: Cancel Run
      description: |-
        Cancel an in-flight run.

        Idempotent: a run already in a terminal state (completed / failed /
        cancelled) is returned as-is. Once cancelled, the gateway refuses
        every subsequent `chat_completions` call from the worker — so the
        project cannot be billed further regardless of whether the worker
        subprocess notices the cancel itself.

        The worker keeps running for at most one more bcode step
        (consuming no LLM tokens because CP 409s them) and then exits when
        bcode realizes the next tool call has no model behind it.
      operationId: cancel_run_runs__run_id__cancel_post
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Run Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunSummary'
        '403':
          description: Zero Data Retention is enabled on the project (V4 unsupported).
        '404':
          description: Run, session, workspace, or profile not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '502':
          description: The request could not be forwarded to the control plane.
      security:
        - APIKeyHeader: []
components:
  schemas:
    RunSummary:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        task:
          type: string
          title: Task
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        model:
          type: string
          title: Model
        contextLimit:
          type: integer
          title: Contextlimit
        status:
          type: string
          enum:
            - queued
            - dispatching
            - running
            - completed
            - failed
            - cancelled
          title: Status
        result:
          anyOf:
            - type: string
            - type: 'null'
          title: Result
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        sessionId:
          type: string
          format: uuid
          title: Sessionid
        workspaceId:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Workspaceid
        attachedFileIds:
          anyOf:
            - items:
                type: string
                format: uuid
              type: array
            - type: 'null'
          title: Attachedfileids
        judgement:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Judgement
        totalInputTokens:
          type: integer
          title: Totalinputtokens
        totalOutputTokens:
          type: integer
          title: Totaloutputtokens
        totalCostUsd:
          type: string
          title: Totalcostusd
        createdAt:
          type: string
          format: date-time
          title: Createdat
        updatedAt:
          type: string
          format: date-time
          title: Updatedat
      type: object
      required:
        - id
        - task
        - title
        - model
        - contextLimit
        - status
        - result
        - error
        - sessionId
        - workspaceId
        - totalInputTokens
        - totalOutputTokens
        - totalCostUsd
        - createdAt
        - updatedAt
      title: RunSummary
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-Browser-Use-API-Key

````