Skip to content
Start here

Configure Custom Domain Settings

client.r2.buckets.domains.custom.update(stringbucketName, stringdomain, CustomUpdateParams { account_id, ciphers, enabled, 2 more } params, RequestOptionsoptions?): CustomUpdateResponse { domain, ciphers, enabled, minTLS }
PUT/accounts/{account_id}/r2/buckets/{bucket_name}/domains/custom/{domain}

Edit the configuration for a custom domain on an existing R2 bucket.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
ParametersExpand Collapse
bucketName: string

Name of the bucket.

maxLength64
minLength3
domain: string

Name of the custom domain.

params: CustomUpdateParams { account_id, ciphers, enabled, 2 more }
account_id: string

Path param: Account ID.

maxLength32
ciphers?: Array<string>

Body param: An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.

enabled?: boolean

Body param: Whether to enable public bucket access at the specified custom domain.

minTLS?: "1.0" | "1.1" | "1.2" | "1.3"

Body param: Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to previous value.

One of the following:
"1.0"
"1.1"
"1.2"
"1.3"
jurisdiction?: "default" | "eu" | "fedramp"

Header param: Jurisdiction where objects in this bucket are guaranteed to be stored.

One of the following:
"default"
"eu"
"fedramp"
ReturnsExpand Collapse
CustomUpdateResponse { domain, ciphers, enabled, minTLS }
domain: string

Domain name of the affected custom domain.

ciphers?: Array<string>

An allowlist of ciphers for TLS termination. These ciphers must be in the BoringSSL format.

enabled?: boolean

Whether this bucket is publicly accessible at the specified custom domain.

minTLS?: "1.0" | "1.1" | "1.2" | "1.3"

Minimum TLS Version the custom domain will accept for incoming connections. If not set, defaults to 1.0.

One of the following:
"1.0"
"1.1"
"1.2"
"1.3"

Configure Custom Domain Settings

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const custom = await client.r2.buckets.domains.custom.update(
  'example-bucket',
  'example-domain/custom-domain.com',
  { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
);

console.log(custom.domain);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "domain": "example-domain.com",
    "ciphers": [
      "string"
    ],
    "enabled": true,
    "minTLS": "1.0"
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": {
    "domain": "example-domain.com",
    "ciphers": [
      "string"
    ],
    "enabled": true,
    "minTLS": "1.0"
  },
  "success": true
}