# API reference: snapshots

Saved copies of a machine's disk. A paid add-on, billed per GiB-month from the same balance.

[API conventions](../api.md) explains auth, IDs, lists, errors and idempotency. The examples read the API key from `ARVM_API_KEY`.

## Operations

| Operation | Request |
|---|---|
| [Snapshot a machine's disk](#snapshot-a-machines-disk) | `POST /v1/snapshots` |
| [List snapshots](#list-snapshots) | `GET /v1/snapshots` |
| [Get a snapshot](#get-a-snapshot) | `GET /v1/snapshots/{snapshot}` |
| [Delete a snapshot](#delete-a-snapshot) | `DELETE /v1/snapshots/{snapshot}` |

## Snapshot a machine's disk

`POST /v1/snapshots`

Saves a copy of the machine's disk as it is now. The machine keeps running. The snapshot is
`creating` until the copy is complete, then `ready`. Storage is billed per GiB-month from the
org's balance while the snapshot exists.

The machine must have a disk: one whose host has not finished creating it yet, one stopped
before its first start, one whose disk is lost, and one placed on a drive that failed for
good before its disk was made are refused with `machine_has_no_disk` (409), one whose disk is
coming back from the archive with `machine_restoring` (409), and one whose disk cannot be
reached right now with `disk_unreachable` (503) and `Retry-After`. While the snapshot is
`creating`, the machine cannot be deleted.

- Operation ID: `createSnapshot`
- Auth: an API key, or the web app's session cookie
- API key scope: a full key. A read-only key is answered 403 `read_only_key`.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `Idempotency-Key` | header | string | no | A value the client chooses, such as a UUID. For 24 hours after a request succeeded, a request with the same key and the same body returns the first request's response instead of creating again. A request that failed leaves the key free, with one exception: a `createMachine` refused with `no_capacity` returns the same 503 until its `Retry-After` has passed, and is tried again after. The same key with a different body is `idempotency_key_reused` (409). Minimum length: `1`. Maximum length: `255`. |

**Request body**

`application/json`: [SnapshotCreate](schemas.md#snapshotcreate)

**Responses**

| Status | Description | Body |
|---|---|---|
| 201 | The snapshot was started. | `application/json`: [Snapshot](schemas.md#snapshot) |

Errors: `400`, `401`, `402`, `403`, `404`, `409`, `429`, `503`. [Error responses](index.md#error-responses) says what each status means.

**Example**

```console
$ curl -s -X POST "https://api.arvm.dev/v1/snapshots" \
    -H "Authorization: Bearer $ARVM_API_KEY" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{"machine": "calm-river-otter", "name": "before-upgrade"}'
```

Response body, `application/json`:

```json
{
  "id": "snap_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "name": "before-upgrade",
  "machine_id": "m_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "state": "creating",
  "created_at": "2026-11-10T21:00:00Z"
}
```

## List snapshots

`GET /v1/snapshots`

Newest first.

- Operation ID: `listSnapshots`
- Auth: an API key, or the web app's session cookie
- API key scope: any. A read-only key may call this.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `machine` | query | string | no | Keep snapshots of this machine, by ID or name. |
| `limit` | query | integer (int32) | no | The most items to return. Default: `50`. Minimum: `1`. Maximum: `200`. |
| `cursor` | query | string | no | The `next_cursor` of the previous page. Opaque. Maximum length: `512`. |

**Responses**

| Status | Description | Body |
|---|---|---|
| 200 | A page of snapshots. | `application/json`: [SnapshotList](schemas.md#snapshotlist) |

Errors: `400`, `401`, `429`. [Error responses](index.md#error-responses) says what each status means.

**Example**

```console
$ curl -s "https://api.arvm.dev/v1/snapshots" \
    -H "Authorization: Bearer $ARVM_API_KEY"
```

Response body, `application/json`:

```json
{
  "data": [
    {
      "id": "snap_01jcz3k8x0e5v9w2r4t6y8a0bq",
      "name": "before-upgrade",
      "machine_id": "m_01jcz3k8x0e5v9w2r4t6y8a0bq",
      "state": "ready",
      "size_bytes": 6442450944,
      "created_at": "2026-11-10T21:00:00Z",
      "ready_at": "2026-11-10T21:00:04Z"
    }
  ],
  "next_cursor": null
}
```

## Get a snapshot

`GET /v1/snapshots/{snapshot}`

- Operation ID: `getSnapshot`
- Auth: an API key, or the web app's session cookie
- API key scope: any. A read-only key may call this.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `snapshot` | path | string | yes | The snapshot's ID or its name. Minimum length: `1`. Maximum length: `63`. |

**Responses**

| Status | Description | Body |
|---|---|---|
| 200 | The snapshot. | `application/json`: [Snapshot](schemas.md#snapshot) |

Errors: `400`, `401`, `404`, `429`. [Error responses](index.md#error-responses) says what each status means.

**Example**

```console
$ curl -s "https://api.arvm.dev/v1/snapshots/snap_01jcz3k8x0e5v9w2r4t6y8a0bq" \
    -H "Authorization: Bearer $ARVM_API_KEY"
```

Response body, `application/json`:

```json
{
  "id": "snap_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "name": "before-upgrade",
  "machine_id": "m_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "state": "ready",
  "size_bytes": 6442450944,
  "created_at": "2026-11-10T21:00:00Z",
  "ready_at": "2026-11-10T21:00:04Z"
}
```

## Delete a snapshot

`DELETE /v1/snapshots/{snapshot}`

Machines created from the snapshot are not affected. While a machine made from it has no
disk yet (it is being created, or was stopped before its first start), the snapshot cannot
be deleted: `snapshot_in_use` (409). Delete that machine, start it, or wait for it.

Billing for the snapshot's storage stops at the request. By ID, a deleted snapshot still
answers `getSnapshot`, so a client can watch it reach `deleted`. Deleting a deleted snapshot
is 404.

- Operation ID: `deleteSnapshot`
- Auth: an API key, or the web app's session cookie
- API key scope: a full key. A read-only key is answered 403 `read_only_key`.

**Parameters**

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `snapshot` | path | string | yes | The snapshot's ID or its name. Minimum length: `1`. Maximum length: `63`. |

**Responses**

| Status | Description | Body |
|---|---|---|
| 202 | Deletion was accepted. The snapshot is `deleting`. | `application/json`: [Snapshot](schemas.md#snapshot) |

Errors: `400`, `401`, `403`, `404`, `409`, `429`. [Error responses](index.md#error-responses) says what each status means.

**Example**

```console
$ curl -s -X DELETE "https://api.arvm.dev/v1/snapshots/snap_01jcz3k8x0e5v9w2r4t6y8a0bq" \
    -H "Authorization: Bearer $ARVM_API_KEY"
```

Response body, `application/json`:

```json
{
  "id": "snap_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "name": "before-upgrade",
  "machine_id": "m_01jcz3k8x0e5v9w2r4t6y8a0bq",
  "state": "deleting",
  "size_bytes": 6442450944,
  "created_at": "2026-11-10T21:00:00Z",
  "ready_at": "2026-11-10T21:00:04Z"
}
```
