---
title: "Take a snapshot and keep it"
url: https://docs.corefinity.com/api/recipes/take-a-snapshot
type: page
last_updated: 2026-11-13
feature: recipe-take-a-snapshot
---
# Take a snapshot and keep it

Take a snapshot of a site before a change, wait until it is ready and keep it from expiring.

A snapshot copies one environment's files and database. This recipe takes one of the site `harbourandfinch.example.com` and keeps it.

## Before you start

- A token with the `read` and `write` [scopes](/api/scopes).
- Every step needs [two-factor enrolment](/api/two-factor) when your company requires it.
- No step waits for a maintenance window.

1. **Take the snapshot**

   `note` is optional and holds up to 140 characters.

   ```bash
   curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/snapshots \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{"note": "Before the theme change"}'
   ```

   The answer is `201` with the snapshot. Note its `id`; its `status` is `pending` or `creating`.

2. **Wait until it is ready**

   A snapshot is read on its own endpoint, not on the operations endpoint. Read it every few seconds until `status` is `ready` or `failed`.

   ```bash
   curl https://manage.corefinity.com/api/corestack/snapshots/3301 \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

3. **Keep it**

   A kept snapshot stays until you stop keeping it. The answer is `200` with the snapshot as it is now.

   ```bash
   curl -X PATCH https://manage.corefinity.com/api/corestack/snapshots/3301 \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{"protected": true}'
   ```

4. **Check the list**

   The site's list shows the snapshot with `protected: true`, and `settings.manual_remaining_this_hour` shows how many more you can take this hour.

   ```bash
   curl https://manage.corefinity.com/api/corestack/sites/1042/snapshots \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

## If it is refused

| Status | `reason`           | What to do                                                                                  |
| ------ | ------------------ | ------------------------------------------------------------------------------------------- |
| `409`  | `in_flight`        | A snapshot is already being taken. Wait for it                                              |
| `409`  | `restoring`        | A restore is running. Wait for it to finish                                                 |
| `429`  | `manual_cap`       | 20 one-off snapshots were taken of this site in the last hour. Try again later              |
| `429`  | `google_cap`       | The hourly limit of all snapshots of the site was reached. Try again later                  |
| `422`  | `disabled`         | Snapshots are not enabled where the site runs                                               |
| `422`  | `state`            | The snapshot cannot be kept yet: it is not ready, or its size is not known. Do step 2 first |
| `422`  | `keep_cap_reached` | Kept snapshots already use your whole keep allowance. Stop keeping another snapshot first   |

To stop keeping a snapshot, send `{"protected": false}`. Deleting one needs the `destructive` scope.
