> For the complete documentation index, see [llms.txt](https://docs.release.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.release.com/reference-documentation/release-api/ai-sandbox-api/snapshots.md).

# Snapshots

The Snapshots API lets you capture and restore point-in-time snapshots of a sandbox session. Snapshots preserve the full state of the session, including filesystem contents and running processes, so you can roll back to a known-good state at any time.

To obtain your authentication credentials, [install the Release CLI](/cli/installation.md) and run `release auth login`. The CLI stores credentials in `~/.release.yaml`.

***

## State Lifecycle

Snapshots progress through the following states:

`creating` -> `ready` | `failed`

When a snapshot is being restored, its state transitions to:

`restoring` -> `ready` | `failed`

| State     | Description                               |
| --------- | ----------------------------------------- |
| creating  | Snapshot is being captured                |
| ready     | Snapshot is available for use             |
| failed    | Snapshot creation or restoration failed   |
| restoring | Snapshot is being restored to the session |

***

## Create Snapshot

Creates a new snapshot of the current session state.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/snapshots`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header       | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Accept       | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 201  | Snapshot creation started                     |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Session not found                             |
| 422  | Invalid session state for snapshotting        |

#### Response Body

| Field       | Type              | Description                                        |
| ----------- | ----------------- | -------------------------------------------------- |
| id          | string (hashid)   | Unique identifier for the snapshot                 |
| state       | string            | One of: `creating`, `ready`, `failed`, `restoring` |
| created\_at | string (ISO 8601) | When the snapshot was created                      |
| updated\_at | string (ISO 8601) | When the snapshot was last updated                 |

#### Example Responses

**201 Created**

```json
{
  "id": "snP7kW",
  "state": "creating",
  "created_at": "2026-06-01T12:00:00Z",
  "updated_at": "2026-06-01T12:00:00Z"
}
```

***

## List Snapshots

Returns all snapshots for a session.

#### Endpoint

<mark style="color:green;">`GET`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/snapshots`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header | Value              |
| ------ | ------------------ |
| Accept | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns array of snapshots                    |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Session not found                             |

#### Response Body

Returns an array of snapshot objects.

| Field       | Type              | Description                                        |
| ----------- | ----------------- | -------------------------------------------------- |
| id          | string (hashid)   | Unique identifier for the snapshot                 |
| state       | string            | One of: `creating`, `ready`, `failed`, `restoring` |
| created\_at | string (ISO 8601) | When the snapshot was created                      |
| updated\_at | string (ISO 8601) | When the snapshot was last updated                 |

#### Example Responses

**200 OK**

```json
[
  {
    "id": "snP7kW",
    "state": "ready",
    "created_at": "2026-06-01T12:00:00Z",
    "updated_at": "2026-06-01T12:00:30Z"
  },
  {
    "id": "snQ2mR",
    "state": "creating",
    "created_at": "2026-06-01T14:00:00Z",
    "updated_at": "2026-06-01T14:00:00Z"
  }
]
```

***

## Get Snapshot

Returns a single snapshot by ID.

#### Endpoint

<mark style="color:green;">`GET`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/snapshots/{snapId}`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Headers

| Header | Value              |
| ------ | ------------------ |
| Accept | `application/json` |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |
| snapId    | string (hashid) | Yes      | The snapshot ID        |

#### Status Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 200  | Returns the snapshot                          |
| 401  | Unauthorized — invalid or missing credentials |
| 404  | Session or snapshot not found                 |

#### Response Body

| Field       | Type              | Description                                        |
| ----------- | ----------------- | -------------------------------------------------- |
| id          | string (hashid)   | Unique identifier for the snapshot                 |
| state       | string            | One of: `creating`, `ready`, `failed`, `restoring` |
| created\_at | string (ISO 8601) | When the snapshot was created                      |
| updated\_at | string (ISO 8601) | When the snapshot was last updated                 |

#### Example Responses

**200 OK**

```json
{
  "id": "snP7kW",
  "state": "ready",
  "created_at": "2026-06-01T12:00:00Z",
  "updated_at": "2026-06-01T12:00:30Z"
}
```

**404 Not Found**

```json
{
  "errors": [
    {
      "code": "not_found",
      "message": "Snapshot not found"
    }
  ]
}
```

***

## Restore Snapshot

Restores a session to the state captured by a snapshot. The snapshot must be in `ready` state.

#### Endpoint

<mark style="color:green;">`POST`</mark> `https://backend-{handle}-envs.gcp.release.com/ai/accounts/{accountId}/sandbox_sessions/{id}/snapshots/{snapId}/restore`

#### Authentication

Authenticate using headers from your `~/.release.yaml` file. To set this up, [install the Release CLI](/cli/installation.md) and run `release auth login`.

| Header       | Description                                       |
| ------------ | ------------------------------------------------- |
| X-User-Email | User email from `~/.release.yaml` (`login` field) |
| X-User-Token | User token from `~/.release.yaml` (`token` field) |

#### Path Parameters

| Name      | Type            | Required | Description            |
| --------- | --------------- | -------- | ---------------------- |
| accountId | string (hashid) | Yes      | The Release account ID |
| id        | string (hashid) | Yes      | The sandbox session ID |
| snapId    | string (hashid) | Yes      | The snapshot ID        |

#### Status Codes

| Code | Description                                                              |
| ---- | ------------------------------------------------------------------------ |
| 200  | Snapshot restoration started                                             |
| 401  | Unauthorized — invalid or missing credentials                            |
| 404  | Session or snapshot not found                                            |
| 422  | Snapshot is not in `ready` state or session state does not allow restore |

#### Response Body

Returns the snapshot object with its state set to `restoring`.

| Field       | Type              | Description                                        |
| ----------- | ----------------- | -------------------------------------------------- |
| id          | string (hashid)   | Unique identifier for the snapshot                 |
| state       | string            | One of: `creating`, `ready`, `failed`, `restoring` |
| created\_at | string (ISO 8601) | When the snapshot was created                      |
| updated\_at | string (ISO 8601) | When the snapshot was last updated                 |

#### Example Responses

**200 OK**

```json
{
  "id": "snP7kW",
  "state": "restoring",
  "created_at": "2026-06-01T12:00:00Z",
  "updated_at": "2026-06-01T16:00:00Z"
}
```

**422 Unprocessable Entity**

```json
{
  "errors": [
    {
      "code": "invalid_state",
      "message": "Snapshot is not in ready state"
    }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.release.com/reference-documentation/release-api/ai-sandbox-api/snapshots.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
