# Public Cloud › Compute › Snapshot API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Public Cloud product's sections: https://developers.eu.ovhcloud.com/reference/public-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 4 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/public-cloud/compute/snapshot/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/compute/snapshot.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/compute/snapshot.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/compute/snapshot` — List instance snapshots
- `GET /publicCloud/project/{projectId}/compute/snapshot/{snapshotId}` — Get an instance snapshot
- `POST /publicCloud/project/{projectId}/compute/snapshot` — Create an instance snapshot
- `DELETE /publicCloud/project/{projectId}/compute/snapshot/{snapshotId}` — Delete an instance snapshot

## List instance snapshots

`GET /v2/publicCloud/project/{projectId}/compute/snapshot`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/compute/snapshot/#getInstanceSnapshots

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:instance/snapshot/get`

Returns the snapshots of the project.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `instanceId` | query | string (uuid) |  | Filter by source instance ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.instance.Snapshot[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the snapshot |
| `currentState` | publicCloud.instance.SnapshotCurrentState | read-only | Current state of the snapshot |
| `currentState.canBeDeleted` | boolean | read-only | Whether the project can delete the snapshot: false when it is owned by another project or protected |
| `currentState.instance` | publicCloud.instance.SnapshotInstanceRef | read-only | Source instance reference |
| `currentState.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `currentState.location` | publicCloud.common.Location | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.minDisk` | integer | read-only | Minimum disk size in GB required to boot |
| `currentState.minRam` | integer | read-only | Minimum RAM in MB required to boot |
| `currentState.name` | string | read-only | Current snapshot name |
| `currentState.osType` | publicCloud.instance.ImageOSTypeEnum | read-only | Operating system type. Operating system family of the snapshot (see ImageOSTypeEnum). It is inherited from the image the source instance was created from, so a snapshot of a Windows instance is a Windows image and can only be restored on a Windows flavor. — one of `BAREMETAL_LINUX`, `LINUX`, `WINDOWS` |
| `currentState.size` | integer | read-only | Image size in bytes |
| `currentState.status` | publicCloud.instance.ImageStatusEnum | read-only | Image status in the backend — one of `ACTIVE`, `DEACTIVATED`, `DELETED`, `IMPORTING`, `KILLED`, `PENDING_DELETE`, `QUEUED`, `SAVING` |
| `currentState.visibility` | publicCloud.instance.ImageVisibilityEnum | read-only | Image visibility — one of `COMMUNITY`, `PRIVATE`, `PUBLIC`, `SHARED` |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the snapshot |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the snapshot |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Snapshot readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.instance.SnapshotTargetSpec | read-only | Last target specification of the snapshot |
| `targetSpec.instance` | publicCloud.instance.SnapshotInstanceRef | yes | Source instance reference |
| `targetSpec.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `targetSpec.location` | publicCloud.common.Location | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired snapshot name |
| `updatedAt` | string (date-time) | read-only | Last update date of the snapshot |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "canBeDeleted": true,
      "instance": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "location": {
        "availabilityZone": "string",
        "region": "string"
      },
      "minDisk": 0,
      "minRam": 0,
      "name": "string",
      "osType": "BAREMETAL_LINUX",
      "size": 0,
      "status": "ACTIVE",
      "visibility": "COMMUNITY"
    },
    "currentTasks": [
      {
        "errors": [
          {
            "message": "string"
          }
        ],
        "id": "00000000-0000-0000-0000-000000000000",
        "link": "string",
        "status": "ERROR",
        "type": "string"
      }
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "resourceStatus": "CREATING",
    "targetSpec": {
      "instance": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "location": {
        "availabilityZone": "string",
        "region": "string"
      },
      "name": "string"
    },
    "updatedAt": "2024-01-01T12:00:00Z"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/compute/snapshot" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/compute/snapshot")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/compute/snapshot");

print_r($result);
?>
```

## Get an instance snapshot

`GET /v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/compute/snapshot/#getInstanceSnapshot

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:instance/snapshot/get`

Returns the snapshot image, including its status and the instance it was created from.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `snapshotId` | path | string (uuid) | yes | Snapshot ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.instance.Snapshot | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the snapshot |
| `currentState` | publicCloud.instance.SnapshotCurrentState | read-only | Current state of the snapshot |
| `currentState.canBeDeleted` | boolean | read-only | Whether the project can delete the snapshot: false when it is owned by another project or protected |
| `currentState.instance` | publicCloud.instance.SnapshotInstanceRef | read-only | Source instance reference |
| `currentState.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `currentState.location` | publicCloud.common.Location | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.minDisk` | integer | read-only | Minimum disk size in GB required to boot |
| `currentState.minRam` | integer | read-only | Minimum RAM in MB required to boot |
| `currentState.name` | string | read-only | Current snapshot name |
| `currentState.osType` | publicCloud.instance.ImageOSTypeEnum | read-only | Operating system type. Operating system family of the snapshot (see ImageOSTypeEnum). It is inherited from the image the source instance was created from, so a snapshot of a Windows instance is a Windows image and can only be restored on a Windows flavor. — one of `BAREMETAL_LINUX`, `LINUX`, `WINDOWS` |
| `currentState.size` | integer | read-only | Image size in bytes |
| `currentState.status` | publicCloud.instance.ImageStatusEnum | read-only | Image status in the backend — one of `ACTIVE`, `DEACTIVATED`, `DELETED`, `IMPORTING`, `KILLED`, `PENDING_DELETE`, `QUEUED`, `SAVING` |
| `currentState.visibility` | publicCloud.instance.ImageVisibilityEnum | read-only | Image visibility — one of `COMMUNITY`, `PRIVATE`, `PUBLIC`, `SHARED` |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the snapshot |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the snapshot |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Snapshot readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.instance.SnapshotTargetSpec | read-only | Last target specification of the snapshot |
| `targetSpec.instance` | publicCloud.instance.SnapshotInstanceRef | yes | Source instance reference |
| `targetSpec.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `targetSpec.location` | publicCloud.common.Location | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired snapshot name |
| `updatedAt` | string (date-time) | read-only | Last update date of the snapshot |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "canBeDeleted": true,
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "minDisk": 0,
    "minRam": 0,
    "name": "string",
    "osType": "BAREMETAL_LINUX",
    "size": 0,
    "status": "ACTIVE",
    "visibility": "COMMUNITY"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}");

print_r($result);
?>
```

## Create an instance snapshot

`POST /v2/publicCloud/project/{projectId}/compute/snapshot`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/compute/snapshot/#createInstanceSnapshot

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:instance/snapshot/create`

Creates a snapshot image of the instance's current disk. Its id can be used as `image.id` to create a new instance from it.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.instance.SnapshotCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.instance.SnapshotTargetSpec | yes | Desired target specification for the snapshot to create |
| `targetSpec.instance` | publicCloud.instance.SnapshotInstanceRef | yes | Source instance reference |
| `targetSpec.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `targetSpec.location` | publicCloud.common.Location | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired snapshot name |

```json
{
  "targetSpec": {
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string"
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.instance.Snapshot | successful operation |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the snapshot |
| `currentState` | publicCloud.instance.SnapshotCurrentState | read-only | Current state of the snapshot |
| `currentState.canBeDeleted` | boolean | read-only | Whether the project can delete the snapshot: false when it is owned by another project or protected |
| `currentState.instance` | publicCloud.instance.SnapshotInstanceRef | read-only | Source instance reference |
| `currentState.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `currentState.location` | publicCloud.common.Location | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.minDisk` | integer | read-only | Minimum disk size in GB required to boot |
| `currentState.minRam` | integer | read-only | Minimum RAM in MB required to boot |
| `currentState.name` | string | read-only | Current snapshot name |
| `currentState.osType` | publicCloud.instance.ImageOSTypeEnum | read-only | Operating system type. Operating system family of the snapshot (see ImageOSTypeEnum). It is inherited from the image the source instance was created from, so a snapshot of a Windows instance is a Windows image and can only be restored on a Windows flavor. — one of `BAREMETAL_LINUX`, `LINUX`, `WINDOWS` |
| `currentState.size` | integer | read-only | Image size in bytes |
| `currentState.status` | publicCloud.instance.ImageStatusEnum | read-only | Image status in the backend — one of `ACTIVE`, `DEACTIVATED`, `DELETED`, `IMPORTING`, `KILLED`, `PENDING_DELETE`, `QUEUED`, `SAVING` |
| `currentState.visibility` | publicCloud.instance.ImageVisibilityEnum | read-only | Image visibility — one of `COMMUNITY`, `PRIVATE`, `PUBLIC`, `SHARED` |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the snapshot |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the snapshot |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Snapshot readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.instance.SnapshotTargetSpec | read-only | Last target specification of the snapshot |
| `targetSpec.instance` | publicCloud.instance.SnapshotInstanceRef | yes | Source instance reference |
| `targetSpec.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `targetSpec.location` | publicCloud.common.Location | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired snapshot name |
| `updatedAt` | string (date-time) | read-only | Last update date of the snapshot |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "canBeDeleted": true,
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "minDisk": 0,
    "minRam": 0,
    "name": "string",
    "osType": "BAREMETAL_LINUX",
    "size": 0,
    "status": "ACTIVE",
    "visibility": "COMMUNITY"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/compute/snapshot" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.instance.SnapshotCreation
result = client.post("/v2/publicCloud/project/{projectId}/compute/snapshot",
	targetSpec = None, # Desired target specification for the snapshot to create (type: publicCloud.instance.SnapshotTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.instance.SnapshotCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/compute/snapshot", array(
	targetSpec => null, // Desired target specification for the snapshot to create (type: publicCloud.instance.SnapshotTargetSpec)
));

print_r($result);
?>
```

## Delete an instance snapshot

`DELETE /v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/compute/snapshot/#deleteInstanceSnapshot

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:instance/snapshot/delete`

Deletes the snapshot image.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `snapshotId` | path | string (uuid) | yes | Snapshot ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.instance.Snapshot | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the snapshot |
| `currentState` | publicCloud.instance.SnapshotCurrentState | read-only | Current state of the snapshot |
| `currentState.canBeDeleted` | boolean | read-only | Whether the project can delete the snapshot: false when it is owned by another project or protected |
| `currentState.instance` | publicCloud.instance.SnapshotInstanceRef | read-only | Source instance reference |
| `currentState.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `currentState.location` | publicCloud.common.Location | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.minDisk` | integer | read-only | Minimum disk size in GB required to boot |
| `currentState.minRam` | integer | read-only | Minimum RAM in MB required to boot |
| `currentState.name` | string | read-only | Current snapshot name |
| `currentState.osType` | publicCloud.instance.ImageOSTypeEnum | read-only | Operating system type. Operating system family of the snapshot (see ImageOSTypeEnum). It is inherited from the image the source instance was created from, so a snapshot of a Windows instance is a Windows image and can only be restored on a Windows flavor. — one of `BAREMETAL_LINUX`, `LINUX`, `WINDOWS` |
| `currentState.size` | integer | read-only | Image size in bytes |
| `currentState.status` | publicCloud.instance.ImageStatusEnum | read-only | Image status in the backend — one of `ACTIVE`, `DEACTIVATED`, `DELETED`, `IMPORTING`, `KILLED`, `PENDING_DELETE`, `QUEUED`, `SAVING` |
| `currentState.visibility` | publicCloud.instance.ImageVisibilityEnum | read-only | Image visibility — one of `COMMUNITY`, `PRIVATE`, `PUBLIC`, `SHARED` |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the snapshot |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the snapshot |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Snapshot readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.instance.SnapshotTargetSpec | read-only | Last target specification of the snapshot |
| `targetSpec.instance` | publicCloud.instance.SnapshotInstanceRef | yes | Source instance reference |
| `targetSpec.instance.id` | string (uuid) | yes | Unique identifier of the instance |
| `targetSpec.location` | publicCloud.common.Location | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Desired snapshot name |
| `updatedAt` | string (date-time) | read-only | Last update date of the snapshot |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "canBeDeleted": true,
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "minDisk": 0,
    "minRam": 0,
    "name": "string",
    "osType": "BAREMETAL_LINUX",
    "size": 0,
    "status": "ACTIVE",
    "visibility": "COMMUNITY"
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "instance": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/publicCloud/project/{projectId}/compute/snapshot/{snapshotId}");

print_r($result);
?>
```
