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

# Force stop a task

> Use this endpoint to stop to an active task session.



## OpenAPI

````yaml POST /tasks/{session_id}/command
openapi: 3.0.3
info:
  title: BrowserAI Task API
  version: 1.0.0
  description: API for creating and retrieving browser automation tasks and their results.
servers:
  - url: https://browser.ai/api/v1
security: []
paths:
  /tasks/{session_id}/command:
    post:
      tags:
        - Task
      summary: Stop a running task any time.
      description: Use this endpoint to stop to an active task session.
      parameters:
        - name: session_id
          in: path
          required: true
          description: Insert your task’s `session ID` located in your Projects dashboard.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                command:
                  type: string
                  enum:
                    - stop
                  description: >-
                    The command to send to the task. Currently only 'stop' is
                    supported.
              required:
                - command
      responses:
        '200':
          description: Command accepted and processed
          content:
            application/json:
              example:
                message: Task stopped successfully
        '400':
          description: Invalid command or task ID
          content:
            application/json:
              example:
                error: Invalid command or task ID
        '401':
          description: Unauthorized
          content:
            application/json:
              example:
                error: Unauthorized
        '404':
          description: Task not found
          content:
            application/json:
              example:
                error: Task not found
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                error: Internal server error
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Insert API token, use the format: `apikey <API-TOKEN>`.'

````