Sends a message to a queue.

Name Value
API SendMessage
Action mns:SendMessage
Resource acs:mns:$region:$accountid:/queues/$queueName/messages


You can call this operation to send a message to a queue. A standard message can be immediately consumed after the message is sent to the queue. If you do not want the message to be immediately consumed, you can specify the DelaySeconds parameter when you send the message. If you set the DelaySeconds parameter to a value that is greater than 0, the initial status of the message is Delayed after the message is sent to a queue. The message cannot be consumed until the period specified by the DelaySeconds parameter ends and the message changes to the Active state.

Note If two values of the DelaySeconds parameter that is specified for the message and queue are different, the delay period specified for the message takes effect.


Each request consists of the following parts:

  • Request line

    POST /queues/$queueName/messages HTTP/1.1

  • Operation-specific request headers


  • Request Body

    The request body is in XML format. It contains the parameters of the message.

    Parameter Required Description Value
    MessageBody Yes The body of the message. UTF-8 characters.
    DelaySeconds No The delay period after which the message that is sent to the queue can be consumed. Unit: seconds. Valid values: 0 to 604800 seconds. Data type: integer. Default value: 0.
    Priority No The priority of the message. A message with a higher priority can be consumed earlier. Valid values: 1 to 16. The value 1 indicates the highest priority. Default value: 8.


Each response consists of the following parts:

  • HTTP Status Code

    HTTP/1.1 201 Created

  • Operation-specific response headers


  • Response Body

    The response is in the XML format. The MessageId and MessageBodyMD5 parameters of the message are returned.

    Parameter Description
    MessageId The ID of the message. The message ID is unique in the queue.
    MessageBodyMD5 The MD5 hash of the message body.
    ReceiptHandle The receipt handle that was returned after the delayed message was received.


Sample requests

POST /queues/$queueName/messages HTTP/1.1
Host: $
Date: Wed, 18 Mar 2012 12:00:00 GMT
x-mns-version: 2015-06-06
Authorization: MNS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXA****

<? xml version="1.0" encoding="UTF-8"? >
<Message xmlns="">
    <MessageBody>Base64 Encoded Result</MessageBody>

Sample success responses

HTTP/1.1 201 Created
x-mns-version: 2015-06-06

<? xml version="1.0" encoding="UTF-8"? >
<Message xmlns="">

Special error

Error code Error message HTTP status code
QueueNotExist The queue name you provided is not exist. 404
MalformedXML The XML you provided was not well-formed. 400
InvalidArgument The value of Element should between Low and High seconds/bytes. 400