# Manage server backups

> List, restore, download, lock and delete your server's backups, and learn when snapshots take their place.

Source: https://www.coritan.com/docs/managed-containers/backups/

In the dashboard:

- /dashboard/servers/…/backups: https://www.coritan.com/dashboard/servers

Snapshots have replaced backups. You cannot create a new backup, so [take a snapshot](/docs/managed-containers/snapshots/) instead: it saves the same files, and you can restore it onto a different server too. The backups a server already has keep working. The **Backups** tab lists them, and from it you can restore, download, lock and delete them.

## Before you begin

- Only servers that took backups before snapshots replaced them have any. Free servers never had backups.
- On a server someone shared with you, the owner must have given you the Backups permission.

## Restore a backup

1. In the [dashboard](https://www.coritan.com/dashboard/servers), go to **Container Apps** and open the server, then the **Backups** tab.
2. Open the menu at the end of the backup's row and select **Restore…**. Only a finished backup offers it.
3. Type the backup's name to confirm, then select **Restore backup**.

We stop the server, delete its current files and put the backup's files in their place. You lose every change made since the backup. A backup holds the server's files only, so its [databases](/docs/managed-containers/databases/) stay as they are.

## Download a backup

Open the menu at the end of the backup's row and select **Download**. The download opens in a new browser tab. The file is a `.tar.gz` archive named after the backup's ID, and the link works for 10 minutes.

## Lock or unlock a backup

Open the menu at the end of the backup's row and select **Lock**. A **Locked** badge shows beside its name, and nobody can delete it until someone selects **Unlock**.

## Delete a backup

1. Open the menu at the end of the backup's row and select **Delete backup…**. It is greyed out while the backup is locked.
2. Type the backup's name to confirm, then select **Delete backup**.

We delete the archive from storage, and you cannot undo it.

## Result

A message confirms each action, such as `Restore started.`, `Backup locked.` or `Backup deleted.` The **Status** column shows each backup's state, and a failed backup shows its error under its name.

## Troubleshooting

`Backups have been replaced by snapshots. …`
: **New backup…** still shows on the tab, but it cannot create a backup. [Take a snapshot](/docs/managed-containers/snapshots/) instead.

`A backup or restore is already in progress on this server; wait for it to finish before you restore.`
: Wait until the other restore finishes, then try again.

`Only a finished backup can be restored`
: The backup failed or never finished. Restore another backup, or a snapshot.

`Cannot restore while the server is installing`
: Wait until the server has finished installing or being moved, then try again.

`This backup failed, so there is nothing to download`
: A failed backup has no archive. Download another backup.

`Cannot delete locked backup`
: Select **Unlock** first, then delete it.

`Too many requests for this action. Please wait and try again.`
: You started more than 8 restores on this server in 5 minutes. Wait a few minutes and try again.

## Related

- [Take a server snapshot](/docs/managed-containers/snapshots/)
- [Snapshots and backups compared](/docs/snapshots/snapshots-and-backups/)
- [Restore a snapshot onto a server](/docs/snapshots/restore-a-snapshot/)

## With the API

`GET /api/v1/client/servers/{uuid}/backups` lists the server's backups. Each has `uuid`, `name`, `status`, `size_bytes`, `is_locked`, `ignored_files` and `created_at`. `status` is `completed` for a backup you can restore or download, `failed`, or `pending`, `creating`, `restoring` or `deleting` while work is under way.

`POST /api/v1/client/servers/{uuid}/backups` answers `410` with `reason` set to `replaced_by_snapshots` and `replacement` set to `snapshots`. Create a snapshot with `POST /api/v1/client/servers/{uuid}/snapshots` instead.

Restore a backup:

```bash
curl -X POST https://api.coritan.com/api/v1/client/servers/$SERVER/backups/$BACKUP/restore \
  -H "Authorization: Bearer $CORITAN_TOKEN"
```

The response is `{"message": "Restore initiated", "status": "restoring"}`.

`GET /api/v1/client/servers/{uuid}/backups/{backup_uuid}/download` returns a signed `url` to fetch the archive from, valid for `expires_in` seconds (600), with the backup's `name`, its size in `bytes`, and a `filename`.

`POST /api/v1/client/servers/{uuid}/backups/{backup_uuid}/lock` locks an unlocked backup or unlocks a locked one, and returns the backup with its new `is_locked`. `DELETE /api/v1/client/servers/{uuid}/backups/{backup_uuid}` deletes an unlocked backup.

On a server shared with you, listing needs `backup.read`, restoring needs `backup.restore`, downloading needs `backup.download`, and locking or deleting needs `backup.delete`. The Backups permission in the dashboard grants all of them.

## API

- `GET /api/v1/client/servers/{uuid}/backups`: List backups for a server (https://www.coritan.com/docs/api/reference/client/container-apps/servers-backups/#op-get-api-v1-client-servers-uuid-backups)
- `POST /api/v1/client/servers/{uuid}/backups`: Create a new backup (https://www.coritan.com/docs/api/reference/client/container-apps/servers-backups/#op-post-api-v1-client-servers-uuid-backups)
- `DELETE /api/v1/client/servers/{uuid}/backups/{backup_uuid}`: Delete a backup (https://www.coritan.com/docs/api/reference/client/container-apps/servers-backups/#op-delete-api-v1-client-servers-uuid-backups-backup-uuid)
- `GET /api/v1/client/servers/{uuid}/backups/{backup_uuid}/download`: A short-lived signed URL the browser fetches the archive from directly (https://www.coritan.com/docs/api/reference/client/container-apps/servers-backups/#op-get-api-v1-client-servers-uuid-backups-backup-uuid-download)
- `POST /api/v1/client/servers/{uuid}/backups/{backup_uuid}/lock`: Keep a backup, or release it (https://www.coritan.com/docs/api/reference/client/container-apps/servers-backups/#op-post-api-v1-client-servers-uuid-backups-backup-uuid-lock)
- `POST /api/v1/client/servers/{uuid}/backups/{backup_uuid}/restore`: Restore from a backup (https://www.coritan.com/docs/api/reference/client/container-apps/servers-backups/#op-post-api-v1-client-servers-uuid-backups-backup-uuid-restore)
