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

# Fetch a file through its download URL

> Streams the file a download URL names. Use the URL exactly as minted; its query is signed. The response supports byte ranges, `If-Range`, and the `If-None-Match` and `If-Modified-Since` validators. A fetch wakes a sleeping Sailbox before the first byte.



## OpenAPI

````yaml /sailbox-openapi.json get /sailboxes/{sailbox_id}/files/download
openapi: 3.1.0
info:
  title: Sail Sailbox API
  version: '2026-09-07'
  description: >-
    Create and operate Sailboxes over HTTP. Sailboxes are fast-booting virtual
    machines that you can pause, resume, and checkpoint.


    Run commands, stream files, manage lifecycle and networking, and inspect
    usage. Turning on SSH and building an image still require an SDK or the CLI.
    See the [HTTP API guide](/sailboxes-http-api).
servers:
  - url: https://sailbox-api.sailresearch.com/v1
security:
  - BearerAuth: []
tags:
  - name: Apps
    description: Groups that own Sailboxes. One app per workload.
  - name: Lifecycle
    description: >-
      A Sailbox's whole life: create it, watch it, stop and start it, terminate
      it.
  - name: Checkpoints
    description: Save a Sailbox to start from later, and copy a running one.
  - name: Exec
    description: Run commands and control their standard input and terminals.
  - name: Files
    description: Stream regular files into and out of a Sailbox.
  - name: Networking
    description: >-
      Publish ports, serve them on hostnames you own, and identify a Sailbox to
      other Sailboxes.
  - name: Secrets
    description: >-
      Organization values that egress policy rules can add to matching requests.
      Sail never returns a stored value.
  - name: Egress policies
    description: >-
      What a Sailbox may connect to, and what happens to the HTTPS requests it
      sends.
  - name: Volumes
    description: >-
      Shared storage that outlives any one Sailbox. Alpha: these endpoints can
      still change.
  - name: SSH access
    description: Certificates for connecting to a Sailbox with `ssh`.
  - name: Usage
    description: Resource usage and spend.
  - name: Identity
    description: Who your API key belongs to.
paths:
  /sailboxes/{sailbox_id}/files/download:
    get:
      tags:
        - Files
      summary: Fetch a file through its download URL
      description: >-
        Streams the file a download URL names. Use the URL exactly as minted;
        its query is signed. The response supports byte ranges, `If-Range`, and
        the `If-None-Match` and `If-Modified-Since` validators. A fetch wakes a
        sleeping Sailbox before the first byte.
      operationId: fetchSailboxFileDownload
      parameters:
        - $ref: '#/components/parameters/SailboxId'
        - name: path
          in: query
          required: true
          schema:
            type: string
          description: The file the URL was minted for.
        - name: expires
          in: query
          required: true
          schema:
            type: integer
            format: int64
          description: When the URL stops working, as a Unix timestamp in seconds.
        - name: sig
          in: query
          required: true
          schema:
            type: string
          description: >-
            Signature over the other parameters. Editing any of them invalidates
            it.
        - name: disposition
          in: query
          required: false
          schema:
            type: string
            enum:
              - attachment
          description: Present when the URL was minted with `attachment`.
        - name: cache
          in: query
          required: false
          schema:
            type: string
            enum:
              - immutable
          description: Present when the URL was minted with `immutable`.
      responses:
        '200':
          description: >-
            The whole file. `Content-Type` comes from the file's extension,
            `Content-Length` is its size, `ETag` and `Last-Modified` are its
            validators, and `Accept-Ranges: bytes` is set.
          content:
            '*/*':
              schema:
                type: string
                format: binary
        '206':
          description: The requested byte range, with `Content-Range`.
          content:
            '*/*':
              schema:
                type: string
                format: binary
        '304':
          description: The file has not changed since the validator the request sent.
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          description: The signature is invalid or the URL has expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: download URL has expired
                  type: permission_error
                  param: null
                  code: null
        '404':
          description: The Sailbox is terminated or the file does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: >-
                    read sailbox file: open /workspace/render.png: no such file
                    or directory
                  type: not_found_error
                  param: null
                  code: null
        '409':
          description: >-
            The Sailbox is paused, or the path is a directory or another
            non-regular file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  message: >-
                    sailbox "sb_9c8f1e2a-3b4d-4f5a-8c7e-1d2f3a4b5c6d" is paused.
                    call resume() first
                  type: conflict_error
                  param: null
                  code: null
        '412':
          description: '`If-Match` or `If-Unmodified-Since` did not match the file.'
        '416':
          description: No part of the requested range lies inside the file.
        '503':
          $ref: '#/components/responses/Unavailable'
        '504':
          $ref: '#/components/responses/Timeout'
      security: []
components:
  parameters:
    SailboxId:
      name: sailbox_id
      in: path
      required: true
      schema:
        type: string
      description: >-
        Id of the Sailbox, as returned by create. It is `sb_` followed by a
        UUID.
  responses:
    BadRequest:
      description: The request was rejected. See the error message for the offending field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              message: memory_limit_gib for size m must be between 8 and 128
              type: invalid_request_error
              param: null
              code: null
    Unavailable:
      description: >-
        Sail is momentarily unavailable. Retry after the delay in the
        `Retry-After` header when one is present, and with backoff otherwise.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              message: Authentication service unavailable
              type: server_error
              param: null
              code: null
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
    Timeout:
      description: >-
        The operation outran its deadline, or a retry sent with the same
        `Idempotency-Key` waited about 30 seconds and the original request was
        still going. Retry with the same key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              message: idempotent request still in flight
              type: server_error
              param: null
              code: null
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ErrorObject:
      type: object
      required:
        - message
        - type
        - param
        - code
      properties:
        message:
          type: string
          description: Human-readable description of what went wrong.
        type:
          type: string
          description: >-
            Error category: `invalid_request_error`, `authentication_error`,
            `permission_error`, `billing_error`, `not_found_error`,
            `conflict_error`, `rate_limit_error`, `quota_exceeded_error`,
            `not_implemented_error`, or `server_error`.
        param:
          oneOf:
            - type: string
            - type: 'null'
          description: >-
            The request field the error refers to, when the error is about one
            field.
        code:
          oneOf:
            - type: string
            - type: integer
            - type: 'null'
          description: >-
            Stable short code for the error, when one applies. Errors relayed
            from the Sailbox runtime carry its status token, for example
            `already_exists` or `failed_precondition` on a 409, which the HTTP
            status alone does not distinguish.
        billing_url:
          type: string
          format: uri
          description: Page where you add credits. Sent with a 402.
      additionalProperties: true
  headers:
    RetryAfter:
      description: >-
        How many seconds to wait before retrying. On a 429 it also means the
        request never started, so the retry can reuse the same
        `Idempotency-Key`.
      schema:
        type: integer
        minimum: 0
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````