Amazon Web ServicesAmazon SQS message-queue API
DeleteMessage
<p>Deletes the specified message from the specified queue. To select the message to delete, use the <code>ReceiptHandle</code> of the message (<i>not</i> the <code>MessageId</code> which you receive when you send the message). Amazon SQS can delete a message from a queue even if a visibility timeout setting causes the message to be locked by another consumer. Amazon SQS automatically deletes messages left in a queue longer than the retention period configured for the queue. </p> <note> <p>Each time you receive a message, meaning when a consumer retrieves a message from the queue, it comes with a unique <code>ReceiptHandle</code>. If you receive the same message more than once, you will get a different <code>ReceiptHandle</code> each time. When you want to delete a message using the <code>DeleteMessage</code> action, you must use the <code>ReceiptHandle</code> from the most recent time you received the message. If you use an old <code>ReceiptHandle</code>, the request will succeed, but the message might not be deleted. </p> <p>For standard queues, it is possible to receive a message even after you delete it. This might happen on rare occasions if one of the servers which stores a copy of the message is unavailable when you send the request to delete the message. The copy remains on the server and might be returned to you during a subsequent receive request. You should ensure that your application is idempotent, so that receiving a message more than once does not cause issues.</p> </note>
The complete 23-action Amazon Simple Queue Service API, preserving AWS JSON 1.0, AWS Query compatibility, SigV4, and regional endpoint rules. Hub provides documentation and a local SDK/CLI; it does not proxy queue calls.
Request
- operationId
DeleteMessage- Server
https://sqs.{Region}.{PartitionResult#dnsSuffix}- Authentication
- awsSigV4
Request parameters
No URL, query, or header parameters.
Request body
stringrequired
Responses
200
object
Successful response.
error
string
Declared service error
{}