Send Message Batch

Sends a batch of messages to a Service Bus queue or topic.


Method Request URI HTTP Version
POST http{s}://{serviceNamespace}{queuePath|topicPath}/messages|HTTP/1.1

Request Headers

The following table describes required and optional request headers. In addition to the listed properties, the header can contain custom properties. See the example.

Request Header Description
Authorization Specify one of the following token values:
  • Azure Active Directory (Azure AD) JSON Web Token (JWT) token.
    Example: Authorization: Bearer <Azure AD JWT token>.
    For information on generating an Azure AD token, see Authenticate from an application.
  • A SAS token.
    Example: Authorization: SharedAccessSignature sr=<NAMESPACE NAME><SHARED ACCESS KEY>&se=<TOKEN EXPIRY INSTANT>&skn=<SHARED KEY NAME>.
    For information on generating a SAS token, see Generate a Shared Access Signature token and Generate SAS token.
Content-Type Set to application/
x-ms-retrypolicy (Optional) Set to NoRetry to disable automatic retry on send operations in the case of transient errors.

Request Body

The request body contains the JSON-encoded message batch.


The response includes an HTTP status code and a set of response headers.

Response Codes

Code Description
201 Message successfully sent to queue or topic.
400 Bad request.
401 Authorization failure.
403 Quota exceeded or message too large.
410 Specified queue or topic does not exist.
500 Internal error.

For information about status codes, see Status and Error Codes.

Response Headers

Content-type as passed in.

Response Body



The following HTTP request sends a batch of three messages to a queue or topic. The first message has a TimeToLiveTimeSpan value of 40 seconds, the second message has a custom message property “Priority”, and the third message has the custom message properties “Priority” and “Customer”.

Authorization: SharedAccessSignature sr=your-namespace&sig=Fg8yUyR4MOmXfHfj55f5hY4jGb8x2Yc%2b3%2fULKZYxKZk%3d&se=1404256819&skn=RootManageSharedAccessKey  
Content-Type: application/  
Content-Length: 18  
Expect: 100-continue  
    "Body":”This is the first message",  
    "Body":”This is the second message",  
    "Body":”This is the third message",  

Service Bus returns the following response:

HTTP/1.1 201 Created  
Transfer-Encoding: chunked  
Content-Type: application/xml; charset=utf-8  
Server: Microsoft-HTTPAPI/2.0  
Date: Tue, 01 Jul 2014 23:00:22 GMT  

See Also

Service Bus HTTP Client sample