Menu
Amazon Simple Queue Service
API Reference (API Version 2012-11-05)

PurgeQueue

Deletes the messages in a queue specified by the QueueURL parameter.

Important

When you use the PurgeQueue action, you can't retrieve a message deleted from a queue.

When you purge a queue, the message deletion process takes up to 60 seconds. All messages sent to the queue before calling the PurgeQueue action are deleted. Messages sent to the queue while it is being purged might be deleted. While the queue is being purged, messages sent to the queue before PurgeQueue is called might be received, but are deleted within the next minute.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

QueueUrl

The URL of the queue from which the PurgeQueue action deletes messages.

Queue URLs are case-sensitive.

Type: String

Required: Yes

Errors

For information about the errors that are common to all actions, see Common Errors.

AWS.SimpleQueueService.NonExistentQueue

The queue referred to doesn't exist.

HTTP Status Code: 400

AWS.SimpleQueueService.PurgeQueueInProgress

Indicates that the specified queue previously received a PurgeQueue request within the last 60 seconds (the time it can take to delete the messages in the queue).

HTTP Status Code: 403

Example

The following example query request purges a queue named testQueue. How you structure the AUTHPARAMS depends on how you are signing your API request. For information about AUTHPARAMS in Signature Version 4, see Examples of Signed Signature Version 4 Requests in the Amazon Web Services General Reference.

Sample Request

http://sqs.us-east-2.amazonaws.com/123456789012/testQueue/ ?Action=PurgeQueue &Version=2012-11-05 &Expires=2020-12-12T22%3A52%3A43PST &AUTHPARAMS

Sample Response

<PurgeQueueResponse> <ResponseMetadata> <RequestId> 6fde8d1e-52cd-4581-8cd9-c512f4c64223 </RequestId> </ResponseMetadata> </PurgeQueueResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: