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

# Exec In Org Sandbox

> Run a command in a sandbox and wait for it to end. Return its exit code and output.

A machine attaches to run it and lets go soon after. A command that outlives its
`timeout` is ended, with an exit code of -1. Each stream answers with its last MiB.



## OpenAPI

````yaml https://api.getfloo.com/openapi.json post /v1/orgs/sandboxes/{sandbox_id}/exec
openapi: 3.1.0
info:
  title: floo API
  version: 0.1.0
servers:
  - url: https://api.getfloo.com
security: []
paths:
  /v1/orgs/sandboxes/{sandbox_id}/exec:
    post:
      tags:
        - sandboxes
      summary: Exec In Org Sandbox
      description: >-
        Run a command in a sandbox and wait for it to end. Return its exit code
        and output.


        A machine attaches to run it and lets go soon after. A command that
        outlives its

        `timeout` is ended, with an exit code of -1. Each stream answers with
        its last MiB.
      operationId: sandboxes_exec_in_org_sandbox
      parameters:
        - name: sandbox_id
          in: path
          required: true
          schema:
            type: string
            title: Sandbox Id
        - $ref: '#/components/parameters/X-Floo-Org-Id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecResult'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  parameters:
    X-Floo-Org-Id:
      name: X-Floo-Org-Id
      in: header
      required: false
      schema:
        type: string
        format: uuid
      description: Organization to act in; defaults to the one joined most recently.
  schemas:
    ExecRequest:
      properties:
        command:
          items:
            type: string
          type: array
          minItems: 1
          title: Command
          description: The program and its arguments, as ["pytest", "-q"].
        workdir:
          anyOf:
            - type: string
            - type: 'null'
          title: Workdir
          description: The directory it runs in.
        env:
          additionalProperties:
            type: string
          type: object
          title: Env
          description: Variables it runs with.
        timeout:
          type: integer
          maximum: 1500
          minimum: 1
          title: Timeout
          description: >-
            Seconds it may run before it is ended. Default 5 minutes, at most
            25.
          default: 300
      type: object
      required:
        - command
      title: ExecRequest
      description: A command to run in a sandbox.
    ExecResult:
      properties:
        exit_code:
          type: integer
          title: Exit Code
        stdout:
          type: string
          title: Stdout
        stderr:
          type: string
          title: Stderr
        timed_out:
          type: boolean
          title: Timed Out
        truncated:
          type: boolean
          title: Truncated
      type: object
      required:
        - exit_code
        - stdout
        - stderr
        - timed_out
        - truncated
      title: ExecResult
      description: How a command ended, and what it printed.
    ErrorResponse:
      properties:
        detail:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Body of every error response except request validation (422).
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
      additionalProperties: true
      type: object
      required:
        - code
        - message
      title: ErrorDetail
      description: Standard error envelope with operation-specific JSON context.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A `floo_` API key.

````

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