> ## 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.

# List replayable sandbox events

> Returns curated durable conversation events after the supplied sequence cursor. Use this endpoint to recover gaps before resuming the live stream.



## OpenAPI

````yaml /openapi.json get /api/public/v1/sandboxes/{sandboxId}/events
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:
    get:
      tags:
        - sandbox events
      summary: List replayable sandbox events
      description: >-
        Returns curated durable conversation events after the supplied sequence
        cursor. Use this endpoint to recover gaps before resuming the live
        stream.
      operationId: listSandboxEvents
      parameters:
        - in: path
          name: sandboxId
          schema:
            type: string
            pattern: ^c_[a-z2-9]{12}$
          required: true
        - in: query
          name: after
          schema:
            default: 0
            type: integer
            minimum: 0
            maximum: 9007199254740991
        - in: query
          name: limit
          schema:
            default: 100
            type: integer
            minimum: 1
            maximum: 100
      responses:
        '200':
          description: Sandbox events after the supplied cursor
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      oneOf:
                        - type: object
                          properties:
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: snapshot
                            data:
                              type: object
                              properties:
                                sandbox:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                      pattern: ^c_[a-z2-9]{12}$
                                    worktreeId:
                                      readOnly: true
                                      type: string
                                      minLength: 1
                                    object:
                                      type: string
                                      const: sandbox
                                    status:
                                      type: string
                                      enum:
                                        - queued
                                        - creating
                                        - running
                                        - succeeded
                                        - failed
                                        - terminating
                                        - terminated
                                    title:
                                      type: string
                                    repos:
                                      type: array
                                      items:
                                        type: object
                                        properties:
                                          fullName:
                                            type: string
                                            maxLength: 201
                                            pattern: ^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$
                                          ref:
                                            type: string
                                            minLength: 1
                                            maxLength: 255
                                        required:
                                          - fullName
                                        additionalProperties: false
                                    model:
                                      type:
                                        - string
                                        - 'null'
                                    agentRuntime:
                                      type: string
                                      enum:
                                        - opencode
                                        - codex
                                        - claude
                                        - grok
                                    turn:
                                      type: object
                                      properties:
                                        active:
                                          type: boolean
                                      required:
                                        - active
                                      additionalProperties: false
                                    usage:
                                      type: object
                                      properties:
                                        llmRequestCount:
                                          type: integer
                                          minimum: 0
                                          maximum: 9007199254740991
                                        costMicroUsd:
                                          type: integer
                                          minimum: 0
                                          maximum: 9007199254740991
                                        creditsChargedMicros:
                                          type: integer
                                          minimum: 0
                                          maximum: 9007199254740991
                                      required:
                                        - llmRequestCount
                                        - costMicroUsd
                                        - creditsChargedMicros
                                      additionalProperties: false
                                    metadata:
                                      type: object
                                      propertyNames:
                                        type: string
                                      additionalProperties:
                                        type: string
                                    error:
                                      type:
                                        - string
                                        - 'null'
                                    createdAt:
                                      type: string
                                    startedAt:
                                      type:
                                        - string
                                        - 'null'
                                    completedAt:
                                      type:
                                        - string
                                        - 'null'
                                    links:
                                      type: object
                                      properties:
                                        self:
                                          type: string
                                          format: uri
                                        events:
                                          type: string
                                          format: uri
                                        messages:
                                          type: string
                                          format: uri
                                      required:
                                        - self
                                        - events
                                        - messages
                                      additionalProperties: false
                                  required:
                                    - id
                                    - worktreeId
                                    - object
                                    - status
                                    - title
                                    - repos
                                    - model
                                    - agentRuntime
                                    - turn
                                    - usage
                                    - metadata
                                    - error
                                    - createdAt
                                    - startedAt
                                    - completedAt
                                    - links
                                  additionalProperties: false
                                turn:
                                  anyOf:
                                    - type: object
                                      properties:
                                        id:
                                          type: string
                                        state:
                                          type: string
                                          enum:
                                            - pending
                                            - running
                                            - succeeded
                                            - failed
                                            - canceled
                                      required:
                                        - id
                                        - state
                                      additionalProperties: false
                                    - type: 'null'
                                resume_cursor:
                                  type: string
                                  pattern: ^\d+$
                              required:
                                - sandbox
                                - turn
                                - resume_cursor
                              additionalProperties: false
                          required:
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: sandbox.status
                            data:
                              type: object
                              properties:
                                status:
                                  type: string
                                  enum:
                                    - queued
                                    - creating
                                    - running
                                    - succeeded
                                    - failed
                                    - terminating
                                    - terminated
                              required:
                                - status
                              additionalProperties: false
                          required:
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: turn.started
                            data:
                              type: object
                              properties:
                                prompt_id:
                                  type: string
                                text:
                                  type: string
                                files:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      filename:
                                        type: string
                                      mime:
                                        type: string
                                    additionalProperties: false
                                author:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                    name:
                                      type: string
                                  additionalProperties: false
                              required:
                                - prompt_id
                                - text
                                - files
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: turn.completed
                            data:
                              type: object
                              properties:
                                state:
                                  type: string
                                  enum:
                                    - succeeded
                                    - failed
                                    - canceled
                                error:
                                  type: string
                              required:
                                - state
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: message.updated
                            data:
                              type: object
                              properties:
                                part_id:
                                  type: string
                                message_id:
                                  type: string
                                kind:
                                  type: string
                                  enum:
                                    - text
                                    - reasoning
                                text:
                                  type: string
                              required:
                                - part_id
                                - message_id
                                - kind
                                - text
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: message.completed
                            data:
                              type: object
                              properties:
                                message_id:
                                  type: string
                                finish:
                                  type: string
                                error:
                                  type: string
                              required:
                                - message_id
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: tool.updated
                            data:
                              type: object
                              properties:
                                part_id:
                                  type: string
                                message_id:
                                  type: string
                                call_id:
                                  type: string
                                tool:
                                  type: string
                                status:
                                  type: string
                                  enum:
                                    - pending
                                    - running
                                    - completed
                                    - error
                                    - stopped
                                error:
                                  type: string
                              required:
                                - part_id
                                - message_id
                                - call_id
                                - tool
                                - status
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: approval.requested
                            data:
                              type: object
                              properties:
                                approval_id:
                                  type: string
                                tool:
                                  type: string
                              required:
                                - approval_id
                                - tool
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: approval.resolved
                            data:
                              type: object
                              properties:
                                approval_id:
                                  type: string
                                outcome:
                                  type: string
                                  enum:
                                    - approved
                                    - denied
                                    - canceled
                                    - failed
                              required:
                                - approval_id
                                - outcome
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                        - type: object
                          properties:
                            id:
                              type: string
                              pattern: ^\d+$
                            object:
                              type: string
                              const: sandbox.event
                            version:
                              type: string
                              const: v1
                            ts:
                              type: string
                            sandbox_id:
                              type: string
                            turn_id:
                              type: string
                            type:
                              type: string
                              const: sandbox.error
                            data:
                              type: object
                              properties:
                                code:
                                  type: string
                                message:
                                  type: string
                              required:
                                - message
                              additionalProperties: false
                          required:
                            - id
                            - object
                            - version
                            - ts
                            - sandbox_id
                            - type
                            - data
                          additionalProperties: false
                      type: object
                  nextCursor:
                    type: string
                    pattern: ^\d+$
                required:
                  - data
                  - nextCursor
                additionalProperties: false
        '400':
          description: The event cursor or limit 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.

````