[Yandex Cloud documentation](../../../index.md) > [Yandex Message Queue](../../index.md) > [API reference](../index.md) > Message > DeleteMessageBatch

# DeleteMessageBatch

Method for deleting multiple messages from a queue. You can delete up to 10 messages at once.

The result of changing each message's visibility timeout is reported individually in the response. Since deleting a message may either be a success or a failure, make sure to check all results, even if code 200 is returned in response to the `DeleteMessageBatch` method call.

## Request {#request}

### Request parameters {#request-parameters}

Parameter | Type | Required parameter | Description
----- | ----- | ----- | -----
`QueueUrl` | **string** | Yes | URL of the queue where the message is placed.
`DeleteMessageBatchRequestEntry.N` | **array** | Yes | The [DeleteMessageBatchRequestEntry](../data-types/DeleteMessageBatchRequestEntry.md) array that contains the `ReceiptHandle` parameters of the messages to delete.

## Response {#response}

### Successful response fields {#response-parameters}

Field | Type | Description
----- | ----- | -----
`BatchResultErrorEntry.N` | **array** | The `BatchResultErrorEntry` array that contains request execution errors.
`DeleteMessageBatchResultEntry.N` | **array** | The [DeleteMessageBatchResultEntry](../data-types/DeleteMessageBatchResultEntry.md) array with the IDs of the messages that have been deleted.

### DeleteMessageBatch errors {#errors}

For a list of errors common for all methods, see [Common errors](../common-errors.md).

HTTP code | Error ID | Description
----- | ----- | -----
400 | `BatchEntryIdsNotDistinct` | Two or more batch entries in the request have the same ID.
400 | `EmptyBatchRequest` | The batch request does not contain any entries.
400 | `InvalidBatchEntryId` | The ID of a batch entry is invalid.
400 | `TooManyEntriesInBatchRequest` | Too many entries in a batch.

## Request example {#request-example}

```text
Action=DeleteMessageBatch
&Version=2012-11-05
&QueueUrl=https://message-queue.api.cloud.yandex.net/b1g8ad42m6he********/dj6000000000********/sample-queue
&DeleteMessageBatchRequestEntry.1.Id=dd2dd32b-eb1e7a37-f6b7a725***-*****
&DeleteMessageBatchRequestEntry.1.ReceiptHandle=EAEg89f********
&DeleteMessageBatchRequestEntry.2.Id=7e0e07f6-5c9a0a72-d304102f***-*****
&DeleteMessageBatchRequestEntry.2.ReceiptHandle=EAEgq5v********
```

For more on request formatting, see [General API request format](../index.md#api-request).

## Response example {#response-example}

```xml
<DeleteMessageBatchResponse>
    <DeleteMessageBatchResult>
        <DeleteMessageBatchResultEntry>
            <Id>dd2dd32b-eb1e7a37-f6b7a725***-*****</Id>
        </DeleteMessageBatchResultEntry>
        <DeleteMessageBatchResultEntry>
            <Id>7e0e07f6-5c9a0a72-d304102f***-*****</Id>
        </DeleteMessageBatchResultEntry>
    </DeleteMessageBatchResult>
    <ResponseMetadata>
        <RequestId>e02ca0b-5e6b6d98-cef0a99c-150a53b3-07ee55365ba1b6fd876875f0********</RequestId>
    </ResponseMetadata>
</DeleteMessageBatchResponse>
```