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

# Files

> Move files in and out of a sandbox

```bash CLI theme={null}
# Push local files into the sandbox
prime sandbox upload sbx_123 notebooks/analysis.ipynb /workspace/

# Pull results back
prime sandbox download sbx_123 /workspace/report.csv reports/latest.csv
```

```python Python theme={null}
client.upload_file(sandbox.id, "/workspace/model.bin", "./artifacts/model.bin")
client.download_file(sandbox.id, "/workspace/report.csv", "./reports/report.csv")

# Read small files directly
contents = client.read_file(sandbox.id, "/workspace/report.csv")
print(contents.content[:80])
```

* Uploads have no fixed size limit; they are bounded by free disk space in the sandbox. They overwrite existing files and create missing parent directories. The SDK reads the whole local file into memory and times out after 300 seconds by default, so pass a larger `timeout` for big files on slow connections.
* `read_file` is capped at **10 MiB** and raises `SandboxFileTooLargeError` past it; use `download_file` for large files.
* Transfers and commands use gateway tokens that expire 30 minutes after they are issued. The CLI and SDK cache them and fetch a new one before expiry; if you call the gateway directly, request a new token with `POST /api/v1/sandbox/{sandbox_id}/auth` before `expires_at`.
* A token is checked only when a request starts. Transfers and command streams already in progress keep running past the token's expiry, and fetching a new token does not interrupt them; only new requests need a valid token.
* If you rotate credentials or hit 401s, run `prime sandbox reset-cache` (CLI) or `client.clear_auth_cache()` (SDK).


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