[Yandex Cloud documentation](../../../../index.md) > [Yandex Object Storage](../../../index.md) > API reference > [AWS S3 REST](../../index.md) > [REST](../index.md) > Object > DeleteObjects

# Object Storage API, Amazon S3-compatible REST: DeleteObjects

Deletes objects based on a list of keys provided in a request.

It takes less time than deleting the same objects one by one via separate requests.

The delete list may contain up to 1,000 keys.

If an object does not exist, Object Storage marks it as deleted in the response.

You can configure responses so that Object Storage returns one of the following selections:

- Statuses of all delete operations.
- Only statuses with errors deleting objects. In this case, if no errors occurred, an empty response is returned.

For more information on getting started with the API and the general request format, see [How to use the S3 API](../../index.md).

## Request {#request}

```http
POST /{bucket}?delete HTTP/2
```

### Path parameters {#path-parameters}

Parameter | Description
----- | -----
`bucket` | Bucket name.


### Query parameters {#request-parameters}

Parameter | Description
----- | -----
`delete` | Flag indicating a delete operation.


### Headers {#request-headers}

Use the appropriate [common headers](../common-request-headers.md) in your request.

For this request, the `Content-MD5` and `Content-Length` headers are required.

Moreover, if governance-mode [retention](../../../concepts/object-lock.md) is put on object versions in a versioned bucket, make sure to use the below-specified header to bypass retention and confirm deletion. Only users with the [`storage.admin` role](../../../security/index.md) can delete a retained object version. To check the retention status, use the [getObjectRetention](getobjectretention.md) method.

Header | Description
--- | ---
`X-Amz-Bypass-Governance-Retention` | Header that confirms bypassing of the governance-mode retention. Set it to `true`.

### Data schema {#request-scheme}

Provide the list of keys to delete in XML format.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<Delete>
    <Quiet>true</Quiet>
    <Object>
         <Key>Key</Key>
    </Object>
    ...
</Delete>
```

Tag | Description
----- | -----
`Delete` | Contains the response body.<br/><br/>Path: `/Delete`.
`Quiet` | `<Quiet>true</Quiet>` enables <q>quiet</q> mode.<br/><br/>Object Storage will only include deletion errors in the response. If there are no errors, the request will not return the response body. If the specified object does not exist when requested, `Deleted` will be returned.<br/><br/>If the tag is not specified, the default values is `false`.<br/><br/>Path: `/Delete/Quiet`.
`Object` | Contains object deletion parameters.<br/><br/>Path: `/Delete/Object`.
`Key` | [Object key](../../../concepts/object.md#key).<br/><br/>Path: `/Delete/Object/Key`.
`VersionId` | [Object version](../../../concepts/versioning.md) ID. For example, to delete several versions of an object in one go.<br/><br/>Path: `/Delete/Object/VersionId`.


## Response {#response}

### Headers {#response-headers}

Responses can only contain [common headers](../common-response-headers.md).

### Response codes {#response-codes}

For a list of possible responses, see [Responses](../response-codes.md).

A successful response contains additional data in XML format with the schema described below.

### Data structure {#response-scheme}

```xml
<DeleteResult>
  <Deleted>
    <Key>some/key.txt</Key>
  </Deleted>
  <Error>
    <Key>some/another/key.txt</Key>
    <Code>TextErrorCode</Code>
    <Message>Describing message</Message>
  </Error>
</DeleteResult>
```

Tag | Description
----- | -----
`DeleteResult` | Response body.<br/><br/>Path: `/DeleteResult`.
`Deleted` | Successfully deleted object.<br/><br/>The tag is missing if the request was set to `<Quiet>true</Quiet>`.<br/><br/>Path: `/DeleteResult/Deleted`.
`Key` | Object key.<br/><br/>Path: `/DeleteResult/Deleted/Key` or `/DeleteResult/Error/Key`.
`Error` | Error deleting an object.<br/><br/>Path: `/DeleteResult/Error`.
`Code` | Error code.<br/>Path: `/DeleteResult/Error/Code`.
`Message` | Error description.<br/>Path: `/DeleteResult/Error/Message`.

#### Related articles {#related-articles}

* [Object](../../../concepts/object.md)

* [Deleting all objects from a bucket](../../../operations/objects/delete-all.md)

#### See also {#see-also}

* [Getting started with the AWS S3 API in Yandex Object Storage](../../s3-api-quickstart.md)

* [Debugging requests using the AWS CLI](../../signing-requests.md#debugging)

* [Example of sending a signed request using curl](../../../api-ref/authentication.md#s3-api-example)

* [Code example for generating a signature](../../../concepts/pre-signed-urls.md#code-examples)