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

# Sandbox runtime API reference

> Read the API contract for file, process, and network operations inside a sandbox.

> [!NOTE]
>
> Sandboxes is in **Private Preview**. [Contact Baseten](mailto:support@baseten.co)
> to request access.

Use the runtime API to work with files, run processes, and inspect network
connections inside a sandbox. Send requests to the `url` returned when you
[create or get a sandbox](https://docs.baseten.co/sandboxes/manage.md).

To create, configure, or delete the sandbox itself, use the
[Management API](https://docs.baseten.co/reference/management-api/sandboxes/overview.md).

## Authentication

Send a [sandbox access token](https://docs.baseten.co/sandboxes/authentication.md) in the
`Authorization` header:

```http theme={"system"}
Authorization: Bearer <SANDBOX_TOKEN>
```

In the API playground, set `sandbox_host` to the hostname from your sandbox's
`url`, without `https://` or the trailing slash. Enter the sandbox access token
in the bearer token field.

## OpenAPI specification

[Download the OpenAPI specification](https://docs.baseten.co/reference/sandbox-api/openapi.json) to
inspect the API contract or use it with an API client. The reference pages use
this specification to display request fields and responses.

The hosted specification is a snapshot of the default sandbox image's runtime
API. A custom image can use a different sandbox API image.

Set `SANDBOX_URL` to your sandbox's returned `url` and `SANDBOX_TOKEN` to your
sandbox access token. To retrieve the specification served by your sandbox,
run the following command:

```bash theme={"system"}
curl --url "${SANDBOX_URL%/}/swagger/doc.json" \
  --header "Authorization: Bearer $SANDBOX_TOKEN"
```

The sandbox serves its specification in Swagger 2.0 format. The hosted
specification uses OpenAPI 3.0 for the documentation and API playground.

## Endpoints

| Method | Operation |
| - | - |
| `POST` | [Export the filesystem changes to a presigned URL](https://docs.baseten.co/reference/sandbox-api/archive/export-the-filesystem-changes-to-a-presigned-url.md) |
| `POST` | [Lift the archive freeze](https://docs.baseten.co/reference/sandbox-api/archive/lift-the-archive-freeze.md) |
| `GET` | [Get the archive status](https://docs.baseten.co/reference/sandbox-api/archive/get-the-archive-status.md) |
| `PUT` | [Apply code edit](https://docs.baseten.co/reference/sandbox-api/fastapply/apply-code-edit.md) |
| `GET` | [Code reranking/semantic search](https://docs.baseten.co/reference/sandbox-api/codegen/code-rerankingsemantic-search.md) |
| `GET` | [List currently mounted drives](https://docs.baseten.co/reference/sandbox-api/drive/list-currently-mounted-drives.md) |
| `POST` | [Attach a drive to a local path](https://docs.baseten.co/reference/sandbox-api/drive/attach-a-drive-to-a-local-path.md) |
| `DELETE` | [Detach a drive from a local path](https://docs.baseten.co/reference/sandbox-api/drive/detach-a-drive-from-a-local-path.md) |
| `POST` | [Reload environment from guest metadata](https://docs.baseten.co/reference/sandbox-api/system/reload-environment-from-guest-metadata.md) |
| `GET` | [Search for text content in files](https://docs.baseten.co/reference/sandbox-api/filesystem/search-for-text-content-in-files.md) |
| `GET` | [Find files and directories](https://docs.baseten.co/reference/sandbox-api/filesystem/find-files-and-directories.md) |
| `GET` | [List multipart uploads](https://docs.baseten.co/reference/sandbox-api/filesystem/list-multipart-uploads.md) |
| `POST` | [Initiate multipart upload](https://docs.baseten.co/reference/sandbox-api/filesystem/initiate-multipart-upload.md) |
| `DELETE` | [Abort multipart upload](https://docs.baseten.co/reference/sandbox-api/filesystem/abort-multipart-upload.md) |
| `POST` | [Complete multipart upload](https://docs.baseten.co/reference/sandbox-api/filesystem/complete-multipart-upload.md) |
| `PUT` | [Upload part](https://docs.baseten.co/reference/sandbox-api/filesystem/upload-part.md) |
| `GET` | [List parts](https://docs.baseten.co/reference/sandbox-api/filesystem/list-parts.md) |
| `GET` | [Fuzzy search for files and directories](https://docs.baseten.co/reference/sandbox-api/filesystem/fuzzy-search-for-files-and-directories.md) |
| `GET` | [Get directory tree](https://docs.baseten.co/reference/sandbox-api/filesystem/get-directory-tree.md) |
| `PUT` | [Create or update directory tree](https://docs.baseten.co/reference/sandbox-api/filesystem/create-or-update-directory-tree.md) |
| `DELETE` | [Delete directory tree](https://docs.baseten.co/reference/sandbox-api/filesystem/delete-directory-tree.md) |
| `GET` | [Get file or directory information](https://docs.baseten.co/reference/sandbox-api/filesystem/get-file-or-directory-information.md) |
| `PUT` | [Create or update a file or directory](https://docs.baseten.co/reference/sandbox-api/filesystem/create-or-update-a-file-or-directory.md) |
| `DELETE` | [Delete file or directory](https://docs.baseten.co/reference/sandbox-api/filesystem/delete-file-or-directory.md) |
| `HEAD` | [Stat a file or directory](https://docs.baseten.co/reference/sandbox-api/filesystem/stat-a-file-or-directory.md) |
| `GET` | [Health check](https://docs.baseten.co/reference/sandbox-api/system/health-check.md) |
| `POST` | [Start monitoring ports for a process](https://docs.baseten.co/reference/sandbox-api/network/start-monitoring-ports-for-a-process.md) |
| `DELETE` | [Stop monitoring ports for a process](https://docs.baseten.co/reference/sandbox-api/network/stop-monitoring-ports-for-a-process.md) |
| `GET` | [Get open ports for a process](https://docs.baseten.co/reference/sandbox-api/network/get-open-ports-for-a-process.md) |
| `DELETE` | [Disconnect tunnel](https://docs.baseten.co/reference/sandbox-api/network/disconnect-tunnel.md) |
| `PUT` | [Update tunnel configuration](https://docs.baseten.co/reference/sandbox-api/network/update-tunnel-configuration.md) |
| `GET` | [List all processes](https://docs.baseten.co/reference/sandbox-api/process/list-all-processes.md) |
| `POST` | [Execute a command](https://docs.baseten.co/reference/sandbox-api/process/execute-a-command.md) |
| `GET` | [Get process by identifier](https://docs.baseten.co/reference/sandbox-api/process/get-process-by-identifier.md) |
| `DELETE` | [Stop a process](https://docs.baseten.co/reference/sandbox-api/process/stop-a-process.md) |
| `DELETE` | [Kill a process](https://docs.baseten.co/reference/sandbox-api/process/kill-a-process.md) |
| `GET` | [Get process logs](https://docs.baseten.co/reference/sandbox-api/process/get-process-logs.md) |
| `GET` | [Stream process logs in real time](https://docs.baseten.co/reference/sandbox-api/process/stream-process-logs-in-real-time.md) |
| `POST` | [Write to a process's stdin](https://docs.baseten.co/reference/sandbox-api/process/write-to-a-processs-stdin.md) |
| `DELETE` | [Close a process's stdin](https://docs.baseten.co/reference/sandbox-api/process/close-a-processs-stdin.md) |
| `POST` | [Upgrade the sandbox-api](https://docs.baseten.co/reference/sandbox-api/system/upgrade-the-sandbox-api.md) |
| `GET` | [Stream file modification events in a directory](https://docs.baseten.co/reference/sandbox-api/filesystem/stream-file-modification-events-in-a-directory.md) |
