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

# Run a command to its exit, or start it detached



## OpenAPI

````yaml /openapi.json post /sandboxes/{id}/commands
openapi: 3.1.0
info:
  title: Styne sandbox API
  version: 0.1.0
  description: >-
    Isolated Linux sandboxes for AI agents: create from a template, run
    commands, files, fork, snapshots, pause and resume. The wire contract is the
    E2B API, so an unmodified E2B SDK works.
servers:
  - url: https://api.styne.ai
security:
  - bearerAuth: []
tags:
  - name: Sandboxes
    externalDocs:
      url: https://docs.styne.ai/quickstart
  - name: Templates
    externalDocs:
      url: https://docs.styne.ai/guide-templates
  - name: Run commands
    externalDocs:
      url: https://docs.styne.ai/exec
  - name: Files
    externalDocs:
      url: https://docs.styne.ai/files
  - name: Fork
    externalDocs:
      url: https://docs.styne.ai/fork
  - name: Snapshots
    externalDocs:
      url: https://docs.styne.ai/snapshots
  - name: Volumes
    externalDocs:
      url: https://docs.styne.ai/volumes
  - name: Logs and metrics
    externalDocs:
      url: https://docs.styne.ai/observability
  - name: Timeouts, pause and resume
    externalDocs:
      url: https://docs.styne.ai/pause-tiers
  - name: Plans and billing
    externalDocs:
      url: https://docs.styne.ai/billing
  - name: Agent sign-up
    externalDocs:
      url: https://docs.styne.ai/agent-signup
  - name: Browsers
    externalDocs:
      url: https://docs.styne.ai/browsers
  - name: Browser profiles
    externalDocs:
      url: https://docs.styne.ai/profiles
  - name: Login vault
    externalDocs:
      url: https://docs.styne.ai/vault
  - name: Ports and preview URLs
    externalDocs:
      url: https://docs.styne.ai/ports
  - name: SSH and port forwarding
    externalDocs:
      url: https://docs.styne.ai/ssh
  - name: CI runners
    externalDocs:
      url: https://docs.styne.ai/ci
  - name: Run a coding agent in a sandbox
    externalDocs:
      url: https://docs.styne.ai/agents
  - name: State store
    externalDocs:
      url: https://docs.styne.ai/state
  - name: Calls between sandboxes
    externalDocs:
      url: https://docs.styne.ai/calls
  - name: Wake triggers and schedules
    externalDocs:
      url: https://docs.styne.ai/wake-triggers
  - name: Checkpoints and rewind
    externalDocs:
      url: https://docs.styne.ai/checkpoints
  - name: Container images
    externalDocs:
      url: https://docs.styne.ai/images
paths:
  /sandboxes/{id}/commands:
    post:
      tags:
        - Run commands
      summary: Run a command to its exit, or start it detached
      operationId: commands.start
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                Start a command and return its pid at once; read it with the
                command calls. Same fields as exec, plus detached.
              properties:
                cmd:
                  type: string
                  description: The command line.
                args:
                  type: array
                  items:
                    type: string
                  description: Arguments appended to cmd.
                argv:
                  type: array
                  items:
                    type: string
                  description: The command as an argument vector, run without a shell.
                shell:
                  type: string
                  description: Shell used for cmd; /bin/sh when left out.
                envs:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Environment variables for this command (also accepted as env
                    or envVars).
                cwd:
                  type: string
                  description: Working directory.
                user:
                  type: string
                  description: User to run as.
                timeoutMs:
                  type: integer
                  description: Milliseconds before the command is stopped.
                stdin:
                  type: boolean
                  description: Keep standard input open for later input calls.
                pty:
                  description: Run on a pseudo-terminal of this size ({rows, cols}).
      responses:
        2XX:
          description: Success. The answer is described on https://docs.styne.ai/exec.
        default:
          description: An error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      externalDocs:
        description: Run commands
        url: https://docs.styne.ai/exec
components:
  schemas:
    Error:
      type: object
      description: >-
        Every error answer has this shape; the codes are listed on the errors
        page.
      properties:
        code:
          type: integer
          description: The HTTP status.
        error_code:
          type: string
          description: A stable machine-readable code, for example free_tier_limit.
        message:
          type: string
          description: What happened and what to do, in plain words.
        origin:
          type: string
          description: >-
            Where the fault came from, for example client, customer_limit or
            infrastructure.
        request_id:
          type: string
          description: Quote it to support; the same value is in the x-request-id header.
      required:
        - code
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your Styne API key: Authorization: Bearer $STYNE_API_KEY.'

````

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