Peek Messages


Updated: June 29, 2016

This operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message.

The Peek Messages request may be constructed as follows. HTTPS is recommended. Replace myaccount with the name of your storage account, and myqueue with the name of your queue:


Request URI

HTTP Version



When making a request against the emulated storage service, specify the emulator hostname and Queue service port as, followed by the emulated storage account name:


Request URI

HTTP Version



The following parameters may be specified on the request URI.




Optional. A nonzero integer value that specifies the number of messages to peek from the queue, up to a maximum of 32. By default, a single message is peeked from the queue with this operation.


Optional. The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Queue Service Operations.

The following table describes required and optional request headers.

Request Header



Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage Services.

Date or x-ms-date

Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication for the Azure Storage Services.


Optional. Specifies the version of the operation to use for this request. For more information, see Versioning for the Azure Storage Services.


Optional. Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. Using this header is highly recommended for correlating client-side activities with requests received by the server. For more information, see About Storage Analytics Logging and Azure Logging: Using Logs to Track Storage Requests.

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

A successful operation returns status code 200 (OK).

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

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

Response header



This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations.


Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and later.


A UTC date/time value generated by the service that indicates the time at which the response was initiated.

The response XML for the Peek Messages operation is returned in the following format.

The MessageID element is a GUID value that identifies the message in the queue. This value is assigned to the message by the Queue service and is opaque to the client.

The InsertionTime and ExpirationTime elements are represented as UTC values and formatted as described in RFC 1123.

The DequeueCount element has a value of 1 the first time the message is dequeued. This value is incremented each time the message is subsequently dequeued.


The DequeueCount element is returned in the response body only if the queue was created with version 2009-09-19 of the Queue service.


Note that this response differs from the response for the Get Messages operation in that the response does not contain the PopReceipt or TimeNextVisible elements.

Response Status:
HTTP/1.1 200 OK

Response Headers:
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Fri, 16 Sep 2011 22:51:18 GMT
Server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0

Response Body:
<?xml version="1.0" encoding="utf-8"?>
    <InsertionTime>Fri, 09 Oct 2009 18:59:54 GMT</InsertionTime>
    <ExpirationTime>Fri, 16 Sep 2009 18:59:54 GMT</ExpirationTime>

This operation can be performed by the account owner and by anyone with a shared access signature that has permission to perform this operation.

When a message is retrieved from the queue with peekonly set to true, the visibility of the message is unchanged. The message remains available to other consumers of the queue until a client retrieves the message with the Get Messages operation. The client requesting the message does not receive a pop receipt with the response and therefore cannot delete the message.

Only messages that are visible may be retrieved with the Peek Messages operation. Note that the maximum number of messages that may be retrieved is 32.

When a message is retrieved for the first time with a call to Get Messages, its DequeueCount property is set to 1. If it is not deleted and is subsequently retrieved again, the DequeueCount property is incremented. The client may use this value to determine how many times a message has been retrieved. Note that a call to Peek Messages does not increment the value of DequeueCount, but returns this value for the client to read.

If the numofmessages parameter is out of range, the service returns status code 400 (Bad Request), along with additional error information, as shown in the following example.

HTTP/1.1 400 One of the query parameters specified in the request URI is outside the permissible range.
Connection: Keep-Alive
Content-Length: 455
Via: 1.1 TK5-PRXY-22
Date: Wed, 02 May 2012 19:37:23 GMT
Content-Type: application/xml
Server: Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 6a03526c-ca2c-4358-a63a-b5d096988533
x-ms-version: 2011-08-18

<?xml version="1.0" encoding="utf-8"?>
      <Message>One of the query parameters specified in the request URI is outside the permissible range.