Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs: add info for r2 rotation

adilson7b4d5b6ef34e
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/create.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/create.mdx
new file mode 100644
index 0000000000..7a8c563e4d
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/create.mdx
@@ -0,0 +1,100 @@
+---
+title: "Create"
+openapi: "POST /api/v2/secret-rotations/cloudflare-r2-access-key"
+---
+
+<Note>
+ Check out the configuration docs for [Cloudflare R2 Access Key Rotations](/documentation/platform/secret-rotation/cloudflare-r2-access-key) to learn how to obtain the required parameters.
+</Note>
+
+Creates a Cloudflare R2 Access Key secret rotation. Infisical will create and rotate the underlying Cloudflare API token via your [Cloudflare connection](/integrations/app-connections/cloudflare), derive the S3-compatible access key from it, and write the credentials to the specified secret path.
+
+## Request body
+
+| Field | Type | Required | Description |
+|-------|------|----------|-------------|
+| `name` | string | Yes | A unique name for the rotation (max 100 characters). |
+| `projectId` | string (UUID) | Yes | The project ID. |
+| `connectionId` | string (UUID) | Yes | ID of the Cloudflare app connection. |
+| `environment` | string | Yes | Environment slug (e.g. `dev`, `prod`). |
+| `secretPath` | string | Yes | Path where the generated access key secrets will be stored. |
+| `isAutoRotationEnabled` | boolean | No | Whether to rotate automatically on the schedule. Defaults to `true`. |
+| `rotationInterval` | number | Yes | Days between rotations (minimum `1`). |
+| `rotateAtUtc` | object | No | Time of day (UTC) to run rotation: `{ "hours", "minutes" }`. Defaults to `{ "hours": 0, "minutes": 0 }`. |
+| `parameters.name` | string | Yes | The name for the generated Cloudflare API token that backs the access key (max 100 characters). A timestamp is appended to each generated token. |
+| `parameters.buckets` | array | Yes | The R2 buckets the generated access key is scoped to. At least one bucket is required, and each entry must be unique. |
+| `parameters.buckets[].name` | string | Yes | The bucket's name, exactly as it appears in Cloudflare. |
+| `parameters.buckets[].jurisdiction` | string | No | The bucket's storage jurisdiction: `"default"`, `"eu"`, or `"fedramp"`. Defaults to `"default"`. |
+| `parameters.accessLevel` | string | Yes | What the generated key can do on the selected buckets: `"object-read"` (get and list) or `"object-read-write"` (also put and delete). |
+| `parameters.allowedIps` | string[] | No | The IP addresses or CIDR blocks the generated access key is restricted to. |
+| `parameters.disallowedIps` | string[] | No | The IP addresses or CIDR blocks the generated access key is denied from. |
+| `secretsMapping.accessKeyId` | string | Yes | Secret key name to store the generated access key ID (e.g. `CLOUDFLARE_R2_ACCESS_KEY_ID`). |
+| `secretsMapping.secretAccessKey` | string | Yes | Secret key name to store the generated secret access key (e.g. `CLOUDFLARE_R2_SECRET_ACCESS_KEY`). |
+| `secretsMapping.apiToken` | string | Yes | Secret key name to store the underlying Cloudflare API token value (e.g. `CLOUDFLARE_R2_API_TOKEN`). |
+| `description` | string | No | Optional description. |
+
+## Sample request
+
+```bash
+curl --request POST \
+ --url https://us.infisical.com/api/v2/secret-rotations/cloudflare-r2-access-key \
+ --header 'Content-Type: application/json' \
+ --header 'Authorization: Bearer <ACCESS_TOKEN>' \
+ --data '{
+ "name": "my-r2-access-key-rotation",
+ "projectId": "<project-id>",
+ "description": "Cloudflare R2 access key rotation",
+ "connectionId": "<cloudflare-connection-id>",
+ "environment": "dev",
+ "secretPath": "/",
+ "isAutoRotationEnabled": true,
+ "rotationInterval": 30,
+ "rotateAtUtc": { "hours": 0, "minutes": 0 },
+ "parameters": {
+ "name": "infisical-r2-access-key",
+ "buckets": [
+ { "name": "my-bucket", "jurisdiction": "default" },
+ { "name": "my-eu-bucket", "jurisdiction": "eu" }
+ ],
+ "accessLevel": "object-read",
+ "allowedIps": ["203.0.113.0/24"]
+ },
+ "secretsMapping": {
+ "accessKeyId": "CLOUDFLARE_R2_ACCESS_KEY_ID",
+ "secretAccessKey": "CLOUDFLARE_R2_SECRET_ACCESS_KEY",
+ "apiToken": "CLOUDFLARE_R2_API_TOKEN"
+ }
+ }'
+```
+
+## Sample response
+
+```json
+{
+ "secretRotation": {
+ "id": "<rotation-id>",
+ "name": "my-r2-access-key-rotation",
+ "description": "Cloudflare R2 access key rotation",
+ "secretsMapping": {
+ "accessKeyId": "CLOUDFLARE_R2_ACCESS_KEY_ID",
+ "secretAccessKey": "CLOUDFLARE_R2_SECRET_ACCESS_KEY",
+ "apiToken": "CLOUDFLARE_R2_API_TOKEN"
+ },
+ "isAutoRotationEnabled": true,
+ "activeIndex": 0,
+ "connectionId": "<cloudflare-connection-id>",
+ "rotationInterval": 30,
+ "rotateAtUtc": { "hours": 0, "minutes": 0 },
+ "type": "cloudflare-r2-access-key",
+ "parameters": {
+ "name": "infisical-r2-access-key",
+ "buckets": [
+ { "name": "my-bucket", "jurisdiction": "default" },
+ { "name": "my-eu-bucket", "jurisdiction": "eu" }
+ ],
+ "accessLevel": "object-read",
+ "allowedIps": ["203.0.113.0/24"]
+ }
+ }
+}
+```
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/delete.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/delete.mdx
new file mode 100644
index 0000000000..804fe2373a
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v2/secret-rotations/cloudflare-r2-access-key/{rotationId}"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-id.mdx
new file mode 100644
index 0000000000..0ac7b6bd7f
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by ID"
+openapi: "GET /api/v2/secret-rotations/cloudflare-r2-access-key/{rotationId}"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-name.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-name.mdx
new file mode 100644
index 0000000000..5ff5e8c51e
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-name.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by Name"
+openapi: "GET /api/v2/secret-rotations/cloudflare-r2-access-key/rotation-name/{rotationName}"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-generated-credentials-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-generated-credentials-by-id.mdx
new file mode 100644
index 0000000000..fa9399c1b2
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-generated-credentials-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get Credentials by ID"
+openapi: "GET /api/v2/secret-rotations/cloudflare-r2-access-key/{rotationId}/generated-credentials"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/list.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/list.mdx
new file mode 100644
index 0000000000..d475483450
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v2/secret-rotations/cloudflare-r2-access-key"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/rotate-secrets.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/rotate-secrets.mdx
new file mode 100644
index 0000000000..1dd619fbb3
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/rotate-secrets.mdx
@@ -0,0 +1,4 @@
+---
+title: "Rotate Secrets"
+openapi: "POST /api/v2/secret-rotations/cloudflare-r2-access-key/{rotationId}/rotate-secrets"
+---
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/update.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/update.mdx
new file mode 100644
index 0000000000..6e751f0db3
--- /dev/null
+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/update.mdx
@@ -0,0 +1,4 @@
+---
+title: "Update"
+openapi: "PATCH /api/v2/secret-rotations/cloudflare-r2-access-key/{rotationId}"
+---
diff --git a/docs/docs.json b/docs/docs.json
index 82c6959805..06e4eb7d1a 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -537,6 +537,7 @@
"group": "SaaS & Platforms",
"pages": [
"documentation/platform/secret-rotation/cloudflare-api-token",
+ "documentation/platform/secret-rotation/cloudflare-r2-access-key",
"documentation/platform/secret-rotation/convex-access-key",
"documentation/platform/secret-rotation/databricks-service-principal-secret",
"documentation/platform/secret-rotation/datadog-application-key-secret",
@@ -2833,6 +2834,19 @@
"api-reference/endpoints/secret-rotations/cloudflare-api-token/update"
]
},
+ {
+ "group": "Cloudflare R2 Access Key",
+ "pages": [
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/create",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/delete",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-id",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-by-name",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/get-generated-credentials-by-id",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/list",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/rotate-secrets",
+ "api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/update"
+ ]
+ },
{
"group": "Supabase API Key",
"pages": [
diff --git a/docs/documentation/platform/secret-rotation/cloudflare-r2-access-key.mdx b/docs/documentation/platform/secret-rotation/cloudflare-r2-access-key.mdx
new file mode 100644
index 0000000000..242c38f80e
--- /dev/null
+++ b/docs/documentation/platform/secret-rotation/cloudflare-r2-access-key.mdx
@@ -0,0 +1,172 @@
+---
+title: "Cloudflare R2 Access Key"
+description: "Learn how to automatically rotate Cloudflare R2 access keys."
+---
+
+<Note>
+ **Rotation Type: Dual-Phase**
+
+ This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.
+</Note>
+
+An R2 access key is a Cloudflare API token viewed through R2's S3-compatible API: the **Access Key ID** is the token's ID, and the **Secret Access Key** is the SHA-256 hash of the token's value. This rotation creates that token scoped to the buckets you select, then hands you all three values as secrets.
+
+## Prerequisites
+
+- Create a [Cloudflare Connection](/integrations/app-connections/cloudflare). That connection is used to create and delete API tokens on your behalf during rotation.
+- The connection's API token must include:
+ - **Account** - **API Tokens** - **Edit**, to create and revoke the generated tokens.
+ - **Account** - **Workers R2 Storage** - **Read**, so Infisical can list your buckets for the bucket picker.
+
+ See the **Secret Rotation** tab under [Configure API Token and Account ID for Infisical](/integrations/app-connections/cloudflare#configure-api-token-and-account-id-for-infisical) for the exact configuration.
+
+## Create a Cloudflare R2 Access Key Rotation in Infisical
+
+<Tabs>
+ <Tab title="Infisical UI">
+ 1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
+
+ ![Secret Manager Dashboard](/images/secret-rotations-v2/generic/add-secret-rotation.png)
+
+ 2. Select the **Cloudflare R2 Access Key** option.
+
+ ![Select Cloudflare R2 Access Key](/images/secret-rotations-v2/cloudflare-r2-access-key/select-cloudflare-r2-access-key.png)
+
+ 3. Configure the rotation behavior, then click **Next**.
+
+ - **Cloudflare Connection** - The connection that will create and delete access keys during rotation.
+ - **Rotation Interval** - The interval, in days, after which a rotation is triggered.
+ - **Rotate At** - The local time of day when rotation runs once the interval has elapsed.
+ - **Auto-Rotation Enabled** - Whether to rotate automatically on the interval. Turn off to rotate only manually or pause rotation.
+
+ ![Rotation Configuration](/images/secret-rotations-v2/cloudflare-r2-access-key/configuration.png)
+
+ 4. Set the R2 access key parameters, then click **Next**.
+
+ The **General** tab defines the key Infisical generates:
+
+ - **Token Name** - The name for the generated Cloudflare API token, up to 100 characters. A timestamp is appended to each generated token so every rotation produces a distinct name in Cloudflare.
+ - **Buckets** - The R2 buckets the generated key can act on. The list is fetched through your Cloudflare Connection and covers every jurisdiction your account has enabled; buckets outside the `default` jurisdiction are labelled with theirs.
+ - **Access Level** - What the generated key can do on the selected buckets:
+ - `Object Read only` - Read and list objects.
+ - `Object Read & Write` - Read, list, write, and delete objects.
+
+ The **Restrictions** tab optionally limits where the generated key can be used:
+
+ - **Allowed IPs** (optional) - The generated key can only be used from these IP addresses or CIDR blocks, one entry per line. Leave empty to allow any IP.
+ - **Disallowed IPs** (optional) - The generated key cannot be used from these IP addresses or CIDR blocks, one entry per line.
+
+ ![Rotation Parameters](/images/secret-rotations-v2/cloudflare-r2-access-key/parameters.png)
+
+ 5. Specify the secret names that the rotated credentials will be mapped to. Then click **Next**.
+
+ - **Access Key ID** - The name of the secret in Infisical where the generated access key ID will be stored.
+ - **Secret Access Key** - The name of the secret in Infisical where the generated secret access key will be stored.
+ - **API Token** - The name of the secret in Infisical where the underlying Cloudflare API token value will be stored. Use this one when calling the Cloudflare REST API rather than R2's S3 API.
+
+ ![Rotation Secrets Mapping](/images/secret-rotations-v2/cloudflare-r2-access-key/secrets-mapping.png)
+
+ 6. Give your rotation a name and description (optional). Then click **Next**.
+
+ - **Name** - A slug-friendly name for this rotation configuration.
+ - **Description** (optional) - Notes about this rotation.
+
+ ![Rotation Details](/images/secret-rotations-v2/cloudflare-r2-access-key/details.png)
+
+ 7. Review your configuration, then click **Create Secret Rotation**.
+
+ ![Rotation Review](/images/secret-rotations-v2/cloudflare-r2-access-key/review.png)
+
+ 8. Your **Cloudflare R2 Access Key** rotation is created. The credentials are available as secrets at the mapped path, and work with any S3 client pointed at `https://<account-id>.r2.cloudflarestorage.com`. Rotations will create a new key, switch the active secrets to it, then revoke the previous key for zero-downtime rotation.
+
+ ![Rotation Created](/images/secret-rotations-v2/cloudflare-r2-access-key/created.png)
+
+ <Note>
+ Infisical sets an expiration on every token it generates, calculated as twice the rotation interval plus one day, with a minimum of 7 days. This guarantees a key can never expire while it is still the active or previous credential.
+ </Note>
+ </Tab>
+ <Tab title="API">
+ To create a Cloudflare R2 Access Key rotation, call the [Create Cloudflare R2 Access Key Rotation](/api-reference/endpoints/secret-rotations/cloudflare-r2-access-key/create) API endpoint.
+
+ ### Sample request
+
+ ```bash Request
+ curl --request POST \
+ --url https://us.infisical.com/api/v2/secret-rotations/cloudflare-r2-access-key \
+ --header 'Content-Type: application/json' \
+ --data '{
+ "name": "my-r2-access-key-rotation",
+ "projectId": "<project-id>",
+ "description": "Cloudflare R2 access key rotation",
+ "connectionId": "<cloudflare-connection-id>",
+ "environment": "dev",
+ "secretPath": "/",
+ "isAutoRotationEnabled": true,
+ "rotationInterval": 30,
+ "rotateAtUtc": {
+ "hours": 0,
+ "minutes": 0
+ },
+ "parameters": {
+ "name": "infisical-r2-access-key",
+ "buckets": [
+ { "name": "my-bucket", "jurisdiction": "default" }
+ ],
+ "accessLevel": "object-read",
+ "allowedIps": ["203.0.113.0/24"]
+ },
+ "secretsMapping": {
+ "accessKeyId": "CLOUDFLARE_R2_ACCESS_KEY_ID",
+ "secretAccessKey": "CLOUDFLARE_R2_SECRET_ACCESS_KEY",
+ "apiToken": "CLOUDFLARE_R2_API_TOKEN"
+ }
+ }'
+ ```
+
+ ### Sample response
+
+ ```bash Response
+ {
+ "secretRotation": {
+ "id": "<rotation-id>",
+ "name": "my-r2-access-key-rotation",
+ "description": "Cloudflare R2 access key rotation",
+ "secretsMapping": {
+ "accessKeyId": "CLOUDFLARE_R2_ACCESS_KEY_ID",
+ "secretAccessKey": "CLOUDFLARE_R2_SECRET_ACCESS_KEY",
+ "apiToken": "CLOUDFLARE_R2_API_TOKEN"
+ },
+ "isAutoRotationEnabled": true,
+ "activeIndex": 0,
+ "connectionId": "<cloudflare-connection-id>",
+ "rotationInterval": 30,
+ "rotateAtUtc": { "hours": 0, "minutes": 0 },
+ "type": "cloudflare-r2-access-key",
+ "parameters": {
+ "name": "infisical-r2-access-key",
+ "buckets": [
+ { "name": "my-bucket", "jurisdiction": "default" }
+ ],
+ "accessLevel": "object-read",
+ "allowedIps": ["203.0.113.0/24"]
+ }
+ }
+ }
+ ```
+ </Tab>
+</Tabs>
+
+## Using the credentials
+
+The generated credentials work with any S3-compatible client:
+
+```bash
+AWS_ACCESS_KEY_ID=$CLOUDFLARE_R2_ACCESS_KEY_ID \
+AWS_SECRET_ACCESS_KEY=$CLOUDFLARE_R2_SECRET_ACCESS_KEY \
+ aws s3 ls s3://my-bucket --endpoint-url https://<account-id>.r2.cloudflarestorage.com
+```
+
+## Notes
+
+- **Buckets are granted by name.** The token's policy references each bucket by its name and jurisdiction, so renaming or recreating a bucket in Cloudflare breaks the grant. Cloudflare does not reject unknown bucket names, so a stale name produces a key that silently grants nothing on it — update the rotation's parameters after renaming a bucket.
+- **Parameter changes apply on the next rotation.** Editing the buckets or access level does not re-scope the key that is currently active; the change takes effect when the next key is generated. Trigger a manual rotation if you need it applied immediately.
diff --git a/docs/integrations/app-connections/cloudflare.mdx b/docs/integrations/app-connections/cloudflare.mdx
index e7bfcff661..e44d8fedcf 100644
--- a/docs/integrations/app-connections/cloudflare.mdx
+++ b/docs/integrations/app-connections/cloudflare.mdx
@@ -96,6 +96,19 @@ Infisical supports connecting to Cloudflare using API tokens and Account ID for
The generated tokens are not granted these permissions. Each rotated token only receives the access policies you configure on the [Cloudflare API Token rotation](/documentation/platform/secret-rotation/cloudflare-api-token) itself.
+ Add these permissions to your API token and click **Continue to summary**, then **Create Token** to generate your API token.
+ </Accordion>
+ <Accordion title="Cloudflare R2 Access Key">
+ An R2 access key is a Cloudflare API token, so rotating one needs the same **API Tokens** - **Edit** permission, plus read access to R2 so Infisical can list your buckets.
+
+ **Required Permissions:**
+ - **Account** - **API Tokens** - **Edit**
+ - **Account** - **Workers R2 Storage** - **Read**
+
+ **API Tokens** - **Edit** is what allows Infisical to create the replacement key and revoke the previous one on each rotation cycle. **Workers R2 Storage** - **Read** is used only to populate the bucket picker when you configure the rotation; without it the picker comes back empty and you cannot select buckets.
+
+ The generated keys are not granted these permissions. Each rotated key only receives object access to the buckets you select on the [Cloudflare R2 Access Key rotation](/documentation/platform/secret-rotation/cloudflare-r2-access-key) itself.
+
Add these permissions to your API token and click **Continue to summary**, then **Create Token** to generate your API token.
</Accordion>
</AccordionGroup>
diff --git a/docs/snippets/RotationsBrowser.jsx b/docs/snippets/RotationsBrowser.jsx
index fce87e4536..34c43b205d 100644
--- a/docs/snippets/RotationsBrowser.jsx
+++ b/docs/snippets/RotationsBrowser.jsx
@@ -50,6 +50,15 @@ export const RotationsBrowser = () => {
category: "Cloud Providers",
rotationType: "Dual-Phase",
},
+ {
+ name: "Cloudflare R2 Access Key",
+ slug: "cloudflare-r2-access-key",
+ path: "/documentation/platform/secret-rotation/cloudflare-r2-access-key",
+ description:
+ "Learn how to automatically rotate Cloudflare R2 access keys.",
+ category: "Cloud Providers",
+ rotationType: "Dual-Phase",
+ },
{
name: "Convex Access Key",
slug: "convex-access-key",