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

# Snapshots

> Save a Linux, Windows or Citrix desktop with your software installed, version it, and pin the version your workflows boot.

A **snapshot** is a saved desktop image. A [custom environment](https://docs.asteroid.ai/concepts/environments.md#custom-environments) boots from it, so every run starts with your software already installed and set up.

Build a snapshot only when it pays off. Use one when each run would otherwise spend time installing or setting up the same thing. If the base image already has what your workflow needs, use the base.

Snapshots work for the Linux, Windows and Citrix environment types. A browser environment has no snapshot.

## Who can build one

Building a snapshot needs a plan that includes it, and the operating system of the image. Without them, a capture is refused with a 403. An organization admin upgrades the plan.

Your organization's snapshots are private to it. Your organization can also boot the shared snapshots that Asteroid publishes, for each operating system its plan includes.

## Build on a base

A **base** is one of the three shared operating system images:

| Base | Environment type |
| - | - |
| `linux-base` | Linux |
| `windows-base-usw4` | Windows |
| `citrix-base-chrome` | Citrix |

Every snapshot starts from a base. That keeps its recipe complete, so you can rebuild the snapshot on a newer base by replaying the recipe.

| To | Boot | Capture under |
| - | - | - |
| Build a new snapshot | The base's newest version | A new name |
| Change a snapshot | That snapshot's newest version | The same name |

Do not start a new snapshot from another snapshot, your own or a shared one. Its recipe would then depend on that snapshot, and could not rebuild the image from a base.

## Build or change a snapshot

Ask Astro: "Build a Linux snapshot with LibreOffice installed." Astro boots the base, installs the software, writes the recipe and captures. It asks you before it captures.

An environment Astro started belongs to that chat. Only that chat can read or capture it.

To do it yourself with the [CLI](https://docs.asteroid.ai/cli/reference.md) (the [MCP](https://docs.asteroid.ai/mcp/tools.md) tools and the API have the same operations):

**1. Boot the base, or the snapshot to change**

```bash theme={null}
asteroid environment start --source '{"kind":"spec","template":{"type":"os","osType":"linux","snapshotName":"linux-base"}}'
```

Set `osType` to `windows` or `citrix` for those bases. To change a snapshot, set `snapshotName` to its name.

**2. Install and set up**

Open the environment's live view on the **Environments** page, **Instances** tab. Install the software and set up the screen the way every run should find it. Note each step for the recipe.

**3. Read the current recipe**

```bash theme={null}
asteroid environment current-snapshot <environment-id>
```

This shows the version the machine holds. It shows the recipe only when one is on record and the snapshot is not shared. A base has none, so a new snapshot needs a full recipe. Otherwise edit that recipe rather than writing a new one. If `newerVersion` is set, the machine is not the newest version: a capture would drop that version's changes. Boot the newest version first.

**4. Capture**

```bash theme={null}
asteroid environment snapshot <environment-id> \
  --display-name crm-desktop \
  --recipe "$(cat recipe.md)" \
  --changelog "Installs the CRM client."
```

Run it once. See [What a capture does](#what-a-capture-does).

**5. Stop the environment**

```bash theme={null}
asteroid environment stop <environment-id>
```

## The recipe

Each version should carry a **recipe**: markdown that rebuilds the image on a fresh base, with no other context. It has these sections:

| Section | Holds |
| - | - |
| `## Install` | Every step from the base, in order. Scripted steps as code blocks, GUI steps as prose. Required. |
| `## Boot state` | What is open, signed in and on screen when the machine boots. Required. |
| `## Notes` | Anything else a rebuild needs. Optional. |

A recipe has no frontmatter and at most 20000 characters. A changelog has at most 500. A new recipe replaces the old one. So it covers every step from the base, not only the last capture's. Never write a password, token or other secret in it. Sign-ins belong in [profiles](https://docs.asteroid.ai/concepts/profiles.md).

Always send a recipe on a snapshot's first capture. The capture does not require one, and a version stored without a recipe cannot be rebuilt. Leave out `--recipe` only to keep the recipe of the version the machine booted, when that version is of the same snapshot.

## What a capture does

* **It takes minutes**, and the command waits until it finishes.
* **Linux and Citrix restart.** The machine is stopped, imaged and started again. The session ends and the screen is back at its boot state. Windows is imaged with its memory and keeps running.
* **Each capture adds a version.** Do not retry one. If the command times out or returns a 5xx error, the capture can still finish. Run `asteroid environment-snapshot list` and look for the new version first.
* **A name is yours once used.** A capture under a name your organization already uses adds the next version to that snapshot. A new snapshot cannot take a shared snapshot's name, such as `linux-base`.

## Versions and pins

Versions are numbered like `1.2.0`. Each change takes the next minor version: `1.2.0`, then `1.3.0`. To boot a snapshot, set its name as the **Snapshot** of a custom environment (`base.snapshotName` on the API), then bind the workflow to that environment. `asteroid environment-snapshot list` shows each snapshot's name and versions, newest first.

| `snapshotName` | Boots |
| - | - |
| `name` | The newest version |
| `name:1.2` | The newest `1.2` patch |
| `name:1.2.0` | Exactly `1.2.0` |
| `name:1.3.0-rc.1` | That proposal, to test it |

Pin a minor or exact version when a workflow must not change until you move it.

## Propose, test and accept

A change to a snapshot that workflows boot by bare name reaches them at their next run. To test it first, capture it as a **proposal**:

```bash theme={null}
asteroid environment snapshot <environment-id> --display-name crm-desktop --propose \
  --recipe "$(cat recipe.md)" --changelog "Updates the CRM client to 4.2."
```

1. The capture is stored as a pre-release, such as `1.3.0-rc.1`, and returns its `proposalId`. Only that exact pin boots it. Every other pin keeps its version.
2. Test it: boot `crm-desktop:1.3.0-rc.1` in a live environment, or in a custom environment that a test workflow uses.
3. `asteroid environment-snapshot get <snapshot-id>` lists the open proposals, if you need the id again.
4. Accept it with `asteroid environment-snapshot proposal accept <snapshot-id> <proposal-id>`. It is released as `1.3.0`. Bare-name pins boot it from then on. A minor pin such as `crm-desktop:1.2`, and an exact pin such as `crm-desktop:1.2.0`, stay where they are.
5. Or close it with `asteroid environment-snapshot proposal dismiss <snapshot-id> <proposal-id>`.

A proposal must change the newest version. A snapshot with no version yet cannot take one: capture its first version without `--propose`. Each proposal is a separate pre-release: a second capture with `--propose` adds `1.3.0-rc.2`, so dismiss the ones you do not keep.

## Errors

A capture error about the environment or the snapshot name starts with `environment cannot be snapshotted: `. The table leaves that prefix out. Recipe and changelog errors have no prefix.

| Status | Returned by | Message | Fix |
| - | - | - | - |
| 400 | Capture | `"linux-base" is a shared snapshot's name, so choose another display name` | Pick another `--display-name`. |
| 400 | Capture | `snapshot name must be 3 to 63 characters` | Use a longer or shorter name. |
| 400 | Capture | `snapshot name must be lowercase letters, digits, dot, dash or underscore, starting and ending with a letter or digit` | Rename it. |
| 400 | Capture | `only OS environments can be snapshotted, not browser` | Boot a Linux, Windows or Citrix environment. |
| 400 | Capture | `environment is provisioning, not ready` | Wait until the environment is ready. |
| 400 | Capture | `snapshot "crm-desktop" is built for linux, and this environment is windows` | Capture under a name of this operating system. |
| 400 | Capture | `snapshot "crm-desktop" has no version to propose an upgrade to, so capture it without propose` | Capture the first version without `--propose`. |
| 400 | Capture | `the machine booted crm-desktop 1.2.0, but 1.3.0 is newer, so boot 1.3.0 and capture again` | Boot the newest version and make the change again. |
| 400 | Capture | `The recipe is not valid: it has no "## Install" heading.` Also: `the "## Boot state" section is empty`, `it must not start with frontmatter`, or over the length limit | Fix the recipe. |
| 400 | Capture | `The changelog must be at most 500 characters.` | Shorten the changelog. |
| 403 | Capture | The plan does not include building snapshots, or this operating system. | An organization admin upgrades the plan. |
| 409 | Capture | `Another capture of snapshot "crm-desktop" is already in progress. Wait for it to finish, then try again.` | Wait, then check `environment-snapshot list` before you capture again. |
| 400 | Boot | `Snapshot "crm-desktop" has no version "1.9.0". Pin one of its listed versions, or leave the version out to boot the newest.` | Fix the pin. |
| 400 | Boot | `Snapshot "crm-desktop" boots linux, not windows. Set osType to linux, or pick a windows snapshot.` | Match `osType` to the snapshot. |
| 404 | Boot | A snapshot name that belongs to another organization. | Use a name from `environment-snapshot list`. |
| 400 | Custom environment save | `/base/config/snapshotName: snapshot "crm-desktop" is not one of your organisation's snapshots or a public one` | Use a name from `environment-snapshot list`. |

"Boot" is `environment start`, and any run that boots the snapshot.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.