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

# Stream sandbox events

> Opens a fetch-based Server-Sent Events stream across sandbox boot, turns, and completion. Durable frames carry an event id; reconnect with Last-Event-ID or since. Fresh connections receive a transient snapshot before the live tail.



## OpenAPI

````yaml /openapi.json get /api/public/v1/sandboxes/{sandboxId}/events/stream
openapi: 3.1.0
info:
  title: Sparkles Sandbox API
  version: 1.0.0
  description: Create coding sandboxes, stream their work, and control their lifecycle.
servers:
  - url: https://sparkles.dev
security: []
paths:
  /api/public/v1/sandboxes/{sandboxId}/events/stream:
    get:
      tags:
        - sandbox events
      summary: Stream sandbox events
      description: >-
        Opens a fetch-based Server-Sent Events stream across sandbox boot,
        turns, and completion. Durable frames carry an event id; reconnect with
        Last-Event-ID or since. Fresh connections receive a transient snapshot
        before the live tail.
      operationId: streamSandboxEvents
      parameters:
        - in: path
          name: sandboxId
          schema:
            type: string
            pattern: ^c_[a-z2-9]{12}$
          required: true
        - in: query
          name: since
          schema:
            type: integer
            minimum: 0
            maximum: 9007199254740991
        - in: header
          name: Last-Event-ID
          schema:
            type: string
            pattern: ^\d+$
      responses:
        '200':
          description: A Server-Sent Events stream of curated sandbox event envelopes
          content:
            text/event-stream:
              schema:
                type: string
                description: SSE frames whose data field is a JSON sandbox.event envelope
        '400':
          description: The Last-Event-ID or since cursor failed validation
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '401':
          description: Missing, malformed, revoked, or otherwise invalid API key
          headers:
            WWW-Authenticate:
              required: true
              description: Bearer authentication challenge for the Sparkles Sandbox API
              schema:
                type: string
                description: Bearer authentication challenge for the Sparkles Sandbox API
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '403':
          description: >-
            The API key lacks the sandboxes scope or its user is no longer an
            active organization member
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '404':
          description: Sandbox not found for this API access grant
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '429':
          description: The API key exceeded its distributed per-minute request limit
          headers:
            Retry-After:
              required: true
              description: Seconds until another request may be made
              schema:
                type: string
                pattern: ^\d+$
                description: Seconds until another request may be made
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '500':
          description: The request could not be completed because of an internal error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: spk_live_…
      description: >-
        Long-lived opaque API key minted by an approved user at /api. The secret
        is shown once, stored only as a SHA-256 digest, and disabled immediately
        when either the key or its API access grant is revoked.

````