# sandboxSnapshots (/docs/reference/api/sandbox-snapshots)

> Sandbox snapshots are their own resource, so a snapshot kept with `keep: true` outlives the sandbox it came from. `sandboxes.snapshot` takes them and `sandboxes.create` restores from them with `fromSnapshot`. These methods list, read and delete them. Snapshots stay private to their tenant and are never promoted to shared images. See [Sandboxes](/docs/guides/vps/sandboxes).



Sandbox snapshots are their own resource, so a snapshot kept with `keep: true` outlives the sandbox it came from. `sandboxes.snapshot` takes them and `sandboxes.create` restores from them with `fromSnapshot`. These methods list, read and delete them. Snapshots stay private to their tenant and are never promoted to shared images. See [Sandboxes](/docs/guides/vps/sandboxes).

All 3 methods are served by this release.

| Method              | Kind     | Authorization                                           | Phase | Status     |
| ------------------- | -------- | ------------------------------------------------------- | ----- | ---------- |
| [`list`](#list)     | read     | `compute:sandboxes:read` @ `compute-tenant` + items     | v0.5  | registered |
| [`get`](#get)       | read     | `compute:sandboxes:read` @ `compute-sandbox-snapshot`   | v0.5  | registered |
| [`delete`](#delete) | mutation | `compute:sandboxes:delete` @ `compute-sandbox-snapshot` | v0.5  | registered |

## list [#list]

`POST /api/compute/sandboxSnapshots/list`

Returns a page of the tenant's snapshots, newest first, including kept snapshots of deleted sandboxes.

`scope` defaults to `mine`, the caller's own snapshots; `all` lists the tenant's. `sandboxId` keeps one sandbox's snapshots. `limit` is 1 to 200 (default 50), and `cursor`, the last snapshot id of the previous page, is set while more remain. Deleted snapshots are never listed. Decided as `compute:sandboxes:read` on the tenant.

* **Kind:** read
* **Authorization:** `compute:sandboxes:read` @ `compute-tenant` + items
* **Module:** `vps`
* **Phase:** v0.5 (registered)

**Input**

| Field       | Type                 | Required | Constraints                                                       |
| ----------- | -------------------- | -------- | ----------------------------------------------------------------- |
| `tenantId`  | string               | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `scope`     | one of `mine`, `all` |          | default `"mine"`                                                  |
| `sandboxId` | string               |          | at most 56 characters; matches `^sbx_[0-9a-hjkmnp-tv-z]{26,52}$`  |
| `limit`     | integer              |          | 1-200                                                             |
| `cursor`    | string               |          | at most 57 characters; matches `^snap_[0-9a-hjkmnp-tv-z]{26,52}$` |

## get [#get]

`POST /api/compute/sandboxSnapshots/get`

Returns one snapshot of the tenant with its state (`pending`, `ready` or `failed`), and once ready its sha256, size, runtime and CPU model.

A deleted snapshot, or one of another tenant, is `NOT_FOUND`. Decided as `compute:sandboxes:read` on the snapshot.

* **Kind:** read
* **Authorization:** `compute:sandboxes:read` @ `compute-sandbox-snapshot`
* **Module:** `vps`
* **Phase:** v0.5 (registered)

**Input**

| Field        | Type   | Required | Constraints                                                       |
| ------------ | ------ | -------- | ----------------------------------------------------------------- |
| `tenantId`   | string | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `snapshotId` | string | yes      | at most 57 characters; matches `^snap_[0-9a-hjkmnp-tv-z]{26,52}$` |

## delete [#delete]

`POST /api/compute/sandboxSnapshots/delete`

Deletes a snapshot at once for reads and restores; the stored object is removed by the next `vps.sandboxes` pass (after its upload settled, for a pending one), so no network call runs in the request.

Idempotent: deleting a deleted snapshot answers `{ deleted: true }` again; an unknown one is `NOT_FOUND`. Publishes `sandbox.snapshot.deleted`. Decided as `compute:sandboxes:delete` on the snapshot.

* **Kind:** mutation
* **Authorization:** `compute:sandboxes:delete` @ `compute-sandbox-snapshot`
* **Module:** `vps`
* **Phase:** v0.5 (registered)

**Input**

| Field        | Type   | Required | Constraints                                                       |
| ------------ | ------ | -------- | ----------------------------------------------------------------- |
| `tenantId`   | string | yes      | at most 128 characters; matches `^[A-Za-z0-9._:-]{1,128}$`        |
| `snapshotId` | string | yes      | at most 57 characters; matches `^snap_[0-9a-hjkmnp-tv-z]{26,52}$` |
