How to Obtain the R2 Secret Key via API

I can create an API token for Cloudflare R2 using the Cloudflare API, but it only returns the API token. S3 compatible clients need an ‘Access Key ID’ and ‘Secret Access Key’. The Cloudflare UI displays these values when we generate the token through it, but how can I obtain these values using the API?


The Access Key ID is the API token ID (not the token itself, the identifier for the token) as referenced by the API.

The Secret Access Key is the result of running sha256sum on the API token, in other words you want to create an SHA256 hash of the token and use that.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.