# Take a snapshot

`POST https://console.advinservers.com/api/v1/client/servers/{server}/snapshots`

### Overview

Creates a snapshot in the background. Send a `name` of 1 to 40 characters and the UUID of the `snapshot_storage` to store it in. You can leave out the storage when the team has exactly one usable storage. The storage must not be full, suspended or ended. The request is refused while a backup or migration of the server is running. The initial response has `completed_at` set to null. The snapshot is ready when `completed_at` is set and `is_successful` is true, and its size then counts against the storage.

### Permissions

Requires the `snapshot.create` (Take snapshots) permission for the selected team. Resources outside that team return 404.

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Path parameters

- `server` (string, required): The server uuid short

## Body

Sent as `application/json`.

- `name` (string, required): The name shown to customers. 1 to 40 characters
- `snapshot_storage` (string<uuid> | null): The value of `snapshot_storage`.

## Response 200

The record, as a JSON object. There is no envelope.

- `uuid` (string, required): The uuid UUID.
- `uuid_short` (string, required): The value of `uuid_short`.
- `name` (string, required): The name shown to customers.
- `status` (string, required): The state as the customer reads it, including a suspension of the storage holding the snapshot. One of: `creating`, `available`, `failed`, `unavailable`, `suspended`, `restoring`.
- `is_successful` (boolean, required): Whether the resource is successful.
- `is_available` (boolean, required): Whether the resource is available.
- `size` (integer | null, required): The value of `size`.
- `disk_allocated` (integer | null, required): What the VM's disk was provisioned at when the snapshot was taken.
- `disk_used` (integer | null, required): How much of that disk is in use on the VM right now.
- `completed_at` (string<date-time> | null, required): The date and time for completed at, in UTC.
- `created_at` (string<date-time> | null, required): The date and time for created at, in UTC.
- `server` (object | null, required): The machine it was taken of, while that machine exists and is still the same account's. A snapshot outlives its server, and one moved to another account with its storage does not reveal the seller's machine.
  - `uuid` (string, required): The uuid UUID.
  - `uuid_short` (string, required): The value of `uuid_short`.
  - `name` (string, required): The name shown to customers.
  - `windows` (boolean, required): The value of `windows`.
  - `template_name` (string | null, required): The value of `template_name`.
  - `template_icon_url` (string | null, required): The value of `template_icon_url`.
- `server_name` (string | null, required): What the machine was called when the snapshot was taken.
- `storage` (object | null, required): The snapshot storage holding it and paying for it.
  - `uuid` (string, required): The uuid UUID.
  - `uuid_short` (string, required): The value of `uuid_short`.
  - `name` (string, required): The name shown to customers.
  - `is_suspended` (boolean, required): Whether the resource is suspended.

```json
{
  "uuid": "c9380e36-eaa8-4391-a443-85f9dfb5a16b",
  "uuid_short": "Uuid short",
  "name": "Before anti-mass spectrometer run",
  "status": "creating",
  "is_successful": false,
  "is_available": true,
  "size": 0,
  "disk_allocated": 85899345920,
  "disk_used": null,
  "completed_at": null,
  "created_at": "2026-09-14T16:42:09.000000Z",
  "server": {
    "uuid": "ecc6f4f1-c89b-4dce-a20b-a330641c5b0b",
    "uuid_short": "ecc6f4f1",
    "name": "lambda-core",
    "windows": false,
    "template_name": "Ubuntu 24.04",
    "template_icon_url": "/assets/icons/ubuntu.png"
  },
  "server_name": "lambda-core",
  "storage": {
    "uuid": "9e83397b-d88e-43ae-bfb7-a8c2e6eda853",
    "uuid_short": "Uuid short",
    "name": "Storage 1",
    "is_suspended": false
  }
}
```

## Errors

- `400`: The storage is full, suspended or not active, no storage was named and the team does not have exactly one, or this location cannot take snapshots.
- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `404`: The resource was not found in the selected team. Resources in another account or team also return 404.
- `409`: The server is suspended, installing or busy with another operation. The message explains why.
- `422`: A field is missing or invalid, or the resource cannot accept this change in its current state. Check `message` for details. Field validation also includes an `errors` object keyed by field name.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.

## Example request

```bash
curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/servers/{server}/snapshots' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Before anti-mass spectrometer run",
  "snapshot_storage": "9e83397b-d88e-43ae-bfb7-a8c2e6eda853"
}'
```
