---
title: Creating backups of Instances via the Scaleway API
description: This page explains how to create backups of your Instances using the Scaleway API
tags: instance create backup scaleway-api
dates:
  validation: 2025-05-28
  posted: 2021-05-26
---
import Requirements from '@macros/iam/requirements.mdx'


The Backup feature is used to back up your Instance data. It creates an image of a snapshot that contains all your volumes. You can create backups of your Instances using either the [Scaleway CLI tool](/scaleway-cli/quickstart/) or the [Instances API](https://www.scaleway.com/en/developers/api/instances/).

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- A valid [API key](/iam/how-to/create-api-keys/)
- A running Instance

## Creating a backup

<Tabs>

  <TabsTab label="CLI">
    Use the following commands to create a backup of your Instance using the [Scaleway CLI](/scaleway-cli/quickstart/).
    ```bash
    scw instance server backup server-id zone=fr-par-1
    ```
    <Message type="note">
      * Replace `server-id` with the unique identifier of the Instance.
      * Replace `fr-par-1` with the Availability Zone your Instance is deployed in.
    </Message>
    <Message type="tip">
      By default, the name of the image is built according to the name of the server and the date. You can specify a name for the image in the request:
      ```bash
      scw instance server backup <server-id> zone=fr-par-1 name=<my-image-name>
      ```
    </Message>
    A backup request will create an image object. You can view it using:
    ```bash
    scw instance image get <image-uid> zone=fr-par-1
    ```
    An image contains one snapshot for each volume of the Instance. These snapshots are visible within the image response as `root_volume` and `extra_volumes` fields.
  </TabsTab>

  <TabsTab label="API">
    A backup is created using the [Instances API](https://www.scaleway.com/en/developers/api/instances/) with the following command:
    ```
    POST https://api.scaleway.com/instance/v1/zones/<region>/servers/<uid>/action
    {"action":"backup"}
    ```
    Replace `<region>` with the geographical region of the Instance. For Instances located in Paris, for example, this value would be `fr-par-1`. Replace `<uid>` with the unique identifier of the Instance.
    By default, the name of the image is built according to the name of the server and the date:
    ```
    image_<servername>_YYYY-MM-DD_hh-mm.
    ```
    Alternatively, you can specify a name for the image in the request:
    ```
    POST https://api.scaleway.com/instance/v1/zones/<region>/servers/<id>/action
    { "action":"backup", "name":"myimagename" }
    ```
    A backup request will create an image object (visible in the `href_result`: `/images/<image_uuid>`)
    ```
    GET https://api.scaleway.com/instance/v1/zones/<region>/images/<image_uid>
    ```
    An image contains one snapshot for each volume of the Instance. These snapshots are visible within the image response, as `root_volume` and `extra_volumes` fields.
  </TabsTab>
</Tabs>

## Deleting a Backup
<Tabs>

  <TabsTab label="CLI">
    To delete a backup, run the following command:
    ```bash
    scw instance image delete <image-uid> zone=fr-par1
    ```
    It is also recommended to remove every snapshot related to the image by running the following command for each snapshot that is no longer needed:
    ```bash
    scw block snapshot delete <snapshot-uid> zone=fr-par-1
    ```
  </TabsTab>

  <TabsTab label="API">
    Run the following call to delete the image that contains a backup:
    ```
    curl -X DELETE \
      -H "X-Auth-Token: $SCW_SECRET_KEY" \
      "https://api.scaleway.com/instance/v1/zones/{zone}/images/{image_id}"
    ```
    It is also recommended to remove every snapshot related to the image by running the following API call for each snapshot that is no longer needed:
    ```
    curl -X DELETE \
      -H "X-Auth-Token: $SCW_SECRET_KEY" \
      "https://api.scaleway.com/block/v1/zones/{zone}/snapshots/{snapshot_id}"
    ```
  </TabsTab>
</Tabs>

