ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developersโ€ข2y agoโ€ข
4 replies
Garrett

API support for creating R2 S3 credentials

I need to dynamically create S3 style credentials (i.e. api key and key secret combo) to enable writes to a dynamically created R2 bucket. I'm looking to use the API to create these.

I've successfully created a bucket using the API and an auth token configured with the R2 edit permission.

I have not been able to create the S3 style credentials using the API, however.

This interface looks promising: https://developers.cloudflare.com/api/operations/user-api-tokens-create-token

However, the result does not contain (at least per the docs) the S3 creds - it only contains the token value. ALSO, I'm unable to configure an auth token with the permission to use this API call in the first place.

Under https://dash.cloudflare.com/profile/api-tokens I can add permissions for a token. However, I don't see a permission that allows editing/creating API tokens.

To summarize:

1. How can I use the API to create an API token? This requires granting permission for this, which I haven't been able to do.
2. How can I create an API token that returns S3 style credentials for editing an R2 bucket?
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

R2 S3 API Custom Domain
Cloudflare DevelopersCDCloudflare Developers / general-help
17mo ago
r2 custom domain support for aws-s3 sdk
Cloudflare DevelopersCDCloudflare Developers / general-help
10mo ago
R2 S3 API returns 403 Access Denied for all operations
Cloudflare DevelopersCDCloudflare Developers / general-help
3mo ago
500 Error from Cloudflare's R2 S3 Api
Cloudflare DevelopersCDCloudflare Developers / general-help
3y ago