GetRetainedMessage - AWS IoT


Gets the details of a single retained message for the specified topic.

This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.

Requires permission to access the GetRetainedMessage action.

For more information about messaging costs, see AWS IoT Core pricing - Messaging.

Request Syntax

GET /retainedMessage/topic HTTP/1.1

URI Request Parameters

The request uses the following URI parameters.


The topic name of the retained message to retrieve.

Required: Yes

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 Content-type: application/json { "lastModifiedTime": number, "payload": blob, "qos": number, "topic": "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.


The Epoch date and time, in milliseconds, when the retained message was stored by AWS IoT.

Type: Long


The Base64-encoded message payload of the retained message body.

Type: Base64-encoded binary data object


The quality of service (QoS) level used to publish the retained message.

Type: Integer

Valid Range: Minimum value of 0. Maximum value of 1.


The topic name to which the retained message was published.

Type: String



An unexpected error has occurred.

HTTP Status Code: 500


The request is not valid.

HTTP Status Code: 400


The specified combination of HTTP verb and URI is not supported.

HTTP Status Code: 405


The specified resource does not exist.

HTTP Status Code: 404


The service is temporarily unavailable.

HTTP Status Code: 503


The rate exceeds the limit.

HTTP Status Code: 429


You are not authorized to perform this operation.

HTTP Status Code: 401

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: