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

# Stream a sandbox command's output (SSE)

> Stream a command's output as server-sent events. GET /sandboxes/{id}/commands/{commandId}/output in the Ravion API reference.



## OpenAPI

````yaml https://api.ravion.com/openapi.yaml get /sandboxes/{id}/commands/{commandId}/output
openapi: 3.0.0
info:
  title: Ravion
  version: 0.0.0
servers:
  - url: https://api.ravion.com
security:
  - BearerAuth: []
tags:
  - name: Projects
  - name: Environments
  - name: FeatureFlags
  - name: Pipelines
  - name: PipelineRuns
  - name: TerraformResources
  - name: TerraformExecutionSummaries
  - name: PipelineStepExecutions
  - name: AwsCloudWatch
  - name: AwsAmp
  - name: PipelineVersions
  - name: Organizations
  - name: Stacks
  - name: StackWorkspaces
  - name: Auth
  - name: OAuth
  - name: User
  - name: Health
  - name: Memberships
  - name: ServiceAccounts
  - name: Integrations
  - name: AwsDefaultNetworks
  - name: AwsAccounts
  - name: ApiKeys
  - name: EksPrometheus
  - name: EksLoki
  - name: ExecutionEnvironments
  - name: ModuleDefinitions
  - name: ModuleCategories
  - name: ModuleVersions
  - name: ModuleInstances
  - name: DefaultValueDefinitions
  - name: DefaultValues
  - name: CodeSources
  - name: Github
  - name: GitHub Actions
  - name: Alerts
  - name: Gitlab
  - name: Slack
  - name: Git
  - name: MergeQueues
  - name: Values
  - name: Deployments
  - name: DeploymentResources
  - name: InfrastructureEvents
  - name: WebSocket
  - name: Domains
  - name: AcmCertificates
  - name: NotificationDestinations
  - name: NotificationDispatches
  - name: NotificationEvents
  - name: NotificationRules
  - name: Activity
  - name: Describe
  - name: Reports
  - name: BillingPlans
  - name: BillingAccounts
  - name: BillingCycles
  - name: BillingUsageSummaries
  - name: BillingAddOns
  - name: BillingInvoices
  - name: Authorization
  - name: Sandboxes
  - name: SandboxCommands
  - name: SandboxPorts
  - name: Apps
paths:
  /sandboxes/{id}/commands/{commandId}/output:
    get:
      tags:
        - SandboxCommands
      summary: Stream a sandbox command's output (SSE)
      description: >-
        Stream a command's output as server-sent events. Each event's `data` is
        a JSON `SandboxCommandOutputEvent` whose `type` is `stdout`, `stderr`,
        `truncated` or `exit`, and each event's `id` is its `seq`. The stream
        replays output from the start, or from after `afterSeq` or the
        `Last-Event-ID` header, then follows the command live and closes after
        the `exit` event. A comment line is sent every 15 seconds while the
        command is quiet.
      operationId: StreamSandboxCommandOutput
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
        - in: path
          name: commandId
          required: true
          schema:
            type: string
        - description: >-
            Resume after this `seq`: events up to and including it are not
            replayed. Omitted, the stream starts from the first event the
            sandbox still holds. The `Last-Event-ID` header does the same on an
            SSE reconnect.
          in: query
          name: afterSeq
          schema:
            format: int64
            minimum: 0
            nullable: true
            type: integer
      responses:
        '200':
          content:
            text/event-stream:
              schema:
                $ref: '#/components/schemas/SandboxCommandOutputEvent'
          description: SSE stream of a command's output events.
components:
  schemas:
    SandboxCommandOutputEvent:
      additionalProperties: false
      description: >-
        One event of a command's output stream. Every event is delivered as the
        SSE `data:` JSON

        with `type` telling it apart, and carries `seq` as the SSE `id:` so a
        dropped connection

        resumes where it left off.
      properties:
        data:
          description: >-
            The output chunk, base64 encoded. Set for `stdout` and `stderr`
            events.
          type: string
        exitCode:
          description: Exit code, on the `exit` event when the command exited on its own.
          format: int32
          type: integer
        seq:
          description: >-
            Position of the event in the command's output. Starts at 1 and
            increases by one per event; pass it back as `afterSeq` or
            `Last-Event-ID` to resume.
          format: int64
          type: integer
        signal:
          description: Signal that ended the command, on the `exit` event when one did.
          type: string
        type:
          allOf:
            - $ref: '#/components/schemas/Sandbox.OutputEventType'
          description: Which part of the output this event is.
      required:
        - type
        - seq
      type: object
    Sandbox.OutputEventType:
      description: >-
        Which part of a command's output an event carries. `stdout` and `stderr`
        carry a chunk of output. `exit` is the last event: the command ended.
        `truncated` means output before this event was dropped because the
        command produced more than the sandbox keeps.
      enum:
        - stdout
        - stderr
        - exit
        - truncated
      type: string
  securitySchemes:
    BearerAuth:
      scheme: Bearer
      type: http

````

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