---
title: "Delete object"
sidebar_label: "Delete object"
description: "How to delete one or more objects"
sidebar_position: 7
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from 'docs-kit/components'
import Formbricks from '@theme/MDXComponents/Formbricks'
import ArrowNestedIcon from 'docs-kit/icons/arrow-nested'

# Delete object

:::info

If the bucket has an [access policy](/s3/buckets/bucket-policy/), it must allow object deletion; see the [Actions](/s3/buckets/bucket-policy/about-bucket-policy.mdx#actions) subsection of the Access Policy instruction for details.

:::

When [deleting an object](#delete-object), consider [specifics of deleting segmented objects](#delete-segmented-object).

If [versioning](/s3/buckets/versioning.mdx) is enabled or suspended in a bucket, some objects can be recovered after deletion; see the section [Deleting objects with versioning enabled or suspended](#delete-object-with-versioning-enabled) for more details. If versioning in the bucket is disabled (has never been enabled), the object is permanently deleted.

If an object has an active lock ([Object Lock](/s3/buckets/object-lock.mdx)), the ability to delete it depends on the lock type and mode; see the [Delete an object with Object Lock](#delete-object-with-object-lock) subsection for details.

When deleting objects via [S3 API](/api/object-storage-s3/), you can use [conditional requests](/s3/objects/conditional-requests.mdx).

## Delete object \{#delete-object}

1. In the [control panel](https://my.selectel.ru/storage/), on the top menu, click **Products** and select **S3**.
2. Go to the **Buckets** section.
3. Open the bucket page → **Objects** tab.
4. Select the object you want to delete.
5. Click **Delete**.
6. Enter **delete** to confirm the deletion.
7. Click **Start deletion**.

## Delete a segmented object \{#delete-segmented-object}

:::danger

When storing an object, do not delete its segments in the service bucket — this will break the entire file.

:::

To delete a [segmented object](/s3/objects/upload-object.mdx#segmented-upload), delete the manifest file. Use the same API used for object uploading for deletion. When [deleting via the Control Panel](#delete-object), the Swift API is used.

If uploading and deleting an object are performed in different ways (for example, the object was uploaded via S3 API but deleted in the control panel), the object segments might not be deleted; they will remain in the hidden bucket and continue to be billed.

## Delete an object with versioning enabled or suspended \{#delete-object-with-versioning-enabled}

If [versioning](/s3/buckets/versioning.mdx) is enabled or suspended in the bucket, the object may have versions — objects with the same name that were uploaded earlier than the current object version.

The behavior when deleting an object depends on whether you are deleting the object with or without specifying a version:

* when [deleting without specifying a version](#delete-object-without-version-id), the current object version is moved to the versions list. An empty object with its own version ID and a **Delete marker** tag will be created as the current version. To make the object available to users, [restore it](/s3/objects/restore-object.mdx) from any version that does not have a **Delete marker**.
* when [deleting a specific version](#delete-specific-version), the version is deleted without the possibility of recovery. If the version being deleted is:

  * current — the version will become an empty object and appear in the version list with the **Deleted** tag. The most recent version in the list without the **Deleted** tag becomes the current object version;
  * previous — it will be removed from the version list entirely.

  If the version being deleted is the only one, the object cannot be restored.

### Delete an object without specifying a version \{#delete-object-without-version-id}

:::info

To delete an object without specifying a version via API or other tools, do not specify the `version-id` parameter.

:::

1. In the [control panel](https://my.selectel.ru/storage/), on the top menu, click **Products** and select **S3**.
2. Go to the **Buckets** section.
3. Open the bucket page → **Objects** tab.
4. Ensure that the **Versions** toggle is turned off.
5. Select the object you want to delete.
6. Click **Delete**.
7. Enter **delete** to confirm the deletion.
8. Click **Start deletion**.

### Delete a specific version \{#delete-specific-version}

:::info

To delete a specific version via API or other tools, specify the `version-id` parameter with the [version ID](/s3/buckets/versioning.mdx#version-id).

:::

1. In the [control panel](https://my.selectel.ru/storage/), on the top menu, click **Products** and select **S3**.
2. Go to the **Buckets** section.
3. Open the bucket page → **Objects** tab.
4. Turn on the **Versions** toggle.
5. Select the version you want to delete.
6. Click **Delete**.
7. Enter **delete** to confirm the deletion.
8. Click **Start deletion**.

## Delete an object with Object Lock \{#delete-object-with-object-lock}

If an object has an active lock, the ability to delete it depends on the [lock type and mode](/s3/buckets/object-lock.mdx#lock-types-and-modes):

* compliance/legal hold — to delete, you must [disable the lock](/s3/objects/manage-object-lock.mdx#disable-legal-hold);
* retention period:

  * in Governance mode — the object can only be deleted by a user with the [`member`](/s3/manage/manage-access.mdx#member) role or a user with a different role, if the access policy allows them the [action](/s3/buckets/bucket-policy/about-bucket-policy.mdx#actions) `s3:BypassGovernanceRetention`. Other users will be able to delete the object only after the lock period expires;
  * in Compliance mode — the object cannot be deleted before the lock period expires.

In buckets with Object Lock, operations to delete objects with an active lock via the Control Panel, [Swift API](/api/object-storage-swift/) and [Swift API (old](/api/object-storage-swift-old/)) will return an error. To bypass the lock via the [action](/s3/buckets/bucket-policy/about-bucket-policy.mdx#actions) of the access policy `s3:BypassGovernance` or to disable it, use the [S3 API](/api/object-storage-s3/) or [tools](/s3/tools/) that use it — for example, [AWS CLI](/s3/tools/aws-cli.mdx).

<Formbricks />
