Cloudflare R2 icon

Cloudflare R2

Interact with Cloudflare R2 object storage. Upload, download, manage files and buckets. Supports batch operations, multipart uploads, and can be used as a tool by AI Agents.

Overview

The "Delete Multiple" operation in the Cloudflare R2 node allows users to delete multiple objects (files) from a specified R2 bucket in a single batch request. This is useful for efficiently managing and cleaning up storage by removing many files at once instead of deleting them individually.

Common scenarios include:

  • Bulk deletion of outdated or temporary files.
  • Cleaning up large sets of files after processing or migration.
  • Automating removal of multiple objects based on a list of keys.

For example, if you have a list of object keys such as:

file1.txt
folder/file2.jpg
another/file3.pdf

you can provide these keys to the node, and it will delete all these objects from the specified bucket in one operation.

Properties

Name Meaning
Bucket Name The name of the R2 bucket to operate on.
Object Keys One object key per line (max 1000 objects). Each key identifies an object to be deleted.

Output

The output JSON contains an array with a single object that includes:

  • success: A boolean indicating whether the deletion was successful.
  • deletedCount: The number of objects that were deleted.

Example output:

[
  {
    "success": true,
    "deletedCount": 3
  }
]

This confirms how many objects were removed from the bucket.

Dependencies

  • Requires a valid API authentication credential for Cloudflare R2.
  • The node depends on internal utility functions to interact with the Cloudflare R2 API.
  • No additional external services are required beyond Cloudflare R2 itself.

Troubleshooting

  • Error: "Cannot delete more than 1000 objects at once"
    This error occurs if the user provides more than 1000 object keys. To resolve, limit the number of keys to 1000 or fewer per execution.

  • Invalid bucket name or object keys format
    Ensure the bucket name exists and the object keys are correctly formatted (one per line, trimmed).

  • API authentication errors
    Verify that the API credentials are correctly configured and have sufficient permissions to delete objects.

  • Partial failures
    If some objects do not exist or cannot be deleted, the node may throw an error unless "Continue On Fail" is enabled, which will return error details per item.

Links and References

Discussion