CreateSnapshot

1. API Description

This API is used to create a snapshot of the specified disk.

Note

  • Whether the disk supports creating snapshots can be determined by the SnapshotAbility field. You can use DescribeDisks to query the value.

  • The disk must be IN_USE or AVAILABLE.

  • Boot disks are not allowed to create snapshots currently.

  • For the limit on the number of snapshots that can be created, see the product usage limits.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

diskId

Yes

String

ID of the disk.

snapshotName

Yes

String

Snapshot name.

retentionTime

No

String

Retention expiration time.

Format: yyyy-MM-ddTHH:mm:ssZ.

If not transmitted, it means that it is retained indefinitely.

The specified time must be 24 hours after the current time.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID,

which is returned for each request. RequestId is required for locating a problem.

snapshotId

String

The IDs of the created snapshots.

4. Code Example

Create a snapshot of the disk.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateSnapshot
<Common Request Params>

Request:
{
  "diskId": "diskId1",
  "snapshotName": "xxx",
  "retentionTime": "2025-07-16T01:26:39Z"
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "snapshotId": "snapshotId1"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

404

INVALID_DISK_NOT_FOUND

The disk does not exist.

400

INVALID_SNAPSHOT_QUOTA_EXCEED

The number of snapshots exceeds the limit.

400

INVALID_SNAPSHOT_RETENTION_TIME

Invalid snapshot retention time. It must be 24 hours after the current time.

400

OPERATION_DENIED_DISK_SYSTEM_TYPE

Operations on boot disks are not supported.

400

UNSUPPORTED_OPERATION_DISK_STATUS

Operations on the disk with current status are not supported.

Last updated