Cloudflare::API::R2
NAME
Cloudflare::API::R2 - manage R2 buckets through Cloudflare's REST API
SYNOPSIS
my $r2=$api->r2();
my $bucket=$r2->create_bucket({ name => 'my-app-assets' });
my $page=$r2->list_buckets(full_response => 1);
DESCRIPTION
Bucket management uses the account ID on Cloudflare::API. This module does not transfer bucket objects; use R2's S3-compatible API for object operations.
METHODS
- list_buckets(%query) — List buckets with named query filters. Returns
result;full_response => 1retains the envelope and pagination information. - get_bucket($name, %options) — Retrieve a bucket by name and return its
result. - create_bucket(%body, %options) — POST a bucket definition, normally including
name, and return itsresult. Other fields pass through to Cloudflare. - update_bucket($name, %body, %options) — PATCH a bucket and return its
result. - delete_bucket($name, %options) — DELETE a bucket and return the endpoint's
result, possiblyundeffor an empty body.
Every JSON method accepts full_response => 1. Bucket names are percent-encoded as path components. Create and update bodies must be hash references.
ERRORS
Missing account context, invalid names or bodies, HTTP and transport failures, and Cloudflare envelope failures cause exceptions as described in Cloudflare::API.
SEE ALSO
AUTHOR
Andrew Speer andrew.speer@isolutions.com.au
LICENSE and COPYRIGHT
Copyright (c) 2026 Andrew Speer. This software is free software under the same terms as Perl 5.