PHP Client for Cloudflare API
R2

Custom Domains

Custom Domains endpoint reference.

List

List custom domains for a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->customDomains()->list('ACCOUNT_ID', 'BUCKET_NAME', 'JURISDICTION');
View this operation on the Cloudflare API Reference

Create

Add a custom domain to a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
valuesarrayYesValues to set, e.g. `domain`, `zoneId`, `enabled`.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->customDomains()->create('ACCOUNT_ID', 'BUCKET_NAME', [], 'JURISDICTION');
View this operation on the Cloudflare API Reference

Get

Get an existing custom domain for a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
domainstringYesCustom domain name.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->customDomains()->get('ACCOUNT_ID', 'BUCKET_NAME', 'DOMAIN', 'JURISDICTION');
View this operation on the Cloudflare API Reference

Update

Update an existing custom domain for a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
domainstringYesCustom domain name.
valuesarrayYesValues to set, e.g. `enabled`, `minTLS`, `ciphers`.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->customDomains()->update('ACCOUNT_ID', 'BUCKET_NAME', 'DOMAIN', [], 'JURISDICTION');
View this operation on the Cloudflare API Reference

Delete

Remove a custom domain from a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
domainstringYesCustom domain name.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->customDomains()->delete('ACCOUNT_ID', 'BUCKET_NAME', 'DOMAIN', 'JURISDICTION');
View this operation on the Cloudflare API Reference
Copyright © 2026