All Products
Search
Document Center

Object Storage Service:delete-multiple-objects

Last Updated:Mar 20, 2026

Delete multiple objects from the same bucket in a single request. You can delete up to 1,000 objects per request.

Warning

Deleted objects cannot be recovered. Proceed with caution.

Prerequisites

Before you begin, ensure that you have:

  • The oss:DeleteObject permission. By default, an Alibaba Cloud account has this permission. RAM users and Security Token Service (STS) users must be granted this permission explicitly. See Attach a custom policy to a RAM user.

Command syntax

ossutil api delete-multiple-objects --bucket <bucket-name> --delete <delete-config> [flags]

Required parameters

ParameterTypeDescription
--bucketstringName of the bucket.
--deletestringDeletion configuration in XML or JSON format. See the --delete format section below.

Optional parameters

ParameterTypeDescription
--encoding-typestringEncoding type for object names in the response.

For all supported flags, see Command-line options.

This command maps to the DeleteMultipleObjects API operation. For a full parameter reference, see the API documentation.

--delete format

The --delete parameter accepts XML or JSON. Use the file:// prefix to load the configuration from a file.

Key fields:

FieldTypeRequiredDescription
QuietstringNoControls the response content. When true, the response lists only objects that failed to delete. When false (default), the response lists all deleted objects.
KeystringYesThe object key (name or path) of the object to delete.
VersionIdstringNoThe version ID of the specific object version to delete. Omit this field to delete the current version.

XML format:

<Delete>
    <Quiet>false</Quiet>
    <Object>
        <Key>string</Key>
        <VersionId>string</VersionId>
    </Object>
    <Object>
        <Key>string</Key>
        <VersionId>string</VersionId>
    </Object>
</Delete>

JSON format:

{
  "Quiet": "false",
  "Object": [
    {
      "Key": "string",
      "VersionId": "string"
    },
    {
      "Key": "string",
      "VersionId": "string"
    }
  ]
}

Examples

Delete multiple objects using an XML file

Create a file named delete.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Delete>
    <Quiet>false</Quiet>
    <Object>
        <Key>multipart.data</Key>
    </Object>
    <Object>
        <Key>test.jpg</Key>
    </Object>
</Delete>

Run the command:

ossutil api delete-multiple-objects --bucket examplebucket --delete file://delete.xml

Delete multiple objects using a JSON file

Create a file named delete.json:

{
  "Quiet": "false",
  "Object": [
    {
      "Key": "multipart.data"
    },
    {
      "Key": "test.jpg"
    }
  ]
}

Run the command:

ossutil api delete-multiple-objects --bucket examplebucket --delete file://delete.json

Delete multiple objects with inline JSON

Pass the deletion configuration directly in the command:

ossutil api delete-multiple-objects --bucket examplebucket --delete "{\"Quiet\":\"false\",\"Object\":[{\"Key\":\"multipart.data\"},{\"Key\":\"test.jpg\"}]}"

Delete specific versions of multiple objects

To delete specific versions of objects in a versioning-enabled bucket, include the VersionId field for each object.

Create a file named delete.json:

{
  "Quiet": "false",
  "Object": [
    {
      "Key": "multipart.data",
      "VersionId": "CAEQNRiBgIDyz.6C0BYiIGQ2NWEwNmVhNTA3ZTQ3MzM5ODliYjM1ZTdjYjA4****"
    },
    {
      "Key": "test.jpg",
      "VersionId": "CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy****"
    }
  ]
}

Run the command:

ossutil api delete-multiple-objects --bucket examplebucket --delete file://delete.json

To pass version IDs inline:

ossutil api delete-multiple-objects --bucket examplebucket --delete "{\"Quiet\":\"false\",\"Object\":[{\"Key\":\"multipart.data\",\"VersionId\":\"CAEQNRiBgIDyz.6C0BYiIGQ2NWEwNmVhNTA3ZTQ3MzM5ODliYjM1ZTdjYjA4****\"},{\"Key\":\"test.jpg\",\"VersionId\":\"CAEQMhiBgIDB3aWB0BYiIGUzYTA3YzliMzVmNzRkZGM5NjllYTVlMjYyYWEy****\"}]}"