Adding Custom Domains to R2 buckets

For an application I’m building, I’m looking at using Cloudflare R2 mainly due to storage pricing but also it being able to be backed by a CDN for free.

My thought so far is to be able to create buckets using the API but also be able to create a Custom Domain for that bucket, which can be done in the dashboard but I can’t see docs to do this on the API.

Is this a planned feature in the API or are the docs missing?

You ever find out the answer to this? I think I’m running into the same issue. I’m able to create a R2 bucket using the S3 API commands, using terraform’s ‘aws_s3_bucket’ resource, but I can’t set any of the web hosting options. I’m able to create DNS records using terraform’s ‘cloudflare_record’ resource, but you can’t seem to create a hostname with a type of R2; only things like A, CNAME, TXT, etc.

It “seems” like I’m missing something or it’s not possible. I don’t want to have to manually go to every R2 bucket and then to Settings and then Public Access and then add a custom hostname, this needs to be automated somehow (bash+curl or bash+wrangler, python script, terraform, ansible, etc.).

Any luck finding out anything on your end?