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

# Stop a detached command

> Stop a command started with detached: true, and every process it started. The response holds its final history record.



## OpenAPI

````yaml openapi/boat-v1.yaml DELETE /sandboxes/{sandboxId}/commands/{processId}
openapi: 3.1.0
info:
  title: Boat Public API v1
  version: 1.0.0
  description: >
    Public JSON API for creating, operating, prompting, observing, and exposing
    sandboxes from backend services, CI jobs, hosted workers, and Boat
    automation products.


    The v1 reference intentionally documents the developer integration surface
    only. Dashboard billing actions are not part of v1.
servers:
  - url: https://boat.dev/api/v1
security:
  - BoatBearerAuth: []
tags:
  - name: Boat
    description: >-
      Unified Boat account, setup, lifecycle, prompting, event history, desktop
      access, and SSH operations.
paths:
  /sandboxes/{sandboxId}/commands/{processId}:
    delete:
      tags:
        - Boat
      summary: Stop a detached command
      description: >-
        Sends SIGTERM to the command and every process it started, then SIGKILL
        to what is left after 5 s. Only a process started with `detached` can be
        stopped. The response carries the command's history record with its
        final state and output.
      operationId: stopCommand
      parameters:
        - $ref: '#/components/parameters/SandboxId'
        - $ref: '#/components/parameters/ProcessId'
      responses:
        '200':
          description: The command is stopped.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandStopResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  parameters:
    SandboxId:
      name: sandboxId
      in: path
      required: true
      schema:
        type: string
        pattern: ^bx_[23456789abcdefghjkmnpqrstuvwxyz]{8}$
      description: Public Sandbox id returned by create/list/get sandbox calls.
    ProcessId:
      name: processId
      in: path
      required: true
      schema:
        type: integer
        minimum: 1
      description: Process id returned by a detached command start.
  schemas:
    CommandStopResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessBase'
        - type: object
          required:
            - processId
            - running
            - signaled
            - command
          properties:
            type:
              type: string
              const: command.stopped
            processId:
              type: integer
            running:
              type: boolean
              description: Always false after a stop.
            signaled:
              type: boolean
              description: False when the process had already ended.
            command:
              oneOf:
                - $ref: '#/components/schemas/CommandRecord'
                - type: 'null'
              description: The history record of the command, with its final state.
    SuccessBase:
      type: object
      required:
        - ok
        - type
      properties:
        ok:
          type: boolean
          examples:
            - true
        type:
          type: string
          description: Stable success envelope discriminator added by v1.
    CommandRecord:
      type: object
      description: >-
        One command run through the commands endpoint (kept 90 days), or one
        process of the sandbox with mode `process` (kept 72 hours). Readable
        while the sandbox is stopped.
      required:
        - commandId
        - sandboxId
        - command
        - mode
        - status
        - stdoutBytes
        - stderrBytes
        - outputTruncated
        - startedAt
      properties:
        commandId:
          type: string
          examples:
            - cmd_k3v9x2mq7tbw
          description: Id of the record in the command history.
        sandboxId:
          type: string
        command:
          type: string
          description: The command text as sent (first 64 KiB).
        cwd:
          type:
            - string
            - 'null'
        mode:
          type: string
          enum:
            - sync
            - stream
            - detached
            - process
          description: >-
            sync: the request waited for the result. stream: the output was
            streamed. detached: started in the background. process: any other
            process of the sandbox, recorded from what it wrote to its
            stdout/stderr.
        processId:
          type:
            - integer
            - 'null'
          description: 'detached: the process id on the sandbox.'
        status:
          type: string
          enum:
            - running
            - exited
            - timed_out
            - failed
            - killed
            - lost
          description: >-
            failed: the command could not start or its result never arrived.
            killed: ended by a signal or by DELETE /commands/{processId}. lost:
            the sandbox stopped or its agent restarted while the command ran.
        exitCode:
          type:
            - integer
            - 'null'
        signal:
          type:
            - string
            - 'null'
        stdoutBytes:
          type: integer
          description: Bytes of stdout written so far.
        stderrBytes:
          type: integer
          description: Bytes of stderr written so far.
        outputTruncated:
          type: boolean
          description: >-
            True when part of the output is not kept: the sandbox cut the output
            of a waiting command at 8 MiB, or the account wrote more than 10 MiB
            (compressed) of command output, or of process output, in one hour.
        startedAt:
          type: string
          format: date-time
        finishedAt:
          type:
            - string
            - 'null'
          format: date-time
    ErrorEnvelope:
      type: object
      required:
        - ok
        - type
        - status
        - code
        - message
        - error
        - requestId
      properties:
        ok:
          type: boolean
          examples:
            - false
        type:
          type: string
          examples:
            - sandbox.error
        status:
          type: integer
          examples:
            - 409
        code:
          type: string
          examples:
            - provider_not_configured
        message:
          type: string
          examples:
            - Prompting is locked until Codex is configured on the Agents page.
        requestId:
          type: string
          examples:
            - req_01HX...
        error:
          type: object
          required:
            - code
            - message
            - status
          properties:
            code:
              type: string
            message:
              type: string
            status:
              type: integer
            details:
              type: object
              additionalProperties: true
  responses:
    BadRequest:
      description: Invalid request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            invalid:
              value:
                ok: false
                type: sandbox.error
                status: 400
                code: invalid_json
                message: Request body must be valid JSON.
                error:
                  code: invalid_json
                  message: Request body must be valid JSON.
                  status: 400
                requestId: req_01HX...
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            unauthorized:
              value:
                ok: false
                type: sandbox.error
                status: 401
                code: unauthorized
                message: Unauthorized
                error:
                  code: unauthorized
                  message: Unauthorized
                  status: 401
                requestId: req_01HX...
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Conflict:
      description: Request conflicts with current account or sandbox state.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    BoatBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sandbox_api_key
      description: >-
        Boat bearer token in the form `boat_...`. Service API keys authenticate
        sandbox operations.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.