# How snapshot storage works

> How your account's snapshot allowance is worked out, what counts against it and what happens when you go over it.

Source: https://www.coritan.com/docs/snapshots/storage-allowance/

In the dashboard:

- /dashboard/snapshots: https://www.coritan.com/dashboard/snapshots

Your account has one *snapshot allowance*: the most that all your snapshots together may take up. The snapshots of every server count against it, including servers you have deleted. The **Snapshot storage** card on the [Snapshots](https://www.coritan.com/dashboard/snapshots) page, and on each server's **Snapshots** tab, shows how much is **Used** and how much is left.

## Where the allowance comes from

The allowance is the sum of what your services include:

- Each server plan includes an allowance. A plan with no figure of its own includes twice its disk by default, and a free server includes room for one snapshot ([How free servers work](/docs/managed-containers/free-servers/)). The order page does not show a plan's allowance, but `breakdown` in the API's answer lists what each of your services adds ([With the API](#with-the-api)).
- Each snapshot storage service adds its size ([Order more snapshot storage](/docs/snapshots/add-snapshot-storage/)).
- We can add a bonus to your account. The card then says so under its title, such as `Includes a 10.0 GB bonus.`

A service counts while it is active, while it is suspended and while we remove it. It stops counting when it ends. An order that waits for its first payment adds nothing yet. Other products, such as Cloud Compute instances, add nothing.

The allowance belongs to the account, so it changes with your services. A move to a smaller plan lowers it, and ordering a server or storage raises it.

## What counts against it

Each snapshot counts at its size once it is `Completed`, and keeps counting until it is deleted. The size is the compressed archive, which is usually smaller than the server's disk usage. A snapshot counts the same whoever took it: you, a schedule or us. A failed snapshot counts nothing, and a deleted one stops counting at once.

## Before a snapshot is taken

We check that a new snapshot fits before we take it. The check uses the server's current disk usage, which is usually more than the finished archive needs. When we cannot measure the disk, the check uses the plan's full disk.

The **Take snapshot…** dialog shows the estimate against what is left, and **Not enough snapshot storage** when it does not fit. The API answers `402` with a message such as `This snapshot needs 3.2 GiB and your plan includes 20 GiB, of which 18.5 GiB is already in use. Delete an older snapshot or add snapshot storage.` ([Take a server snapshot](/docs/managed-containers/snapshots/)).

We check once more when the archive is ready, with its real size. If it no longer fits, because the allowance shrank or another snapshot finished first, the snapshot fails.

A schedule makes room for its next snapshot by deleting the oldest snapshots it took of the same server. It never deletes a locked snapshot, or one that you, another schedule or we took ([Schedule server tasks](/docs/managed-containers/schedules/)).

Snapshots we take for you before we remove a server skip the check, so that we can save the server even when the account is full. They count against the allowance once they complete ([Snapshots we take for you](/docs/snapshots/snapshots-and-backups/#snapshots-we-take-for-you)).

## When the account is over

The account can go over when the allowance shrinks, or when a snapshot we take for you does not fit. The allowance shrinks when you move a server to a smaller plan, and when a server or a snapshot storage service ends. From then on:

- The **Snapshot storage** card shows **Over the allowance**, with the date the cleanup starts.
- New snapshots are refused until the account fits again, and so are a schedule's, unless it can make room from its own snapshots.
- The cleanup date is 30 days after the account went over, by default. For an account that has no allowance left and has never paid us, it is 14 days.

We email you before the cleanup date:

| When | Subject |
| --- | --- |
| At our daily check after the account goes over | `Free up snapshot space by` the cleanup date, or `We're keeping your saved worlds until` the cleanup date when the account has no allowance left |
| A week before the cleanup date | `Reminder: your oldest snapshots go on` the cleanup date |
| A day before the cleanup date | The same reminder |

Each email names the snapshots we would delete if nothing changes.

From the cleanup date, our daily check deletes `Completed` snapshots until the rest fit, and no more. It takes the oldest first, and every unlocked snapshot before a locked one, so a lock does not keep a snapshot past the cleanup. It never deletes a snapshot that we put on hold. We then email you with the subject `2 older snapshot(s) removed`, with the number we deleted, and the names of the snapshots.

> [!CAUTION]
> We cannot recover a snapshot that the cleanup deleted. Download the snapshots you want to keep before the cleanup date ([Download a snapshot](/docs/snapshots/manage-snapshots/#download-a-snapshot)).

As soon as the account fits again, we cancel the cleanup date. Delete snapshots you no longer need, order snapshot storage, move to a larger plan or order a server. If the account goes over again later, a new full grace period starts. To keep your snapshots for longer, [contact support](/docs/support/conversations/): we can pause the cleanup for your account, and we send no reminders while it is paused.

## With the API

`GET /api/v1/client/snapshots/allowance` returns the figures the **Snapshot storage** card shows, worked out at the moment you ask.

```bash
curl https://api.coritan.com/api/v1/client/snapshots/allowance \
  -H "Authorization: Bearer $CORITAN_TOKEN"
```

```json
{
  "allowance_bytes": 139586437120,
  "used_bytes": 1932735283,
  "available_bytes": 137653701837,
  "bonus_bytes": 0,
  "over": false,
  "cleanup_at": null,
  "over_since": null,
  "breakdown": [
    {"service_id": 1042, "status": "active", "product": "CX4", "allowance_bytes": 85899345920},
    {"service_id": 1077, "status": "active", "product": "Snapshot Storage 50 GB", "allowance_bytes": 53687091200}
  ]
}
```

`allowance_bytes`
: The whole allowance: what your services include, plus `bonus_bytes`.

`used_bytes` and `available_bytes`
: What your snapshots take up, and what is left. `available_bytes` is never below `0`.

`over`
: `true` while your snapshots take more than the allowance.

`over_since` and `cleanup_at`
: When the account went over, and when the cleanup starts, in UTC. Both are `null` while the account fits.

`breakdown`
: One entry for each service that is active, suspended or being removed, with its `service_id`, `status`, `product` name and the `allowance_bytes` it adds. A service that includes no snapshot storage adds `0`.

## API

- `GET /api/v1/client/snapshots/allowance`: The account's snapshot meter (https://www.coritan.com/docs/api/reference/client/container-apps/snapshots/#op-get-api-v1-client-snapshots-allowance)
