openapi: 3.0.0
info:
  title: Block Storage API
  description: |-
    Scaleway Block Storage provides network-attached storage that can be plugged in and out of cloud products such as Instances like a virtual hard-drive. Block Storage devices are independent from the local storage of Instances, and the fact that they are accessed over a network connection makes it easy to move them between Instances in the same Availability Zone.

    (switchcolumn)
    <Message type="important">
    This page includes the API reference documentation for all Block Storage Low Latency offers. If you wish to use the Basic Block Storage offers, refer to the [Instances API documentation page](/api/instance/#path-volume-types-list-volume-types).
    </Message>
    (switchcolumn)

    ## Quickstart

    1. Configure your environment variables.

       <Message type="note">
       This is an optional step that seeks to simplify your usage of the Block Storage API. See [Availability Zones](#availability-zones) below for help choosing an Availability Zone. You can find your Project ID in the [Scaleway console](https://console.scaleway.com/project/settings).
       </Message>

       ```bash
       export SCW_SECRET_KEY="<API secret key>"
       export SCW_DEFAULT_ZONE="<Scaleway Availability Zone>"
       export SCW_PROJECT_ID="<Scaleway Project ID>"
       ```

       <Message type="important">
       Make sure that the Availability Zone (AZ) is the same as the one of your Instance. Block volumes can only be attached to Instances in the same AZ.
       </Message>

    2. Edit the POST request payload you will use to create your Block volume. Replace the parameters in the following example:

       ```json
         '{
         "project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826",
         "name": "my-volume",
         "perf_iops": "5000",
         "tags": ["donnerstag"],
         "from_empty": {
            "size": "30000000000"}
         }'
       ```

       | Parameter    | Description                                                                                                                                                                                                                                                                                                                                                                          |
       | :----------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
       | `project_id` | **REQUIRED** The ID of the Project you want to create your Block volume in. To find your Project ID you can **[list the projects](/api/account#path-projects-list-all-projects-of-an-organization)** or consult the **[Scaleway console](https://console.scaleway.com/project/settings)**.                                                                                           |
       | `name`       | **REQUIRED** Name of the volume                                                                                                                                                                                                                                                                                                                                                      |
       | `perf_iops`  | **REQUIRED** The maximum IO/s expected. This amount is a shared limit between write and read operations, it will be determined by your usage. You must specify either `5000`, or `15000`.                                                                                                                                                                                                                                     |
       | `tags`       | The list of tags `["tag1", "tag2", ...]` that will be associated with the Database Instance. Tags can be appended to the query of the [List Database Instances](#path-database-instances-list-database-instances) call to show results for only the Database Instances using a specific tag. You can also combine tags to list Database Instances that posess all the appended tags. |
       | `from_empty` | When you create a brand new volume, as opposed to creating a volume from a snapshot, you must specifiy its size.                                                                                                                                                                                                                                                                     |
       | `size`       | Volume size. The value should be expressed in bytes. For example 30GB is expressed as 30000000000                                                                                                                                                                                                                                                                                    |

    3. Create a Block volume by running the following command. Make sure you include the payload you edited in the previous step.

       ```bash
       curl -X POST \
         -H "X-Auth-Token: $SCW_SECRET_KEY" \
         "Content-Type: application/json" \
         https://api.scaleway.com/block/v1alpha1/zone/$SCW_DEFAULT_ZONE/volumes \
         -d '{
              "project_id": "'"$SCW_PROJECT_ID"'",
              "name": "my-volume",
              "perf_iops": "5000",
              "tags": ["donnerstag"],
              "from_empty": {
                  "size": "30000000000"}
            }'
       ```

       An output similar to the following displays :

       ```json
       '{
          "id": "e337a374-f19a-4b58-a45d-75076f75fbc5",
          "name": "my-volume",
          "type": "sbs_5k",
          "size": 30000000000,
          "project_id": "d8e65f2b-cce9-40b7-80fc-6a2902db6826",
          "created_at": "2023-09-28T15:48:59.105240Z",
          "updated_at": "2023-09-28T15:48:59.105240Z",
          "references": [],
          "parent_snapshot_id": None,
          "status": "creating",
          "tags": [],
          "specs": {"perf_iops": 5000, "class": "sbs"},
          "zone": "fr-par-1"
          }'
       ```

        <Message type="note">
          Make sure to save the `id` of your volume, as it will be required in the next step.
        </Message>

    4. Attach your volume to your Instance using the Instance API [Update an Instance](/api/instance/#path-instances-update-an-instance) call.

        <Message type="note">
          Make sure the Block volume is created and ready before attaching it to the Instance.
        </Message>

        <Message type="important">
          Make sure you include all your Instance's existing volumes in the payload, as the update can only be done to all or none of the volumes.

          The payload should include a minimum of one key (`"0"`) with a value equivalent to the setting parameters for the volume.
          Additional keys for additional volumes should increment by 1 each time. For example, the second volume is `"1"`, the third `"2"`, and so on.
        </Message>

       ```bash
       curl -X PATCH \
         -H "X-Auth-Token: $SCW_SECRET_KEY" \
         "Content-Type: application/json" \
         https://api.scaleway.com/instance/v1/zone/$SCW_DEFAULT_ZONE/servers/$INSTANCE_ID \
         -d '{
             "volumes": {
                "0": {
                   "boot": false,
                   "id": "571c8a17-ba68-4c1d-b137-bbd5bc7af104",
                   "volume_type": "System volume"
                }
                "1": {
                   "boot": false,
                   "id": "e337a374-f19a-4b58-a45d-75076f75fbc5",
                   "volume_type": "sbs_volume"
                }
             }'
       ```

    Your Block volume is ready to be used with your Instance.

    Refer to the [How to mount and use your Block volume](https://www.scaleway.com/en/docs/storage/block/how-to/mount-and-use-volume/) documentation page to do so.

    (switchcolumn)
    <Message type="requirement">
    To perform the following steps, you must first ensure that:

    - you have an account and are logged into the [Scaleway console](https://console.scaleway.com/organization)
    - you have created an [API key](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) and that the API key has sufficient [IAM permissions](https://www.scaleway.com/en/docs/identity-and-access-management/iam/reference-content/permission-sets/) to perform the actions described on this page.
    - you have [installed `curl`](https://curl.se/download.html)
    - you have [created an Instance](/instance/#path-instances-create-an-instance).
    </Message>
    (switchcolumn)

    ## Going further

    For further information and assitance for Scaleway Block Storage, check out the following resources:

    - [Basic Block Storage Documentation](https://www.scaleway.com/en/docs/storage/block/)
    - [#block channel in the Scaleway Slack Community](scaleway-community.slack.com)
    - [How to open a support ticket](https://www.scaleway.com/en/docs/console/my-account/how-to/open-a-support-ticket/).
  version: v1alpha1
servers:
- url: https://api.scaleway.com
tags:
- name: Volume Type
  description: |
    Block Storage volume types are determined by their storage class and their IOPS. There are two storage classes available: `bssd` and `sbs`. The IOPS can be chosen for volumes of the `sbs` storage class
- name: Volume
  description: |
    A Block Storage volume is a logical storage drive on a network-connected storage system. It is exposed to Instances as if it were a physical disk, and can be attached and detached like a hard drive. Several Block volumes can be attached to one Instance at a time

    Block volumes can be snapshotted, mounted or unmounted
- name: Snapshot
  description: |
    A Block Storage snapshot is a read-only picture of a Block volume, taken at a specific time
    You can then revert your data to the previous snapshot. You can also create a new read/write Block volume from a previous snapshot
components:
  schemas:
    scaleway.block.v1alpha1.ListSnapshotsResponse:
      type: object
      properties:
        snapshots:
          type: array
          description: Paginated returned list of snapshots.
          items:
            $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
        total_count:
          type: integer
          description: Total number of snpashots in the project.
          format: uint64
      x-properties-order:
      - snapshots
      - total_count
    scaleway.block.v1alpha1.ListVolumeTypesResponse:
      type: object
      properties:
        volume_types:
          type: array
          description: Returns paginated list of volume-types.
          items:
            $ref: '#/components/schemas/scaleway.block.v1alpha1.VolumeType'
        total_count:
          type: integer
          description: Total number of volume-types currently available in stock.
          format: uint64
      x-properties-order:
      - volume_types
      - total_count
    scaleway.block.v1alpha1.ListVolumesResponse:
      type: object
      properties:
        volumes:
          type: array
          description: Paginated returned list of volumes.
          items:
            $ref: '#/components/schemas/scaleway.block.v1alpha1.Volume'
        total_count:
          type: integer
          description: Total number of volumes in the project.
          format: uint64
      x-properties-order:
      - volumes
      - total_count
    scaleway.block.v1alpha1.Reference:
      type: object
      properties:
        id:
          type: string
          description: UUID of the reference. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
        product_resource_type:
          type: string
          description: Type of resource to which the reference is associated.
        product_resource_id:
          type: string
          description: UUID of the product resource it refers to (according to the
            product_resource_type). (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
        created_at:
          type: string
          description: Creation date of the reference. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        type:
          type: string
          description: Type of reference (link, exclusive, read_only).
          enum:
          - unknown_type
          - link
          - exclusive
          - read_only
          x-enum-descriptions:
            values:
              unknown_type: If unspecified, the reference type is unknown by default
              link: Reference linked to a snapshot (for snapshots only)
              exclusive: Exclusive reference that can be associated to a volume (for
                volumes only)
              read_only: Access to the volume or snapshot in a read-only mode, without
                storage write access to the resource
          default: unknown_type
        status:
          type: string
          description: Status of the reference. Statuses include `attaching`, `attached`,
            and `detaching`.
          enum:
          - unknown_status
          - attaching
          - attached
          - detaching
          - detached
          - creating
          - error
          x-enum-descriptions:
            values:
              unknown_status: If unspecified, the status of the reference is unknown
                by default
              attaching: When the reference is being attached (transient)
              attached: When the reference attached to a volume
              detaching: When the reference is being detached (transient)
              detached: When the reference is detached from a volume - the reference
                ceases to exist
              creating: Reference under creation which can be rolled back if an error
                occurs (transient)
              error: Error status
          default: unknown_status
      x-properties-order:
      - id
      - product_resource_type
      - product_resource_id
      - created_at
      - type
      - status
    scaleway.block.v1alpha1.Snapshot:
      type: object
      properties:
        id:
          type: string
          description: UUID of the snapshot. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
        name:
          type: string
          description: Name of the snapshot.
        parent_volume:
          type: object
          description: |-
            Information about the parent volume.
            If the parent volume was deleted, value is null.
          properties:
            id:
              type: string
              description: Parent volume UUID (volume from which the snapshot originates).
                (UUID format)
              example: 6170692e-7363-616c-6577-61792e636f6d
            name:
              type: string
              description: Name of the parent volume.
            type:
              type: string
              description: Volume type of the parent volume.
            status:
              type: string
              description: Current status the parent volume.
              enum:
              - unknown_status
              - creating
              - available
              - in_use
              - deleting
              - deleted
              - resizing
              - error
              - snapshotting
              - locked
              - updating
              x-enum-descriptions:
                values:
                  unknown_status: If unspecified, the volume status is unknown by
                    default
                  creating: The volume is under creation (transient)
                  available: The volume exists and is not attached to any reference
                  in_use: The volume exists and is already attached to a reference
                  deleting: The volume undergoing deletion (transient)
                  resizing: The volume is being increased (transient)
                  error: The volume is an error status
                  snapshotting: The volume is undergoing snapshotting operation (transient)
                  updating: The volume is being updated (transient)
              default: unknown_status
          x-properties-order:
          - id
          - name
          - type
          - status
        size:
          type: integer
          description: Size in bytes of the snapshot. (in bytes)
          format: uint64
        project_id:
          type: string
          description: UUID of the project the snapshot belongs to. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
        created_at:
          type: string
          description: Creation date of the snapshot. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        updated_at:
          type: string
          description: Last modification date of the properties of a snapshot. (RFC
            3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        references:
          type: array
          description: List of the references to the snapshot.
          items:
            $ref: '#/components/schemas/scaleway.block.v1alpha1.Reference'
        status:
          type: string
          description: Current status of the snapshot (available, in_use, ...).
          enum:
          - unknown_status
          - creating
          - available
          - error
          - deleting
          - deleted
          - in_use
          - locked
          - exporting
          x-enum-descriptions:
            values:
              unknown_status: If unspecified, the snapshot status is unknown by default
              creating: The snapshot is under creation (transient)
              available: Snapshot exists and is not attached to any reference
              error: Snapshot in an error status
              deleting: Snapshot is being deleted (transient)
              deleted: Snapshot was deleted
              in_use: Snapshot attached to one or more references
          default: unknown_status
        tags:
          type: array
          description: List of tags assigned to the volume.
          items:
            type: string
        zone:
          type: string
          description: Snapshot zone.
        class:
          type: string
          description: Storage class of the snapshot.
          enum:
          - unknown_storage_class
          - unspecified
          - bssd
          - sbs
          x-enum-descriptions:
            values:
              unknown_storage_class: If unspecified, the Storage Class is unknown
                by default
              unspecified: No specific Storage Class selected
              bssd: Classic storage
              sbs: Performance storage with lower latency
          default: unknown_storage_class
      x-properties-order:
      - id
      - name
      - parent_volume
      - size
      - project_id
      - created_at
      - updated_at
      - references
      - status
      - tags
      - zone
      - class
    scaleway.block.v1alpha1.Volume:
      type: object
      properties:
        id:
          type: string
          description: UUID of the volume. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
        name:
          type: string
          description: Name of the volume.
        type:
          type: string
          description: Volume type.
        size:
          type: integer
          description: Volume size in bytes. (in bytes)
          format: uint64
        project_id:
          type: string
          description: UUID of the project to which the volume belongs. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
        created_at:
          type: string
          description: Creation date of the volume. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        updated_at:
          type: string
          description: Last update of the properties of a volume. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
        references:
          type: array
          description: List of the references to the volume.
          items:
            $ref: '#/components/schemas/scaleway.block.v1alpha1.Reference'
        parent_snapshot_id:
          type: string
          description: When a volume is created from a snapshot, is the UUID of the
            snapshot from which the volume has been created. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
          nullable: true
        status:
          type: string
          description: Current status of the volume (available, in_use, ...).
          enum:
          - unknown_status
          - creating
          - available
          - in_use
          - deleting
          - deleted
          - resizing
          - error
          - snapshotting
          - locked
          - updating
          x-enum-descriptions:
            values:
              unknown_status: If unspecified, the volume status is unknown by default
              creating: The volume is under creation (transient)
              available: The volume exists and is not attached to any reference
              in_use: The volume exists and is already attached to a reference
              deleting: The volume undergoing deletion (transient)
              resizing: The volume is being increased (transient)
              error: The volume is an error status
              snapshotting: The volume is undergoing snapshotting operation (transient)
              updating: The volume is being updated (transient)
          default: unknown_status
        tags:
          type: array
          description: List of tags assigned to the volume.
          items:
            type: string
        zone:
          type: string
          description: Volume zone.
        specs:
          type: object
          description: Specifications of the volume.
          properties:
            perf_iops:
              type: integer
              description: The maximum IO/s expected, according to the different options
                available in stock (`5000 | 15000`).
              format: uint32
              nullable: true
            class:
              type: string
              description: The storage class of the volume.
              enum:
              - unknown_storage_class
              - unspecified
              - bssd
              - sbs
              x-enum-descriptions:
                values:
                  unknown_storage_class: If unspecified, the Storage Class is unknown
                    by default
                  unspecified: No specific Storage Class selected
                  bssd: Classic storage
                  sbs: Performance storage with lower latency
              default: unknown_storage_class
          x-properties-order:
          - perf_iops
          - class
        last_detached_at:
          type: string
          description: Last time the volume was detached. (RFC 3339 format)
          format: date-time
          example: "2022-03-22T12:34:56.123456Z"
          nullable: true
      x-properties-order:
      - id
      - name
      - type
      - size
      - project_id
      - created_at
      - updated_at
      - references
      - parent_snapshot_id
      - status
      - tags
      - zone
      - specs
      - last_detached_at
    scaleway.block.v1alpha1.VolumeType:
      type: object
      properties:
        type:
          type: string
          description: Volume type.
        pricing:
          type: object
          description: Price of the volume billed in GB/hour.
          properties:
            currency_code:
              type: string
            units:
              type: integer
              format: int64
            nanos:
              type: integer
              format: int32
          x-properties-order:
          - currency_code
          - units
          - nanos
        snapshot_pricing:
          type: object
          description: Price of the snapshot billed in GB/hour.
          properties:
            currency_code:
              type: string
            units:
              type: integer
              format: int64
            nanos:
              type: integer
              format: int32
          x-properties-order:
          - currency_code
          - units
          - nanos
        specs:
          type: object
          description: Volume specifications of the volume type.
          properties:
            perf_iops:
              type: integer
              description: The maximum IO/s expected, according to the different options
                available in stock (`5000 | 15000`).
              format: uint32
              nullable: true
            class:
              type: string
              description: The storage class of the volume.
              enum:
              - unknown_storage_class
              - unspecified
              - bssd
              - sbs
              x-enum-descriptions:
                values:
                  unknown_storage_class: If unspecified, the Storage Class is unknown
                    by default
                  unspecified: No specific Storage Class selected
                  bssd: Classic storage
                  sbs: Performance storage with lower latency
              default: unknown_storage_class
          x-properties-order:
          - perf_iops
          - class
      x-properties-order:
      - type
      - pricing
      - snapshot_pricing
      - specs
  securitySchemes:
    scaleway:
      in: header
      name: X-Auth-Token
      type: apiKey
paths:
  /block/v1alpha1/zones/{zone}/snapshots:
    get:
      tags:
      - Snapshot
      operationId: ListSnapshots
      summary: List all snapshots
      description: List all available snapshots in a specified zone. By default, the
        snapshots listed are ordered by creation date in ascending order. This can
        be modified via the `order_by` field.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: query
        name: order_by
        description: Criteria to use when ordering the list.
        schema:
          type: string
          description: Criteria to use when ordering the list.
          enum:
          - created_at_asc
          - created_at_desc
          - name_asc
          - name_desc
          x-enum-descriptions:
            values:
              created_at_asc: Order by creation date (ascending chronological order)
              created_at_desc: Order by creation date (descending chronological order)
              name_asc: Order by name (ascending order)
              name_desc: Order by name (descending order)
          default: created_at_asc
      - in: query
        name: project_id
        description: Filter by Project ID.
        schema:
          type: string
          description: Filter by Project ID.
      - in: query
        name: organization_id
        description: Filter by Organization ID.
        schema:
          type: string
          description: Filter by Organization ID.
      - in: query
        name: page
        description: Page number.
        schema:
          type: integer
          description: Page number.
          format: int32
      - in: query
        name: page_size
        description: Page size, defines how many entries are returned in one page,
          must be lower or equal to 100.
        schema:
          type: integer
          description: Page size, defines how many entries are returned in one page,
            must be lower or equal to 100.
          format: uint32
          default: "50"
      - in: query
        name: volume_id
        description: Filter snapshots by the ID of the original volume.
        schema:
          type: string
          description: Filter snapshots by the ID of the original volume.
      - in: query
        name: name
        description: Filter snapshots by their names.
        schema:
          type: string
          description: Filter snapshots by their names.
      - in: query
        name: tags
        description: Filter by tags. Only snapshots with one or more matching tags
          will be returned.
        schema:
          type: array
          description: Filter by tags. Only snapshots with one or more matching tags
            will be returned.
          items:
            type: string
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.ListSnapshotsResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots" \
            X-Auth-Token:$SCW_SECRET_KEY
    post:
      tags:
      - Snapshot
      operationId: CreateSnapshot
      summary: Create a snapshot of a volume
      description: |-
        To create a snapshot, the volume must be in the `in_use` or the `available` status.
        If your volume is in a transient state, you need to wait until the end of the current operation.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                volume_id:
                  type: string
                  description: UUID of the volume to snapshot.
                name:
                  type: string
                  description: Name of the snapshot.
                project_id:
                  type: string
                  description: UUID of the project to which the volume and the snapshot
                    belong.
                tags:
                  type: array
                  description: List of tags assigned to the snapshot.
                  items:
                    type: string
              x-properties-order:
              - volume_id
              - name
              - project_id
              - tags
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "name": "string",
              "project_id": "string",
              "volume_id": "string"
            }' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots" \
            X-Auth-Token:$SCW_SECRET_KEY \
            name="string" \
            project_id="string" \
            volume_id="string"
  /block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}:
    get:
      tags:
      - Snapshot
      operationId: GetSnapshot
      summary: Get a snapshot
      description: Retrieve technical information about a specific snapshot. Details
        such as size, volume type, and status are returned in the response.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: snapshot_id
        description: UUID of the snapshot.
        required: true
        schema:
          type: string
          description: UUID of the snapshot.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    patch:
      tags:
      - Snapshot
      operationId: UpdateSnapshot
      summary: Update a snapshot
      description: Update the name or tags of the snapshot.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: snapshot_id
        description: UUID of the snapshot.
        required: true
        schema:
          type: string
          description: UUID of the snapshot.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: When defined, is the name of the snapshot.
                  nullable: true
                tags:
                  type: array
                  description: List of tags assigned to the snapshot.
                  nullable: true
                  items:
                    type: string
              x-properties-order:
              - name
              - tags
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X PATCH \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{}' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}"
      - lang: HTTPie
        source: |-
          http PATCH "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    delete:
      tags:
      - Snapshot
      operationId: DeleteSnapshot
      summary: Delete a snapshot
      description: You must specify the `snapshot_id` of the snapshot you want to
        delete. The snapshot must not be in use.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: snapshot_id
        description: UUID of the snapshot.
        required: true
        schema:
          type: string
          description: UUID of the snapshot.
      responses:
        "204":
          description: ""
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X DELETE \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}"
      - lang: HTTPie
        source: |-
          http DELETE "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
  /block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}/export-to-object-storage:
    post:
      tags:
      - Snapshot
      operationId: ExportSnapshotToObjectStorage
      summary: Export a snapshot to a Scaleway Object Storage bucket
      description: |-
        The snapshot is exported in QCOW2 format.
        The snapshot must not be in transient state.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: snapshot_id
        description: UUID of the snapshot. (UUID format)
        required: true
        schema:
          type: string
          description: UUID of the snapshot. (UUID format)
          example: 6170692e-7363-616c-6577-61792e636f6d
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                bucket:
                  type: string
                  description: Scaleway Object Storage bucket where the object is
                    stored.
                key:
                  type: string
                  description: The object key inside the given bucket.
              x-properties-order:
              - bucket
              - key
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{"bucket":"string","key":"string"}' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}/export-to-object-storage"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/{snapshot_id}/export-to-object-storage" \
            X-Auth-Token:$SCW_SECRET_KEY \
            bucket="string" \
            key="string"
  /block/v1alpha1/zones/{zone}/snapshots/import-from-object-storage:
    post:
      tags:
      - Snapshot
      operationId: ImportSnapshotFromObjectStorage
      summary: Import a snapshot from a Scaleway Object Storage bucket
      description: |-
        The bucket must contain a QCOW2 image.
        The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                bucket:
                  type: string
                  description: Scaleway Object Storage bucket where the object is
                    stored.
                key:
                  type: string
                  description: The object key inside the given bucket.
                name:
                  type: string
                  description: Name of the snapshot.
                project_id:
                  type: string
                  description: UUID of the Project to which the volume and the snapshot
                    belong.
                tags:
                  type: array
                  description: List of tags assigned to the snapshot.
                  items:
                    type: string
                size:
                  type: integer
                  description: Size of the snapshot. (in bytes)
                  format: uint64
                  nullable: true
              x-properties-order:
              - bucket
              - key
              - name
              - project_id
              - tags
              - size
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "bucket": "string",
              "key": "string",
              "name": "string",
              "project_id": "string"
            }' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/import-from-object-storage"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/import-from-object-storage" \
            X-Auth-Token:$SCW_SECRET_KEY \
            bucket="string" \
            key="string" \
            name="string" \
            project_id="string"
  /block/v1alpha1/zones/{zone}/snapshots/import-from-s3:
    post:
      tags:
      - Snapshot
      operationId: ImportSnapshotFromS3
      summary: (Deprecated in favor of `ImportSnapshotFromObjectStorage`)
      description: |-
        Import a snapshot from a Scaleway Object Storage bucket
        The bucket must contain a QCOW2 image.
        The bucket can be imported into any Availability Zone as long as it is in the same region as the bucket.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Snapshot'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                bucket:
                  type: string
                  description: Scaleway Object Storage bucket where the object is
                    stored.
                key:
                  type: string
                  description: The object key inside the given bucket.
                name:
                  type: string
                  description: Name of the snapshot.
                project_id:
                  type: string
                  description: UUID of the Project to which the volume and the snapshot
                    belong.
                tags:
                  type: array
                  description: List of tags assigned to the snapshot.
                  items:
                    type: string
                size:
                  type: integer
                  description: Size of the snapshot. (in bytes)
                  format: uint64
                  nullable: true
              x-properties-order:
              - bucket
              - key
              - name
              - project_id
              - tags
              - size
      security:
      - scaleway: []
      deprecated: true
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{
              "bucket": "string",
              "key": "string",
              "name": "string",
              "project_id": "string"
            }' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/import-from-s3"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/block/v1alpha1/zones/{zone}/snapshots/import-from-s3" \
            X-Auth-Token:$SCW_SECRET_KEY \
            bucket="string" \
            key="string" \
            name="string" \
            project_id="string"
  /block/v1alpha1/zones/{zone}/volume-types:
    get:
      tags:
      - Volume Type
      operationId: ListVolumeTypes
      summary: List volume types
      description: List all available volume types in a specified zone. The volume
        types listed are ordered by name in ascending order.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: query
        name: page
        description: Page number.
        schema:
          type: integer
          description: Page number.
          format: int32
      - in: query
        name: page_size
        description: Page size, defines how many entries are returned in one page,
          must be lower or equal to 100.
        schema:
          type: integer
          description: Page size, defines how many entries are returned in one page,
            must be lower or equal to 100.
          format: uint32
          default: "50"
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.ListVolumeTypesResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volume-types"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volume-types" \
            X-Auth-Token:$SCW_SECRET_KEY
  /block/v1alpha1/zones/{zone}/volumes:
    get:
      tags:
      - Volume
      operationId: ListVolumes
      summary: List volumes
      description: List all existing volumes in a specified zone. By default, the
        volumes listed are ordered by creation date in ascending order. This can be
        modified via the `order_by` field.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: query
        name: order_by
        description: Criteria to use when ordering the list.
        schema:
          type: string
          description: Criteria to use when ordering the list.
          enum:
          - created_at_asc
          - created_at_desc
          - name_asc
          - name_desc
          x-enum-descriptions:
            values:
              created_at_asc: Order by creation date (ascending chronological order)
              created_at_desc: Order by creation date (descending chronological order)
              name_asc: Order by name (ascending order)
              name_desc: Order by name (descending order)
          default: created_at_asc
      - in: query
        name: project_id
        description: Filter by Project ID.
        schema:
          type: string
          description: Filter by Project ID.
      - in: query
        name: organization_id
        description: Filter by Organization ID.
        schema:
          type: string
          description: Filter by Organization ID.
      - in: query
        name: page
        description: Page number.
        schema:
          type: integer
          description: Page number.
          format: int32
      - in: query
        name: page_size
        description: Page size, defines how many entries are returned in one page,
          must be lower or equal to 100.
        schema:
          type: integer
          description: Page size, defines how many entries are returned in one page,
            must be lower or equal to 100.
          format: uint32
          default: "50"
      - in: query
        name: name
        description: Filter the return volumes by their names.
        schema:
          type: string
          description: Filter the return volumes by their names.
      - in: query
        name: product_resource_id
        description: Filter by a product resource ID linked to this volume (such as
          an Instance ID).
        schema:
          type: string
          description: Filter by a product resource ID linked to this volume (such
            as an Instance ID).
      - in: query
        name: tags
        description: Filter by tags. Only volumes with one or more matching tags will
          be returned.
        schema:
          type: array
          description: Filter by tags. Only volumes with one or more matching tags
            will be returned.
          items:
            type: string
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.ListVolumesResponse'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes" \
            X-Auth-Token:$SCW_SECRET_KEY
    post:
      tags:
      - Volume
      operationId: CreateVolume
      summary: Create a volume
      description: |-
        To create a new volume from scratch, you must specify `from_empty` and the `size`.
        To create a volume from an existing snapshot, specify `from_snapshot` and the `snapshot_id` in the request payload instead, size is optional and can be specified if you need to extend the original size. The volume will take on the same volume class and underlying IOPS limitations as the original snapshot.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Volume'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the volume.
                perf_iops:
                  type: integer
                  description: The maximum IO/s expected, according to the different
                    options available in stock (`5000 | 15000`).
                  format: uint32
                  nullable: true
                  x-one-of: requirements
                project_id:
                  type: string
                  description: UUID of the project the volume belongs to.
                from_empty:
                  type: object
                  description: Specify the size of the new volume if creating a new
                    one from scratch.
                  properties:
                    size:
                      type: integer
                      description: |-
                        Volume size in bytes, with a granularity of 1 GB (10^9 bytes).
                        Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size. (in bytes)
                      format: uint64
                  nullable: true
                  required:
                  - size
                  x-properties-order:
                  - size
                  x-one-of: from
                from_snapshot:
                  type: object
                  description: Specify the snapshot ID of the original snapshot.
                  properties:
                    size:
                      type: integer
                      description: |-
                        Volume size in bytes, with a granularity of 1 GB (10^9 bytes).
                        Must be compliant with the minimum (1 GB) and maximum (10 TB) allowed size.
                        Size is optional and is used only if a resize of the volume is requested, otherwise original snapshot size will be used. (in bytes)
                      format: uint64
                      nullable: true
                    snapshot_id:
                      type: string
                      description: Source snapshot from which volume will be created.
                  nullable: true
                  x-properties-order:
                  - size
                  - snapshot_id
                  x-one-of: from
                tags:
                  type: array
                  description: List of tags assigned to the volume.
                  items:
                    type: string
              required:
              - name
              - project_id
              x-properties-order:
              - name
              - perf_iops
              - project_id
              - from_empty
              - from_snapshot
              - tags
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X POST \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{"name":"string","project_id":"string"}' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes"
      - lang: HTTPie
        source: |-
          http POST "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes" \
            X-Auth-Token:$SCW_SECRET_KEY \
            name="string" \
            project_id="string"
  /block/v1alpha1/zones/{zone}/volumes/{volume_id}:
    get:
      tags:
      - Volume
      operationId: GetVolume
      summary: Get a volume
      description: Retrieve technical information about a specific volume. Details
        such as size, type, and status are returned in the response.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: volume_id
        description: UUID of the volume.
        required: true
        schema:
          type: string
          description: UUID of the volume.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Volume'
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X GET \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes/{volume_id}"
      - lang: HTTPie
        source: |-
          http GET "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes/{volume_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    patch:
      tags:
      - Volume
      operationId: UpdateVolume
      summary: Update a volume
      description: |-
        Update the technical details of a volume, such as its name, tags, or its new size and `volume_type` (within the same Block Storage class).
        You can only resize a volume to a larger size. It is currently not possible to change your Block Storage Class.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: volume_id
        description: UUID of the volume.
        required: true
        schema:
          type: string
          description: UUID of the volume.
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/scaleway.block.v1alpha1.Volume'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: When defined, is the new name of the volume.
                  nullable: true
                size:
                  type: integer
                  description: |-
                    Optional field for increasing the size of a volume (size must be equal or larger than the current one).
                    Size in bytes of the volume, with a granularity of 1 GB (10^9 bytes).
                    Must be compliant with the minimum (1GB) and maximum (10TB) allowed size. (in bytes)
                  format: uint64
                  nullable: true
                tags:
                  type: array
                  description: List of tags assigned to the volume.
                  nullable: true
                  items:
                    type: string
                perf_iops:
                  type: integer
                  description: |-
                    The maximum IO/s expected, according to the different options available in stock (`5000 | 15000`).
                    The selected value must be available for the volume's current storage class.
                  format: uint32
                  nullable: true
              x-properties-order:
              - name
              - size
              - tags
              - perf_iops
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X PATCH \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            -H "Content-Type: application/json" \
            -d '{}' \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes/{volume_id}"
      - lang: HTTPie
        source: |-
          http PATCH "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes/{volume_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
    delete:
      tags:
      - Volume
      operationId: DeleteVolume
      summary: Delete a detached volume
      description: You must specify the `volume_id` of the volume you want to delete.
        The volume must not be in the `in_use` status.
      parameters:
      - in: path
        name: zone
        description: The zone you want to target
        required: true
        schema:
          type: string
          description: The zone you want to target
          enum:
          - fr-par-1
          - fr-par-2
          - fr-par-3
          - nl-ams-1
          - nl-ams-2
          - nl-ams-3
          - pl-waw-1
          - pl-waw-2
          - pl-waw-3
      - in: path
        name: volume_id
        description: UUID of the volume.
        required: true
        schema:
          type: string
          description: UUID of the volume.
      responses:
        "204":
          description: ""
      security:
      - scaleway: []
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -X DELETE \
            -H "X-Auth-Token: $SCW_SECRET_KEY" \
            "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes/{volume_id}"
      - lang: HTTPie
        source: |-
          http DELETE "https://api.scaleway.com/block/v1alpha1/zones/{zone}/volumes/{volume_id}" \
            X-Auth-Token:$SCW_SECRET_KEY
