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

# Read a sandbox file

> Returns read-only working-tree and comparison versions. Protected files such as .env and opencode.json are never accessible.



## OpenAPI

````yaml /openapi.json get /api/public/v1/sandboxes/{sandboxId}/files/content
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}/files/content:
    get:
      tags:
        - sandbox files
      summary: Read a sandbox file
      description: >-
        Returns read-only working-tree and comparison versions. Protected files
        such as .env and opencode.json are never accessible.
      operationId: getSandboxFile
      parameters:
        - in: path
          name: sandboxId
          schema:
            type: string
            pattern: ^c_[a-z2-9]{12}$
          required: true
        - in: query
          name: path
          schema:
            type: string
            minLength: 1
            maxLength: 1000
          required: true
        - in: query
          name: repo
          schema:
            type: string
            maxLength: 201
            pattern: ^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$
      responses:
        '200':
          description: The requested read-only file document
          content:
            application/json:
              schema:
                type: object
                properties:
                  base:
                    anyOf:
                      - type: object
                        properties:
                          content:
                            type:
                              - string
                              - 'null'
                          hash:
                            type:
                              - string
                              - 'null'
                          ref:
                            type:
                              - string
                              - 'null'
                        required:
                          - content
                          - hash
                          - ref
                        additionalProperties: false
                      - type: 'null'
                  binary:
                    type: boolean
                  editable:
                    type: boolean
                    const: false
                  editReason:
                    type:
                      - string
                      - 'null'
                  head:
                    anyOf:
                      - type: object
                        properties:
                          content:
                            type:
                              - string
                              - 'null'
                          hash:
                            type:
                              - string
                              - 'null'
                          ref:
                            type:
                              - string
                              - 'null'
                        required:
                          - content
                          - hash
                          - ref
                        additionalProperties: false
                      - type: 'null'
                  path:
                    type: string
                  previousPath:
                    type:
                      - string
                      - 'null'
                  reviewHead:
                    anyOf:
                      - type: object
                        properties:
                          content:
                            type:
                              - string
                              - 'null'
                          hash:
                            type:
                              - string
                              - 'null'
                          ref:
                            type:
                              - string
                              - 'null'
                        required:
                          - content
                          - hash
                          - ref
                        additionalProperties: false
                      - type: 'null'
                  size:
                    anyOf:
                      - type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      - type: 'null'
                  status:
                    anyOf:
                      - type: string
                        enum:
                          - added
                          - deleted
                          - modified
                          - renamed
                          - untracked
                      - type: 'null'
                  working:
                    anyOf:
                      - type: object
                        properties:
                          content:
                            type:
                              - string
                              - 'null'
                          hash:
                            type:
                              - string
                              - 'null'
                          ref:
                            type:
                              - string
                              - 'null'
                        required:
                          - content
                          - hash
                          - ref
                        additionalProperties: false
                      - type: 'null'
                required:
                  - base
                  - binary
                  - editable
                  - editReason
                  - head
                  - path
                  - previousPath
                  - reviewHead
                  - size
                  - status
                  - working
                additionalProperties: false
        '400':
          description: The file path or repository selector 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, repository, or file not found
          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
        '409':
          description: Sandbox files are not available yet
          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
        '413':
          description: The requested file operation exceeded its size limit
          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
        '422':
          description: The repository helper rejected the request
          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.

````