---
title: API reference · Sandboxes docs
description: Every endpoint of the Sandboxes REST API, its parameters and what it returns, made from the API's own OpenAPI description.
url: https://www.quietrobot.ai/docs/sandboxes/api-reference
---

# API reference

Every endpoint of the Sandboxes REST API, its parameters and what it returns, made from the API's own OpenAPI description.

> [!NOTE]
> Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change.

> [!NOTE]
> This page is made from [the OpenAPI description](https://api.quietrobot.ai/api/v1/openapi.json) the API serves, so it lists exactly what the API takes. For how the pieces fit together, start with the [REST API guide](https://www.quietrobot.ai/docs/sandboxes/api). You can load the same file into Postman, Insomnia or a client generator.

Base address: `https://api.quietrobot.ai/api/v1`. Every request carries `Authorization: Bearer qr_live_...`. Read-only keys can make `GET` requests only. Errors are JSON `{ "error": { "code", "message" } }`; the codes are on [Errors](https://www.quietrobot.ai/docs/sandboxes/errors).

## Endpoints

**Sandboxes**

* [`GET /sandboxes`](#list-sandboxes): List sandboxes
* [`POST /sandboxes`](#create-a-sandbox): Create a sandbox
* [`GET /sandboxes/{id}`](#get-a-sandbox): Get a sandbox
* [`DELETE /sandboxes/{id}`](#destroy-a-sandbox): Destroy a sandbox
* [`POST /sandboxes/{id}/pause`](#pause-a-sandbox): Pause a sandbox
* [`POST /sandboxes/{id}/resume`](#resume-a-paused-or-archived-sandbox): Resume a paused or archived sandbox
* [`POST /sandboxes/{id}/timeout`](#set-the-deadline-to-now-timeoutsec): Set the deadline to now + timeoutSec
* [`PUT /sandboxes/{id}/egress`](#change-a-sandbox-s-network-rules): Change a sandbox's network rules
* [`GET /sandboxes/{id}/egress/learn`](#what-learn-mode-has-seen-as-allow-rules): What learn mode has seen, as allow rules
* [`POST /sandboxes/{id}/egress/learn`](#start-learn-mode-record-the-hosts-the-sandbox-reaches): Start learn mode: record the hosts the sandbox reaches
* [`DELETE /sandboxes/{id}/egress/learn`](#stop-learn-mode-and-put-the-old-rules-back): Stop learn mode and put the old rules back
* [`POST /sandboxes/{id}/egress/learn/apply`](#stop-learn-mode-and-allow-only-these-hosts): Stop learn mode and allow only these hosts
* [`PUT /sandboxes/{id}/spend-cap`](#set-the-sandbox-s-spend-cap): Set the sandbox's spend cap
* [`GET /sandboxes/{id}/report`](#what-did-the-agent-do-a-report-on-one-sandbox): What did the agent do: a report on one sandbox
* [`GET /sandboxes/{id}/image`](#the-sandbox-s-image-and-exact-package-versions): The sandbox's image and exact package versions
* [`GET /sandboxes/{id}/metrics`](#a-sandbox-s-cpu-memory-disk-runtime-storage-and-egress): A sandbox's CPU, memory, disk, runtime, storage and egress

**Commands**

* [`POST /sandboxes/{id}/exec`](#run-a-command): Run a command
* [`POST /sandboxes/{id}/terminal`](#open-an-interactive-terminal): Open an interactive terminal
* [`GET /sandboxes/{id}/executions`](#list-a-sandbox-s-commands): List a sandbox's commands
* [`GET /executions/{id}`](#get-a-command): Get a command
* [`GET /sandboxes/{id}/ports`](#list-preview-urls): List preview URLs
* [`PUT /sandboxes/{id}/ports`](#set-preview-urls): Set preview URLs
* [`GET /executions/{id}/output`](#read-a-live-command-s-output): Read a live command's output
* [`POST /executions/{id}/stdin`](#send-input-to-an-interactive-command-or-terminal): Send input to an interactive command or terminal
* [`POST /executions/{id}/kill`](#stop-a-live-command): Stop a live command
* [`POST /executions/{id}/resize`](#resize-a-terminal): Resize a terminal
* [`POST /executions/{id}/approve`](#approve-a-held-command-signed-in-people-only): Approve a held command (signed-in people only)
* [`POST /executions/{id}/deny`](#deny-a-held-command-signed-in-people-only): Deny a held command (signed-in people only)
* [`POST /executions/{id}/undo`](#undo-a-command-put-the-files-back-as-they-were-just-before-it-ran): Undo a command: put the files back as they were just before it ran

**Files**

* [`GET /sandboxes/{id}/files`](#read-a-file): Read a file
* [`PUT /sandboxes/{id}/files`](#write-a-file): Write a file
* [`DELETE /sandboxes/{id}/files`](#delete-a-file): Delete a file
* [`GET /sandboxes/{id}/files/list`](#list-a-folder): List a folder

**Snapshots**

* [`GET /sandboxes/{id}/snapshots`](#list-a-sandbox-s-snapshots): List a sandbox's snapshots
* [`POST /sandboxes/{id}/snapshots`](#snapshot-a-sandbox-s-files): Snapshot a sandbox's files
* [`POST /sandboxes/{id}/fork`](#fork-a-sandbox): Fork a sandbox
* [`POST /sandboxes/{id}/rewind`](#rewind-a-sandbox-to-a-snapshot): Rewind a sandbox to a snapshot
* [`GET /snapshots`](#list-snapshots): List snapshots
* [`GET /snapshots/{id}`](#get-a-snapshot): Get a snapshot
* [`DELETE /snapshots/{id}`](#delete-a-snapshot): Delete a snapshot

**Templates**

* [`GET /templates`](#list-your-templates): List your templates
* [`POST /templates`](#make-a-template-from-a-dockerfile): Make a template from a Dockerfile
* [`GET /templates/{id}`](#get-a-template-by-id-or-name-with-recent-builds): Get a template by id or name, with recent builds
* [`PATCH /templates/{id}`](#change-a-template-s-description-or-warm-pool): Change a template's description or warm pool
* [`DELETE /templates/{id}`](#delete-a-template): Delete a template
* [`POST /templates/{id}/builds`](#build-a-template-again): Build a template again
* [`GET /template-builds/{id}`](#get-a-build-and-its-log): Get a build and its log

**Volumes**

* [`POST /sandboxes/{id}/volumes/sync`](#save-a-sandbox-s-volumes-now): Save a sandbox's volumes now
* [`GET /volumes`](#list-volumes): List volumes
* [`POST /volumes`](#make-an-empty-volume): Make an empty volume
* [`GET /volumes/{id}`](#get-a-volume-by-id-or-name): Get a volume by id or name
* [`DELETE /volumes/{id}`](#delete-a-volume-and-its-files): Delete a volume and its files

**Webhooks**

* [`GET /webhooks`](#list-webhook-endpoints): List webhook endpoints
* [`POST /webhooks`](#add-a-webhook-endpoint): Add a webhook endpoint
* [`GET /webhooks/{id}`](#get-a-webhook-endpoint): Get a webhook endpoint
* [`PATCH /webhooks/{id}`](#change-a-webhook-endpoint): Change a webhook endpoint
* [`DELETE /webhooks/{id}`](#delete-a-webhook-endpoint): Delete a webhook endpoint
* [`POST /webhooks/{id}/test`](#send-a-signed-ping-now): Send a signed ping now
* [`POST /webhooks/{id}/rotate-secret`](#make-a-new-signing-secret): Make a new signing secret
* [`GET /webhooks/{id}/deliveries`](#recent-deliveries-to-an-endpoint): Recent deliveries to an endpoint
* [`POST /webhooks/{id}/deliveries/{deliveryId}/redeliver`](#send-a-delivery-again): Send a delivery again

**Secrets**

* [`GET /secrets`](#list-secrets): List secrets
* [`POST /secrets`](#add-or-replace-a-secret): Add or replace a secret
* [`DELETE /secrets/{name}`](#delete-a-secret): Delete a secret
* [`GET /outbound-check`](#your-outbound-check): Your outbound check
* [`GET /identity/jwks.json`](#public-key-for-sandbox-identity-tokens): Public key for sandbox identity tokens

**Organization**

* [`GET /sandboxes/{id}/audit`](#a-sandbox-s-audit-log): A sandbox's audit log
* [`GET /audit`](#the-organization-s-audit-log): The organization's audit log
* [`GET /usage`](#usage-this-month-and-the-plan-s-limits): Usage this month, and the plan's limits
* [`GET /reservations`](#list-reserved-machines): List reserved machines

## Sandboxes

### List sandboxes

```http
GET /api/v1/sandboxes
```

| Parameter | In | Type | |
|---|---|---|---|
| `status` | query | "starting", "running", "pausing", "paused", "archived", "stopped", "error" |  |

Returns `200` with an object.

### Create a sandbox

```http
POST /api/v1/sandboxes
```

Body (JSON):

| Field | Type | |
|---|---|---|
| `name` | string |  |
| `template` | string | base (default), minimal, or one of your own templates by name or id |
| `cpuClass` | "standard", "performance" | Default `"standard"`. |
| `cpus` | 1, 2, 4, 8, 16 |  |
| `memoryMb` | integer | Multiple of 256 |
| `timeoutSec` | integer | Session length; the plan sets the maximum |
| `region` | string | Region code, e.g. us-virginia or eu-frankfurt |
| `reservationId` | string |  |
| `snapshotId` | string | Start with this snapshot's files |
| `pool` | boolean | false always boots a fresh microVM |
| `durable` | boolean | Keep this sandbox's files (its home folder) through pauses, the time limit and a lost host. Every pause saves them to object storage first; the time limit pauses instead of deleting; after the plan's warm window the machine is deleted and the sandbox is archived until its next call, which restores the files onto a new microVM. Ends only when deleted. Stored files are billed per GB-month. |
| `ifExists` | "error", "return" | Durable only: when a durable sandbox already has this name, error (409 name_taken) or return that sandbox Default `"error"`. |
| `egress` | Egress |  |
| `env` | object |  |
| `metadata` | object |  |
| `secrets` | string[] | Names of the organization's secrets this sandbox may use. Each arrives as an environment variable holding a stand-in, never the value. Send calls through $QR_GATEWAY_URL/<host>/<path> with the stand-in where the key goes; the gateway swaps in the value outside the microVM. Needs egress mode allowlist or open. |
| `identity` | object | Hosts (your own services) this sandbox may prove itself to. It gets QR_IDENTITY_TOKEN, a stand-in the gateway swaps for a five-minute EdDSA token; check it with /identity/jwks.json |
| `autoPauseSec` | integer | Pause after this many seconds with no commands, file calls or gateway calls, unless programs inside are still working (using CPU or holding a connection open). Any call wakes it again |
| `run` | ExecRequest | A first command to run as soon as the sandbox is up, in the same request. The result comes back as run. |
| `volumes` | object[] | Folders kept between sandboxes. Each is put in place before the sandbox is returned, and saved when it pauses or stops, shortly before its deadline, and on POST /sandboxes/{id}/volumes/sync. One live sandbox holds a volume at a time (409 volume_in_use). |
| `spendCapUsd` | number |  |

Returns `200` with Sandbox.

Returns `201` with CreatedSandbox: Created

### Get a sandbox

```http
GET /api/v1/sandboxes/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with Sandbox.

### Destroy a sandbox

```http
DELETE /api/v1/sandboxes/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with Sandbox.

### Pause a sandbox

```http
POST /api/v1/sandboxes/{id}/pause
```

Freezes memory, files and processes. Paused time doesn't count toward usage. A durable sandbox saves its files to object storage first. 409 paused_storage_full when the plan's paused storage is used up.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with Sandbox.

### Resume a paused or archived sandbox

```http
POST /api/v1/sandboxes/{id}/resume
```

Any command or file call also wakes it. An archived durable sandbox wakes cold: a new microVM with its files restored (resumedFrom cold, memoryKept false).

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with Sandbox.

### Set the deadline to now + timeoutSec

```http
POST /api/v1/sandboxes/{id}/timeout
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `timeoutSec` (required) | integer |  |

Returns `200` with Sandbox.

### Change a sandbox's network rules

```http
PUT /api/v1/sandboxes/{id}/egress
```

Fields left out keep their value. Applies to new connections at once, and wakes a paused sandbox. 409 egress_too_wide when the rules need more than the sandbox's maxMode.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `mode` | "deny", "allowlist", "open" | deny: no outbound traffic. allowlist: only what allow lists. open: any public address. |
| `allow` | string[] | Rules: a domain (pypi.org, *.github.com), an IP address or a CIDR range (203.0.113.0/24, [2001:db8::/32]), with an optional port (db.example.com:5432, 203.0.113.0/24:8000-8100, example.com:*). No port means 80 and 443. Private ranges can't be allowed. |
| `deny` | string[] | Rules that are always blocked, in allowlist and open mode. Same format; no port means every port. Denied domains take no port. |
| `maxMode` | "deny", "allowlist", "open" | The widest mode this sandbox can be switched to later. Set at create; defaults to what its rules need. An allow rule on a port other than 80 or 443 needs open. |

Returns `200` with Sandbox.

### What learn mode has seen, as allow rules

```http
GET /api/v1/sandboxes/{id}/egress/learn
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with an object.

### Start learn mode: record the hosts the sandbox reaches

```http
POST /api/v1/sandboxes/{id}/egress/learn
```

With open internet allowed by the plan and maxMode, the sandbox runs open while learning and every website it visits is recorded (ports 80 and 443). Otherwise its rules stay as they are and what it tries to reach, allowed or blocked, is recorded.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with Sandbox.

### Stop learn mode and put the old rules back

```http
DELETE /api/v1/sandboxes/{id}/egress/learn
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with Sandbox.

### Stop learn mode and allow only these hosts

```http
POST /api/v1/sandboxes/{id}/egress/learn/apply
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `allow` (required) | string[] |  |

Returns `200` with Sandbox.

### Set the sandbox's spend cap

```http
PUT /api/v1/sandboxes/{id}/spend-cap
```

capUsd in dollars, or null for none. An API key may only lower the cap; raising or removing it needs a person in the dashboard. Raising it lets a sandbox the cap paused run again.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `capUsd` (required) | number |  |

Returns `200` with Sandbox.

### What did the agent do: a report on one sandbox

```http
GET /api/v1/sandboxes/{id}/report
```

A summary written from the audit log (no AI model), counts, every approval and who decided it, hosts reached and blocked, files, and the timeline. format=pdf returns a PDF file.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `format` | query | "json", "pdf" |  |

Returns `200` with an object.

### The sandbox's image and exact package versions

```http
GET /api/v1/sandboxes/{id}/image
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with an object.

### A sandbox's CPU, memory, disk, runtime, storage and egress

```http
GET /api/v1/sandboxes/{id}/metrics
```

A running sandbox gets a fresh reading first (at most every 10 seconds). Recorded usage, not a bill.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `hours` | query | integer | How far back the readings go |

Returns `200` with Metrics.

## Commands

### Run a command

```http
POST /api/v1/sandboxes/{id}/exec
```

Returns the finished execution (200). Returns 202 with status pending_approval if a policy rule holds it for a person, or with status running if it is still going after 90 seconds. Poll GET /executions/{id} until it finishes. With stream: true (or Accept: text/event-stream) the answer is server-sent events: start (the execution), stdout and stderr ({data, offset}), then done ({exitCode, timedOut}). With background: true it answers 202 at once; read its output with GET /executions/{id}/output.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `cmd` (required) | string | Shell command |
| `cwd` | string |  |
| `env` | object |  |
| `timeoutMs` | integer | A plain run: 1 s to 5 min (default 60 s). Streamed: up to 1 hour. Background: no limit of its own unless set (up to 24 hours). |
| `stdin` | string | Written to the command's stdin when it starts (at most 1 MB) |
| `stream` | boolean | Answer with server-sent events as it runs (or send Accept: text/event-stream) |
| `background` | boolean | Answer 202 at once and keep it running; read GET /executions/{id}/output |
| `interactive` | boolean | Keep stdin open for POST /executions/{id}/stdin (needs stream or background). An API key's interactive command needs a person's approval when the organization has approval rules. |

Returns `200` with Execution.

### Open an interactive terminal

```http
POST /api/v1/sandboxes/{id}/terminal
```

A shell on a pseudo-terminal. Read what it prints from GET /executions/{id}/output, send keys to POST /executions/{id}/stdin, resize with POST /executions/{id}/resize, close with POST /executions/{id}/kill. 201 when open; 202 pending_approval when an API key opens one in an organization with approval rules, since what is typed isn't checked command by command.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `cols` | integer |  |
| `rows` | integer |  |
| `cmd` | string | Defaults to a login shell |
| `cwd` | string |  |
| `env` | object |  |

Returns `200` with Execution.

### List a sandbox's commands

```http
GET /api/v1/sandboxes/{id}/executions
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `status` | query | string |  |

Returns `200` with an object.

### Get a command

```http
GET /api/v1/executions/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Returns `200` with Execution.

### List preview URLs

```http
GET /api/v1/sandboxes/{id}/ports
```

Ports reachable from a browser at https://<port>-<sandbox id with - for _>.<preview domain>. A private port needs its token: open shareUrl once (it sets a cookie for that host) or send X-QR-Preview-Token.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with an object.

### Set preview URLs

```http
PUT /api/v1/sandboxes/{id}/ports
```

Replaces the list. Private by default. Data sent to visitors counts as the sandbox's outbound data.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `ports` (required) | object[] |  |
| `rotate` | boolean | New tokens for private ports: links shared before stop working |

Returns `200` with an object.

### Read a live command's output

```http
GET /api/v1/executions/{id}/output
```

Output of a streamed, background or terminal command after byte offsets out and err. With Accept: text/event-stream (or ?stream=1): server-sent events until it ends (stdout, stderr, missed, done), or reconnect ({out, err}) after a long stream.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |
| `out` | query | integer |  |
| `err` | query | integer |  |
| `wait` | query | integer | Wait up to this many ms (max 25000) for new output |

Returns `200` with OutputChunk.

### Send input to an interactive command or terminal

```http
POST /api/v1/executions/{id}/stdin
```

JSON {data, close}, or a raw body of any other type with ?close=1. The first 64 KB sent is kept with the command for the audit trail.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `data` | string |  |
| `close` | boolean | End stdin (a terminal gets ^D) |

Returns `200` with an object.

### Stop a live command

```http
POST /api/v1/executions/{id}/kill
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `signal` | "TERM", "KILL", "INT", "HUP", "QUIT", "USR1", "USR2" |  |

Returns `200` with Execution.

### Resize a terminal

```http
POST /api/v1/executions/{id}/resize
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `cols` (required) | integer |  |
| `rows` (required) | integer |  |

Returns `200` with an object.

### Approve a held command (signed-in people only)

```http
POST /api/v1/executions/{id}/approve
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `note` | string |  |

Returns `200` with Execution.

### Deny a held command (signed-in people only)

```http
POST /api/v1/executions/{id}/deny
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `note` | string |  |

Returns `200` with Execution.

### Undo a command: put the files back as they were just before it ran

```http
POST /api/v1/executions/{id}/undo
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Execution ID |

Returns `200` with an object.

## Files

### Read a file

```http
GET /api/v1/sandboxes/{id}/files
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `path` (required) | query | string | Path inside the sandbox, relative to the work folder or absolute |

Returns `200` with string: File contents

### Write a file

```http
PUT /api/v1/sandboxes/{id}/files
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `path` (required) | query | string | Path inside the sandbox, relative to the work folder or absolute |

Body: `application/octet-stream`

Returns `200` with an object.

### Delete a file

```http
DELETE /api/v1/sandboxes/{id}/files
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `path` (required) | query | string | Path inside the sandbox, relative to the work folder or absolute |

Returns `200` with an object.

### List a folder

```http
GET /api/v1/sandboxes/{id}/files/list
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |
| `path` | query | string | Path inside the sandbox, relative to the work folder or absolute |

Returns `200` with an object.

## Snapshots

### List a sandbox's snapshots

```http
GET /api/v1/sandboxes/{id}/snapshots
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with an object.

### Snapshot a sandbox's files

```http
POST /api/v1/sandboxes/{id}/snapshots
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `name` | string |  |

Returns `200` with Snapshot.

### Fork a sandbox

```http
POST /api/v1/sandboxes/{id}/fork
```

Snapshots the sandbox's files (or uses snapshotId) and starts up to 10 copies with the same settings, each with those files. Memory and running programs aren't copied, and neither is env: pass it again. Copies that fail are listed in errors.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `count` | integer | Default `1`. |
| `snapshotId` | string | Fork from this snapshot instead of taking a new one |
| `name` | string | Copies are named <name>-1, <name>-2, ... |
| `env` | object |  |
| `timeoutSec` | integer |  |

Returns `200` with an object.

### Rewind a sandbox to a snapshot

```http
POST /api/v1/sandboxes/{id}/rewind
```

Puts the sandbox's files back as they were in the snapshot: files made since are deleted. Running programs keep running. With saveCurrent, the files as they are now are snapshotted first, so you can rewind back.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Body (JSON):

| Field | Type | |
|---|---|---|
| `snapshotId` (required) | string |  |
| `saveCurrent` | boolean | Default `false`. |

Returns `200` with an object.

### List snapshots

```http
GET /api/v1/snapshots
```

Returns `200` with an object.

### Get a snapshot

```http
GET /api/v1/snapshots/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Snapshot ID |

Returns `200` with Snapshot.

### Delete a snapshot

```http
DELETE /api/v1/snapshots/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Snapshot ID |

Returns `200` with Snapshot.

## Templates

### List your templates

```http
GET /api/v1/templates
```

Returns `200` with an object.

### Make a template from a Dockerfile

```http
POST /api/v1/templates
```

Builds your own sandbox image from a Dockerfile, in its own microVM. The last stage must start FROM quietrobot/base or quietrobot/minimal; other stages can use any public image. There is no build context: fetch files with RUN or ADD a URL, or COPY --from another stage. CMD, ENTRYPOINT, VOLUME and HEALTHCHECK aren't used. ENV values reach every command. Returns 202 at once; poll GET /templates/{id} until status is ready, then create sandboxes with template set to its name or id. Each plan limits templates, builds a day, build time and image size; build time is billed at Standard rates.

Body (JSON):

| Field | Type | |
|---|---|---|
| `name` (required) | string | 2 to 48 lowercase letters, digits or dashes |
| `dockerfile` (required) | string |  |
| `description` | string |  |
| `warmPool` | object | Keep this many VMs ready for fast starts (paid plans) |

Returns `200` with an object: Accepted: the first build is queued

### Get a template by id or name, with recent builds

```http
GET /api/v1/templates/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Template ID |

Returns `200` with an object.

### Change a template's description or warm pool

```http
PATCH /api/v1/templates/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Template ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `description` | string |  |
| `warmPool` | object |  |

Returns `200` with Template.

### Delete a template

```http
DELETE /api/v1/templates/{id}
```

Sandboxes already running from it keep running.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Template ID |

Returns `200` with an object.

### Build a template again

```http
POST /api/v1/templates/{id}/builds
```

With a new dockerfile, or with none to rebuild the last one on our latest base image. The template keeps serving its current image until the new build is ready.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Template ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `dockerfile` | string |  |

Returns `200` with an object: Accepted

### Get a build and its log

```http
GET /api/v1/template-builds/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Build ID |

Returns `200` with TemplateBuild.

## Volumes

### Save a sandbox's volumes now

```http
POST /api/v1/sandboxes/{id}/volumes/sync
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with an object.

### List volumes

```http
GET /api/v1/volumes
```

Returns `200` with an object.

### Make an empty volume

```http
POST /api/v1/volumes
```

Body (JSON):

| Field | Type | |
|---|---|---|
| `name` (required) | string |  |

Returns `200` with Volume.

### Get a volume by id or name

```http
GET /api/v1/volumes/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Volume ID |

Returns `200` with Volume.

### Delete a volume and its files

```http
DELETE /api/v1/volumes/{id}
```

Refused (409 volume_in_use) while a live or paused sandbox holds it.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Volume ID |

Returns `200` with Volume.

## Webhooks

### List webhook endpoints

```http
GET /api/v1/webhooks
```

Returns `200` with an object.

### Add a webhook endpoint

```http
POST /api/v1/webhooks
```

Events are POSTed as JSON {id, type, createdAt, data}, signed the Standard Webhooks way: webhook-id, webhook-timestamp and webhook-signature (v1,<base64 HMAC-SHA256 of id.timestamp.body>, keyed with the base64 part of the secret). Answer 2xx within 10 seconds; anything else is retried for about 11 hours. The URL must be public https.

Body (JSON):

| Field | Type | |
|---|---|---|
| `url` (required) | string |  |
| `description` | string |  |
| `events` | string[] |  |

Returns `200` with Webhook.

### Get a webhook endpoint

```http
GET /api/v1/webhooks/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |

Returns `200` with Webhook.

### Change a webhook endpoint

```http
PATCH /api/v1/webhooks/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |

Body (JSON):

| Field | Type | |
|---|---|---|
| `url` | string |  |
| `description` | string |  |
| `events` | string[] |  |
| `enabled` | boolean |  |

Returns `200` with Webhook.

### Delete a webhook endpoint

```http
DELETE /api/v1/webhooks/{id}
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |

Returns `200` with Webhook.

### Send a signed ping now

```http
POST /api/v1/webhooks/{id}/test
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |

Returns `200` with an object.

### Make a new signing secret

```http
POST /api/v1/webhooks/{id}/rotate-secret
```

The old secret stops working at once.

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |

Returns `200` with Webhook.

### Recent deliveries to an endpoint

```http
GET /api/v1/webhooks/{id}/deliveries
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |
| `limit` | query | integer |  |

Returns `200` with an object.

### Send a delivery again

```http
POST /api/v1/webhooks/{id}/deliveries/{deliveryId}/redeliver
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Webhook ID |
| `deliveryId` (required) | path | string |  |

Returns `200` with WebhookDelivery.

## Secrets

### List secrets

```http
GET /api/v1/secrets
```

Returns `200` with an object.

### Add or replace a secret

```http
POST /api/v1/secrets
```

Stores a key a sandbox can use without holding it. Replacing a value takes effect on the next call from running sandboxes.

Body (JSON):

| Field | Type | |
|---|---|---|
| `name` (required) | string | A-Z, 0-9 and _, starting with a letter; not starting with QR_ |
| `value` (required) | string | The key or token, up to 16 KB. Stored encrypted |
| `hosts` (required) | string[] |  |

Returns `200` with Secret.

Returns `201` with Secret: Saved

### Delete a secret

```http
DELETE /api/v1/secrets/{name}
```

Stand-ins for it stop working at once, in every sandbox.

| Parameter | In | Type | |
|---|---|---|---|
| `name` (required) | path | string |  |

Returns `200` with Secret.

### Your outbound check

```http
GET /api/v1/outbound-check
```

Set or remove it on the dashboard's Policy page (owners and admins).

Returns `200` with an object.

### Public key for sandbox identity tokens

```http
GET /api/v1/identity/jwks.json
```

Returns `200` with an object.

## Organization

### A sandbox's audit log

```http
GET /api/v1/sandboxes/{id}/audit
```

| Parameter | In | Type | |
|---|---|---|---|
| `id` (required) | path | string | Sandbox ID, or the name of a durable sandbox |

Returns `200` with an object.

### The organization's audit log

```http
GET /api/v1/audit
```

| Parameter | In | Type | |
|---|---|---|---|
| `before` | query | integer | Return events with seq below this |
| `limit` | query | integer |  |
| `action` | query | string |  |

Returns `200` with an object.

### Usage this month, and the plan's limits

```http
GET /api/v1/usage
```

| Parameter | In | Type | |
|---|---|---|---|
| `days` | query | integer | A rolling window instead of this month |

Returns `200` with Usage.

### List reserved machines

```http
GET /api/v1/reservations
```

Returns `200` with an object.

## Objects

### Error

| Field | Type | |
|---|---|---|
| `error` (required) | object |  |

### Egress

| Field | Type | |
|---|---|---|
| `mode` | "deny", "allowlist", "open" | deny: no outbound traffic. allowlist: only what allow lists. open: any public address. |
| `allow` | string[] | Rules: a domain (pypi.org, *.github.com), an IP address or a CIDR range (203.0.113.0/24, [2001:db8::/32]), with an optional port (db.example.com:5432, 203.0.113.0/24:8000-8100, example.com:*). No port means 80 and 443. Private ranges can't be allowed. |
| `deny` | string[] | Rules that are always blocked, in allowlist and open mode. Same format; no port means every port. Denied domains take no port. |
| `maxMode` | "deny", "allowlist", "open" | The widest mode this sandbox can be switched to later. Set at create; defaults to what its rules need. An allow rule on a port other than 80 or 443 needs open. |

### Sandbox

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `name` | string |  |
| `status` | "starting", "running", "pausing", "paused", "archived", "stopped", "error" | pausing: a durable sandbox saving its files. archived: a durable sandbox whose machine was deleted; its files are kept and any call wakes it. |
| `template` | string | base, minimal, or the id of one of your own templates (tpl_...) |
| `region` | string |  |
| `cpuClass` | "standard", "performance" |  |
| `reservationId` | string |  |
| `pausedAt` | string |  |
| `fromSnapshotId` | string |  |
| `warmStart` | boolean | Handed out from a pre-started microVM |
| `cpus` | integer |  |
| `memoryMb` | integer |  |
| `egress` | Egress |  |
| `secrets` | string[] | Names of the secrets this sandbox may use through the gateway |
| `identity` | object |  |
| `autoPauseSec` | integer |  |
| `lastActiveAt` | string |  |
| `durable` | boolean |  |
| `storage` | object |  |
| `resumedFrom` | "warm", "cold" |  |
| `memoryKept` | boolean |  |
| `spend` | object | Spend so far (running time at the size's price plus data sent out) and the sandbox's spend cap |
| `metadata` | object |  |
| `error` | string |  |
| `createdAt` | string |  |
| `startedAt` | string |  |
| `deadlineAt` | string |  |
| `endedAt` | string |  |

### Secret

A stored key or token. The value is write-only: it is never returned.

| Field | Type | |
|---|---|---|
| `name` | string | Environment variable name the stand-in arrives under, e.g. OPENAI_API_KEY |
| `hosts` | string[] | The only hosts the value may be sent to; *.example.com allowed |
| `createdAt` | string |  |
| `updatedAt` | string |  |
| `lastUsedAt` | string |  |

### PutSecret

| Field | Type | |
|---|---|---|
| `name` (required) | string | A-Z, 0-9 and _, starting with a letter; not starting with QR_ |
| `value` (required) | string | The key or token, up to 16 KB. Stored encrypted |
| `hosts` (required) | string[] |  |

### CreateSandbox

| Field | Type | |
|---|---|---|
| `name` | string |  |
| `template` | string | base (default), minimal, or one of your own templates by name or id |
| `cpuClass` | "standard", "performance" | Default `"standard"`. |
| `cpus` | 1, 2, 4, 8, 16 |  |
| `memoryMb` | integer | Multiple of 256 |
| `timeoutSec` | integer | Session length; the plan sets the maximum |
| `region` | string | Region code, e.g. us-virginia or eu-frankfurt |
| `reservationId` | string |  |
| `snapshotId` | string | Start with this snapshot's files |
| `pool` | boolean | false always boots a fresh microVM |
| `durable` | boolean | Keep this sandbox's files (its home folder) through pauses, the time limit and a lost host. Every pause saves them to object storage first; the time limit pauses instead of deleting; after the plan's warm window the machine is deleted and the sandbox is archived until its next call, which restores the files onto a new microVM. Ends only when deleted. Stored files are billed per GB-month. |
| `ifExists` | "error", "return" | Durable only: when a durable sandbox already has this name, error (409 name_taken) or return that sandbox Default `"error"`. |
| `egress` | Egress |  |
| `env` | object |  |
| `metadata` | object |  |
| `secrets` | string[] | Names of the organization's secrets this sandbox may use. Each arrives as an environment variable holding a stand-in, never the value. Send calls through $QR_GATEWAY_URL/<host>/<path> with the stand-in where the key goes; the gateway swaps in the value outside the microVM. Needs egress mode allowlist or open. |
| `identity` | object | Hosts (your own services) this sandbox may prove itself to. It gets QR_IDENTITY_TOKEN, a stand-in the gateway swaps for a five-minute EdDSA token; check it with /identity/jwks.json |
| `autoPauseSec` | integer | Pause after this many seconds with no commands, file calls or gateway calls, unless programs inside are still working (using CPU or holding a connection open). Any call wakes it again |
| `run` | ExecRequest | A first command to run as soon as the sandbox is up, in the same request. The result comes back as run. |
| `volumes` | object[] | Folders kept between sandboxes. Each is put in place before the sandbox is returned, and saved when it pauses or stops, shortly before its deadline, and on POST /sandboxes/{id}/volumes/sync. One live sandbox holds a volume at a time (409 volume_in_use). |
| `spendCapUsd` | number |  |

### ExecRequest

| Field | Type | |
|---|---|---|
| `cmd` (required) | string | Shell command |
| `cwd` | string |  |
| `env` | object |  |
| `timeoutMs` | integer | A plain run: 1 s to 5 min (default 60 s). Streamed: up to 1 hour. Background: no limit of its own unless set (up to 24 hours). |
| `stdin` | string | Written to the command's stdin when it starts (at most 1 MB) |
| `stream` | boolean | Answer with server-sent events as it runs (or send Accept: text/event-stream) |
| `background` | boolean | Answer 202 at once and keep it running; read GET /executions/{id}/output |
| `interactive` | boolean | Keep stdin open for POST /executions/{id}/stdin (needs stream or background). An API key's interactive command needs a person's approval when the organization has approval rules. |

### ExposedPort

| Field | Type | |
|---|---|---|
| `port` | integer |  |
| `access` | "private", "public" |  |
| `url` | string |  |
| `shareUrl` | string |  |
| `token` | string |  |

### OutputChunk

| Field | Type | |
|---|---|---|
| `stdout` | string |  |
| `stderr` | string |  |
| `out` | integer | stdout byte offset to ask from next |
| `err` | integer | stderr byte offset to ask from next |
| `missed` | integer | Bytes that fell out of the 2 MB buffer before they were read |
| `done` | boolean |  |
| `exitCode` | integer |  |
| `timedOut` | boolean |  |

### Execution

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `sandboxId` | string |  |
| `status` | "pending_approval", "running", "completed", "denied", "failed" |  |
| `cmd` | string |  |
| `cwd` | string |  |
| `envKeys` | string[] |  |
| `exitCode` | integer |  |
| `stdout` | string |  |
| `stderr` | string |  |
| `durationMs` | integer |  |
| `timedOut` | boolean |  |
| `mode` | "run", "stream", "background", "terminal" |  |
| `interactive` | boolean |  |
| `requestedBy` | object |  |
| `approval` | object |  |
| `checkpointSnapshotId` | string |  |
| `createdAt` | string |  |
| `finishedAt` | string |  |

### Template

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `name` | string |  |
| `description` | string |  |
| `status` | "building", "ready", "failed" | ready once a build has finished; a template keeps its last good image while a rebuild runs |
| `base` | "base", "minimal" |  |
| `sizeBytes` | integer |  |
| `upToDate` | boolean |  |
| `warmPool` | object |  |
| `env` | string[] | Names of the variables the Dockerfile set with ENV. Every command gets them. |
| `latestBuild` | TemplateBuild |  |
| `createdAt` | string |  |
| `updatedAt` | string |  |

### TemplateBuild

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `templateId` | string |  |
| `status` | "queued", "building", "sealing", "ready", "failed", "cancelled" |  |
| `base` | string |  |
| `error` | string |  |
| `sizeBytes` | integer |  |
| `log` | string | The end of the build output (GET /template-builds/{id} only) |
| `createdAt` | string |  |
| `startedAt` | string |  |
| `endedAt` | string |  |

### Volume

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `name` | string |  |
| `sizeBytes` | integer | Compressed size of the last save |
| `attachedTo` | string |  |
| `path` | string |  |
| `savedAt` | string |  |
| `createdAt` | string |  |

### VolumeSave

| Field | Type | |
|---|---|---|
| `volumeId` | string |  |
| `name` | string |  |
| `ok` | boolean |  |
| `sizeBytes` | integer |  |
| `error` | string |  |

### Metrics

Readings of the whole microVM, about once a minute while it runs, kept 7 days. CPU is % of the sandbox's vCPUs.

| Field | Type | |
|---|---|---|
| `sandboxId` | string |  |
| `status` | string |  |
| `cpus` | integer |  |
| `memoryMb` | integer |  |
| `sampledAt` | string |  |
| `runtime` | object |  |
| `cpu` | object |  |
| `memory` | object |  |
| `disk` | object |  |
| `storage` | object |  |
| `egress` | object |  |
| `samples` | object[] |  |

### Webhook

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `url` | string |  |
| `description` | string |  |
| `events` | string[] | Event names or groups (sandbox.*, approval.*, *). Default: sandbox.*, approval.*, volume.save_failed |
| `enabled` | boolean |  |
| `failingSince` | string |  |
| `lastDeliveryAt` | string |  |
| `lastStatus` | integer |  |
| `createdAt` | string |  |
| `secret` | string | Only when created or rotated: the signing secret (whsec_...). Shown once. |

### WebhookDelivery

| Field | Type | |
|---|---|---|
| `id` | string | Also the webhook-id header |
| `event` | string |  |
| `status` | "pending", "delivered", "failed" |  |
| `attempts` | integer |  |
| `nextAttemptAt` | string |  |
| `lastStatus` | integer |  |
| `lastError` | string |  |
| `createdAt` | string |  |
| `deliveredAt` | string |  |
| `payload` | object |  |

### Snapshot

| Field | Type | |
|---|---|---|
| `id` | string |  |
| `name` | string |  |
| `kind` | "manual", "checkpoint" |  |
| `status` | "creating", "ready" |  |
| `sizeBytes` | integer |  |
| `sourceSandboxId` | string |  |
| `createdAt` | string |  |

### AuditEvent

| Field | Type | |
|---|---|---|
| `seq` | integer |  |
| `sandboxId` | string |  |
| `actorKind` | string |  |
| `actorLabel` | string |  |
| `action` | string |  |
| `detail` | object |  |
| `createdAt` | string |  |

### FileEntry

| Field | Type | |
|---|---|---|
| `name` | string |  |
| `path` | string |  |
| `type` | string | file or dir |
| `size` | integer |  |
| `modified` | string |  |

### Usage

Usage for the window. limits is set on plans with hard monthly limits (Free).

| Field | Type | |
|---|---|---|
| `since` | string |  |
| `plan` | object |  |
| `limits` | object |  |
| `sandboxes` | integer |  |
| `executions` | integer |  |
| `cpuHours` | number |  |
| `gbHours` | number |  |
| `egressGb` | number |  |
| `pastCapStorageUsd` | number | Files kept past the plan's paused-storage limit because a spend cap paused a sandbox. Charged on every plan, Free included. |
| `bySandbox` | object[] | Each sandbox in the window, most expensive first (at most 100) |
| `storage` | object | What's stored now. Recorded; not billed yet. |
