

# GetAuthorizationToken
<a name="API_GetAuthorizationToken"></a>

Retrieves an authorization token. An authorization token represents your IAM authentication credentials. You can use it to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours. This API requires the `ecr-public:GetAuthorizationToken` and `sts:GetServiceBearerToken` permissions.

## Response Syntax
<a name="API_GetAuthorizationToken_ResponseSyntax"></a>

```
{
   "authorizationData": { 
      "authorizationToken": "string",
      "expiresAt": number
   }
}
```

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

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

The following data is returned in JSON format by the service.

 ** [authorizationData](#API_GetAuthorizationToken_ResponseSyntax) **   <a name="ecrpublic-GetAuthorizationToken-response-authorizationData"></a>
An authorization token data object that corresponds to a public registry.  
Type: [AuthorizationData](API_AuthorizationData.md) object

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

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

 ** InvalidParameterException **   
The specified parameter is invalid. Review the available parameters for the API request.  
HTTP Status Code: 400

 ** ServerException **   
These errors are usually caused by a server-side issue.  
HTTP Status Code: 500

 ** UnsupportedCommandException **   
The action isn't supported in this Region.  
HTTP Status Code: 400

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

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/ecr-public-2020-10-30/GetAuthorizationToken) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/ecr-public-2020-10-30/GetAuthorizationToken) 