Sends a message to a specified message queue. A message can be consumed after it is sent to message queue. However, if you need to delay the consumption of a message in specific scenarios, for example, scheduled tasks, you can set the DelaySeconds parameter to an integer greater than 0. In this case, after a message is sent to a queue, the status of the message is Delayed and the message cannot be consumed. After the delay period expires, the status changes to Active and the message can be consumed.


A request consists of the following parts:

  • Request line

    POST /$queueName/messages HTTP/1.1

  • Operation-specific request headers

    None. For information about common request parameters, see Common parameters.

  • Request Body
    The request body is in the XML format. It contains the parameters of the message.
    Parameter Description Value
    MessageBody Required. The body of the message. UTF-8 characters.
    DelaySeconds Optional. The interval between the time when a message arrives at the queue and the time when the message becomes consumable. Unit: seconds. Valid values: 0 to 604800 (7 days). Data type: integer. Default value: 0.
    Priority Optional. The priority of the message. A message with a higher priority is consumed earlier. Valid values: 1 to 16. The value 1 indicates the highest priority. Default value: 8.
    Note If the value of the DelaySeconds parameter in the SendMessage request is different from that of the message queue, the value in the SendMessage request is used.


A response consists of a status line, HTTP headers, and a response body.

  • HTTP Status Code

    HTTP/1.1 201 Created

  • Operation-specific response headers

    None. For information about common response parameters, see Common parameters.

  • Response Body

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

    Parameter Description
    MessageId The ID of the message. Each message ID is unique in the queue.
    MessageBodyMD5 The MD5 hash of the message body.

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
  • Sample requests
        POST /$queueName/messages HTTP/1.1
        Host: $
        Date: Wed, 18 Mar 2012 12:00:00 GMT
        x-mqs-version: 2014-07-08
        Authorization: MQS 15B4D3461F177624206A:xQE0diMbLRepdf3YB+FIEXAMPLE
        <? xml version="1.0" encoding="UTF-8" ? >
        <Message xmlns="">
            <MessageBody>Base64 Encoded Result</MessageBody>
  • Sample success responses
        HTTP/1.1 201Created
        <? xml version="1.0" encoding="UTF-8" ? >
        <Message xmlns="">