Receive and Delete Message (Destructive Read)

This operation receives a message from a queue or subscription, and removes the message from that queue or subscription in one atomic operation.


Method Request URI HTTP Version
DELETE http{s}://{serviceNamespace}{queuePath}/messages/head



Request Headers

The following table describes required and optional request headers. In addition to the listed properties, the header may 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.

Request Body



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

Response Codes

Code Description
200 Message successfully retrieved and deleted.
204 No messages available within the specified timeout period.
400 Bad request.
401 Authorization failure.
410 Specified queue or subscription does not exist.
500 Internal error.

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

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Body

The response body is the message body of the retrieved message.


The following HTTP request receives and deletes a message from a queue:

Authorization: SharedAccessSignature sr=your-namespace&sig=Fg8yUyR4MOmXfHfj55f5hY4jGb8x2Yc%2b3%2fULKZYxKZk%3d&se=1404256819&skn=RootManageSharedAccessKey  
Content-Length: 0  

Service Bus returns the following response. The message contains the custom properties “Priority” and “Customer”:

HTTP/1.1 200 OK  
Transfer-Encoding: chunked  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Server: Microsoft-HTTPAPI/2.0  
BrokerProperties: {"DeliveryCount":1,"EnqueuedSequenceNumber":0,"EnqueuedTimeUtc":"Tue, 01 Jul 2014 23:00:23 GMT","Label":"M1","MessageId":"3a146f76afee41648677887ffced72d8","SequenceNumber":1,"State":"Active","TimeToLive":10}  
Priority: "High"  
Customer: "12345,ABC"  
Date: Tue, 01 Jul 2014 23:00:23 GMT  
This is a message.  

See Also

Service Bus HTTP Client sample