RegisterDevice
Note
Amazon Cognito Sync will no longer be open to new customers starting July 30, 2026.
Existing Amazon Cognito Sync customers can continue using the service. For alternatives to
Cognito Sync, please explore AWS AppSync
Registers a device to receive push sync notifications.
This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.
Request Syntax
POST /identitypools/IdentityPoolId/identity/IdentityId/device HTTP/1.1
Content-type: application/json
{
"Platform": "string",
"Token": "string"
}
URI Request Parameters
The request uses the following URI parameters.
- IdentityId
-
The unique ID for this identity.
Length Constraints: Minimum length of 1. Maximum length of 55.
Pattern:
[\w-]+:[0-9a-f-]+Required: Yes
- IdentityPoolId
-
A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. Here, the ID of the pool that the identity belongs to.
Length Constraints: Minimum length of 1. Maximum length of 55.
Pattern:
[\w-]+:[0-9a-f-]+Required: Yes
Request Body
The request accepts the following data in JSON format.
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"DeviceId": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- DeviceId
-
The unique ID generated for this device by Cognito.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 256.
Errors
For information about the errors that are common to all actions, see Common Error Types.
- InternalErrorException
-
Indicates an internal service error.
- message
-
Message returned by InternalErrorException.
HTTP Status Code: 500
- InvalidConfigurationException
-
This exception is thrown when Amazon Cognito detects an invalid configuration.
- message
-
Message returned by InvalidConfigurationException.
HTTP Status Code: 400
- InvalidParameterException
-
Thrown when a request parameter does not comply with the associated constraints.
- message
-
Message returned by InvalidParameterException.
HTTP Status Code: 400
- NotAuthorizedException
-
Thrown when a user is not authorized to access the requested resource.
- message
-
The message returned by a NotAuthorizedException.
HTTP Status Code: 403
- ResourceNotFoundException
-
Thrown if the resource doesn't exist.
- message
-
Message returned by a ResourceNotFoundException.
HTTP Status Code: 404
- TooManyRequestsException
-
Thrown if the request is throttled.
- message
-
Message returned by a TooManyRequestsException.
HTTP Status Code: 429
Examples
RegisterDevice
The following examples have been edited for readability.
Sample Request
POST / HTTP/1.1
CONTENT-TYPE: application/json
X-AMZN-REQUESTID: 368f9200-3eca-449e-93b3-7b9c08d8e185
X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.RegisterDevice
HOST: cognito-sync.us-east-1.amazonaws.com
X-AMZ-DATE: 20141004T194643Z
X-AMZ-SECURITY-TOKEN: <securitytoken>
AUTHORIZATION: AWS4-HMAC-SHA256 Credential=<credential>, SignedHeaders=content-type;content-length;host;x-amz-date;x-amz-target, Signature=<signature>
{
"IdentityPoolId": "ID_POOL_ID",
"IdentityId": "IDENTITY_ID",
"Platform": "GCM",
"Token": "PUSH_TOKEN"
}
Sample Response
1.1 200 OK
x-amzn-requestid: 368f9200-3eca-449e-93b3-7b9c08d8e185
date: Sat, 04 Oct 2014 19:46:44 GMT
content-type: application/json
content-length: 145
{
"DeviceId": "5cd28fbe-dd83-47ab-9f83-19093a5fb014"
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: