Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Message Queue
  • Access management
  • Pricing policy
  • Terraform reference
    • Overview
      • ChangeMessageVisibility
      • ChangeMessageVisibilityBatch
      • DeleteMessage
      • DeleteMessageBatch
      • ReceiveMessage
      • SendMessage
      • SendMessageBatch
    • Common errors
  • Audit Trails events
  • Monitoring metrics
  • Public materials
  • FAQ

In this article:

  • Request
  • Request parameters
  • Response
  • Successful response fields
  • DeleteMessage errors
  • Sample request
  • Response example
  1. API reference
  2. Message
  3. DeleteMessage

DeleteMessage

Written by
Yandex Cloud
Updated at October 4, 2024
  • Request
    • Request parameters
  • Response
    • Successful response fields
    • DeleteMessage errors
  • Sample request
  • Response example

Method for deleting messages from a queue. To select the message to delete, use the ReceiptHandle parameter. A message can be deleted even if it is received and being processed by another consumer. Message Queue automatically deletes messages if the value specified for the RetentionPeriod parameter is reached.

The ReceiptHandle parameter is associated with a specific instance of a message. If you receive a message more than once, ReceiptHandle will have different values each time you receive a message. To delete a message, provide the most recent ReceiptHandle value for the message; otherwise, the request will be successful, but the message might not be deleted.

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. Make sure that your application is idempotent, so that receiving a message more than once does not cause issues.

RequestRequest

Request parametersRequest parameters

Parameter Type Required parameter Description
QueueUrl string Yes URL of the queue where the message is placed.
ReceiptHandle string Yes ReceiptHandle parameter from the ReceiveMessage request.

ResponseResponse

Successful response fieldsSuccessful response fields

The response does not contain any fields.

DeleteMessage errorsDeleteMessage errors

For a list of possible responses, see Common errors.

HTTP code Error ID Description
400 InvalidIdFormat Invalid ReceiptHandle format.
400 ReceiptHandleIsInvalid The specified ReceiptHandle parameter is invalid.

Sample requestSample request

Action=DeleteMessage
&Version=2012-11-05
&QueueUrl=https://message-queue.api.cloud.yandex.net/b1g8ad42m6he********/dj6000000000********/sample-queue
&ReceiptHandle=EAEggPjXhogtKAA

For more information about forming requests, see General API request format.

Response exampleResponse example

<DeleteMessageResponse>
    <ResponseMetadata>
        <RequestId>c79cd3cb-ffb474f7-9d5a8a3e-e5db06c-7c4ef5d027dd4219c28bf6c2********</RequestId>
    </ResponseMetadata>
</DeleteMessageResponse>

Was the article helpful?

Previous
ChangeMessageVisibilityBatch
Next
DeleteMessageBatch
© 2025 Direct Cursus Technology L.L.C.