Skip to main content

Delete object

Last update:
For your information

If the bucket has an access policy, it must allow object deletion; see the Actions subsection of the Access Policy instruction for details.

When deleting an object, consider specifics of deleting segmented objects.

If versioning is enabled or suspended in a bucket, some objects can be restored after deletion; see the Delete an object with versioning enabled or suspended subsection for details. If versioning is disabled in the bucket (never enabled), the object is deleted permanently.

If an object has an active lock (Object Lock), the ability to delete it depends on the lock type and mode; see the Delete an object with Object Lock subsection for details.

When deleting objects via S3 API, you can use conditional requests.

Delete object

  1. In the control panel, 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

carefully

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

To delete a segmented object, delete the manifest file. Use the API you used to upload the object to delete it. When deleting via the control panel, 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

If versioning 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, the current object version is moved to the version list. An empty object with its own version ID and a Deleted tag will be created as the current version. For the object to be available to users, restore it from any version without the Deleted.

  • when deleting a 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

For your information

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, 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

For your information

To delete a specific version via API or other tools, specify the version-id parameter with the version ID.

  1. In the control panel, 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

If an object has an active lock, the ability to delete it depends on the lock type and mode:

  • compliance/legal hold — to delete, you must disable the lock;

  • retention period:

    • in Governance mode — the object can only be deleted by a user with the member role or a user with a different role, if the access policy allows them the action 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, delete operations for objects with an active lock via Swift API and Swift API (old) will return an error. To bypass the lock via the access policy action s3:BypassGovernance or to disable it, use S3 API or tools that use it.