Creating an Image Snapshot
Function
This API is used to create a snapshot for a specified image version. This API is asynchronous. Only one snapshot can be created for an image version. After creation, the status is Creating. You can obtain the creation result by calling the Listing Image Snapshots API.
Calling Method
For details, see Calling APIs.
URI
POST /v2/images/{image_id}/versions/{version_id}/image-snapshots
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| image_id | Yes | String | Definition: Image ID. You can obtain the image ID by calling the Listing Custom Images API. Constraints: N/A Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| version_id | Yes | String | Definition: Image version ID. You can obtain the image version ID by calling the Listing Custom Image Versions API. Constraints: N/A Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition: User token. It is obtained by calling the Obtaining an IAM User Token API. Constraints: N/A Range: Up to 65,534 characters. Only letters, digits, and special characters are allowed. The token format is defined by IAM. For details about the character set, see the IAM documentation. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition: Snapshot name (user-specified, used to identify the snapshot purpose). Constraints: N/A Range: 1 to 190 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit. Default Value: N/A |
| image_snapshot_size | No | Integer | Definition: Snapshot size, in GiB. Constraints: N/A Range: 20 to 400. Default Value: If not specified, the value is automatically estimated as 3 times the image size. |
| reserved_days | No | Integer | Definition: Image snapshot retention period, in days. The snapshot automatically expires after the retention period. 0 indicates permanent retention. Constraints: N/A Range: 0 to 65,536 days. Default Value: 0 |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition: Image snapshot record ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| image_id | String | Definition: Image ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| image_version_id | String | Definition: Image version ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| name | String | Definition: Image snapshot name (user-specified). Range: 1 to 190 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit. |
| image_address | String | Definition: Full image address (including registry/namespace/name:version). Range: 0 to 1,024 characters. Only letters, digits, periods (.), colons (:), slashes (/), and hyphens (-) are allowed. |
| image_name | String | Definition: Image name. Range: 0 to 128 characters. Only letters, digits, periods (.), slashes (/), colons (:), underscores (_), and hyphens (-) are allowed. |
| image_version | String | Definition: Image version. Range: 0 to 1,024 characters. Only letters, digits, periods (.), colons (:), underscores (_), and hyphens (-) are allowed. |
| status | String | Definition: Image snapshot status. Range |
| image_snapshot_size | Integer | Definition: Snapshot size, in GiB. Range: 20 to 400. |
| creation_mode | String | Definition: Creation method. Range |
| reserved_days | Integer | Definition: Image snapshot retention period, in days. The snapshot automatically expires after the retention period. 0 indicates permanent retention. Range: 0 to 65,536. |
| expire_time | String | Definition: Image snapshot expiration time. A null value indicates permanent validity. The time is in UTC, in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSSXXX), for example, 2025-01-10T03:37:12.000+00:00. Range: N/A |
| failed_message | String | Definition: Message indicating why the image snapshot is invalid. Range: 0 to 65,535 characters. Only letters, digits, and common symbols are allowed. |
| create_time | String | Definition: Creation time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00. Range: N/A |
| update_time | String | Definition: Update time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00. Range: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Example Requests
Create a snapshot named "my-snapshot" for a specified image version. The snapshot size is 60 GiB and the retention period is 30 days.
POST /v2/images/1a2b3c4d-5e6f-7890-abcd-1e2f3a4b5c6d/versions/7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d/image-snapshots
{
"name" : "my-snapshot",
"image_snapshot_size" : 60,
"reserved_days" : 30
} Example Responses
Status code: 200
{
"id" : "1a2b3c4d-5e6f-7860-abcd-1e2f3a4b5c6d",
"image_id" : "1a2b3c4d-5e6f-7890-abcd-1e2f3a4b5c6d",
"image_version_id" : "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
"name" : "my-snapshot",
"image_address" : "swr.example.com/ns/my-image:v1.0",
"image_name" : "my-image",
"image_version" : "v1.0",
"status" : "Creating",
"image_snapshot_size" : 60,
"creation_mode" : "Created",
"reserved_days" : 30,
"expire_time" : "2026-09-25T10:00:00.000+00:00",
"failed_message" : "",
"create_time" : "2026-08-26T10:00:00.000+00:00",
"update_time" : "2026-08-26T10:00:00.000+00:00"
} Status code: 400
{
"error_code" : "AIDataLake.00010151",
"error_msg" : "Parameter value is invalid.",
"solution_msg" : "Please input valid parameter value."
} Status code: 401
{
"error_code" : "APIGW.0301",
"error_msg" : "Incorrect IAM authentication information: decrypt token fail.",
"solution_msg" : "Check whether the IAM authentication information is correct."
} Status code: 403
{
"error_code" : "AIDataLake.00010150",
"error_msg" : "The operation is not allowed.",
"solution_msg" : "Check whether the operation is allowed in the current status."
} Status code: 404
{
"error_code" : "AIDataLake.00010411",
"error_msg" : "Image version not found, image ID: b9e48f42-26ba-4be9-b6f0-9de1b048c053, version ID: cb46a24c-b5ec-4134-9f03-195477bdfe03.",
"solution_msg" : "Please check whether the image ID and version ID are correct or exist in SWR."
} Status code: 500
{
"error_code" : "AIDataLake.00011001",
"error_msg" : "Internal error.",
"solution_msg" : "Contact technical support or try again later."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
| 400 | Invalid request parameters. |
| 401 | Unauthorized. |
| 403 | Access denied. |
| 404 | Resource not found. |
| 500 | Internal server error. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot