Share a custom image
Updated at:2025-10-20
This API enables users to share their custom images. Only custom images can be shared—public or service-integrated images cannot.
- If the image ID specified in imageId does not exist, a 404 error is returned.
- Once an image is shared, the recipient can use it to create or reset instances.
- In the request, the account and accountId parameters are optional but at least one must be provided. If both are included, duplicates will automatically be removed by the server.
Request structure
Plain Text
1POST /v{version}/image/{imageId}?{action} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "account" : "account",
7 "accountId" : "accountId"
8}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number |
| imageId | String | Yes | URL parameter | ID of the image to be shared |
| action | String | Yes | Query | Action performed on the image, current value: share |
| account | String | No | Request Body parameters | Name of the user to be shared |
| accountId | String | No | Request Body parameters | ID of the user to be shared |
| ucAccount | String | No | RequestBody | UC account |
Response headers
No special headers are required beyond the standard ones.
Response parameters
There are no special response parameters
Error codes
| Error code | Error description | HTTP status code | Chinese explanation |
|---|---|---|---|
| Image.UnCustomImageCannotBeShared | Only custom image can be shared. | 403 | Non-custom images cannot be shared |
| Image.InvalidAccount | Account is invalid. | 400 | Invalid user |
| Image.AccountListIsEmpty | Account list is empty. | 400 | The user list is empty |
| Image.ExceedSharedToUserNumQuota | Exceed shared to user num quota. | 413 | Exceed the limit on the count of users with whom the image can be shared |
| Image.CannotShareToOwner | Cannot share to owner. | 403 | The image cannot be shared with its owner |
| Image.AccountHasBeenShared | Account has been shared. | 409 | The user has already received this shared image and cannot be shared again |
| Image.ExceedAcceptSharedImageNumQuota | Exceed accept shared image num quota | 413 | Exceed the limit on the count of images that can be accepted as shared |
Request example
Plain Text
1POST /v2/image/m-nky*****?share HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Date: Wed, 01 Mar 2006 12:00:00 GMT
5Authorization: authorization-string
6
7{
8 "account" : "********",
9 "accountId" : "**********"
10}
Response example
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Wed, 03 Dec 2014 06:42:19 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
