

# UpdateWorkspaceImagePermission
<a name="API_UpdateWorkspaceImagePermission"></a>

Shares or unshares an image with one account in the same Amazon Web Services Region by specifying whether that account has permission to copy the image. If the copy image permission is granted, the image is shared with that account. If the copy image permission is revoked, the image is unshared with the account.

After an image has been shared, the recipient account can copy the image to other Regions as needed.

In the China (Ningxia) Region, you can copy images only within the same Region.

In Amazon GovCloud (US), to copy images to and from other Regions, contact Amazon Web Services Support.

For more information about sharing images, see [ Share or Unshare a Custom WorkSpaces Image](https://docs.amazonaws.cn/workspaces/latest/adminguide/share-custom-image.html).

**Note**  
To delete an image that has been shared, you must unshare the image before you delete it.
Sharing Bring Your Own License (BYOL) images across Amazon Web Services accounts isn't supported at this time in Amazon GovCloud (US). To share BYOL images across accounts in Amazon GovCloud (US), contact Amazon Web Services Support.

## Request Syntax
<a name="API_UpdateWorkspaceImagePermission_RequestSyntax"></a>

```
{
   "AllowCopyImage": {{boolean}},
   "ImageId": "{{string}}",
   "SharedAccountId": "{{string}}"
}
```

## Request Parameters
<a name="API_UpdateWorkspaceImagePermission_RequestParameters"></a>

The request accepts the following data in JSON format.

 ** [AllowCopyImage](#API_UpdateWorkspaceImagePermission_RequestSyntax) **   <a name="WorkSpaces-UpdateWorkspaceImagePermission-request-AllowCopyImage"></a>
The permission to copy the image. This permission can be revoked only after an image has been shared.  
Type: Boolean  
Required: Yes

 ** [ImageId](#API_UpdateWorkspaceImagePermission_RequestSyntax) **   <a name="WorkSpaces-UpdateWorkspaceImagePermission-request-ImageId"></a>
The identifier of the image.  
Type: String  
Pattern: `wsi-[0-9a-z]{9,63}$`   
Required: Yes

 ** [SharedAccountId](#API_UpdateWorkspaceImagePermission_RequestSyntax) **   <a name="WorkSpaces-UpdateWorkspaceImagePermission-request-SharedAccountId"></a>
The identifier of the Amazon Web Services account to share or unshare the image with.  
Before sharing the image, confirm that you are sharing to the correct Amazon Web Services account ID.
Type: String  
Pattern: `^\d{12}$`   
Required: Yes

## Response Elements
<a name="API_UpdateWorkspaceImagePermission_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

## Errors
<a name="API_UpdateWorkspaceImagePermission_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The user is not authorized to access a resource.  
HTTP Status Code: 400

 ** InvalidParameterValuesException **   
One or more parameter values are not valid.    
 ** message **   
The exception error message.
HTTP Status Code: 400

 ** OperationNotSupportedException **   
This operation is not supported.    
 ** message **   
The exception error message.  
 ** reason **   
The exception error reason.
HTTP Status Code: 400

 ** ResourceNotFoundException **   
The resource could not be found.    
 ** message **   
The resource could not be found.  
 ** ResourceId **   
The ID of the resource that could not be found.
HTTP Status Code: 400

 ** ResourceUnavailableException **   
The specified resource is not available.    
 ** message **   
The exception error message.  
 ** ResourceId **   
The identifier of the resource that is not available.
HTTP Status Code: 400

## See Also
<a name="API_UpdateWorkspaceImagePermission_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for C\+\+](https://docs.amazonaws.cn/goto/SdkForCpp/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/workspaces-2015-04-08/UpdateWorkspaceImagePermission) 