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 any messages deleted from a queue.

The message deletion process takes up to 60 seconds. We recommend waiting for 60 seconds regardless of your queue's size.

Messages sent to the queue before you call PurgeQueue might be received but are deleted within the next minute.

Messages sent to the queue after you call PurgeQueue might be deleted while the queue is being purged.

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 and names 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 specified queue 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 MyQueue. The structure of AUTHPARAMS depends on the signature of the API request. For more information, see Examples of Signed Signature Version 4 Requests in the Amazon Web Services General Reference.

Sample Request

https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue/ ?Action=PurgeQueue &Expires=2020-12-12T22%3A52%3A43PST &Version=2012-11-05 &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: