Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
docs: add docs for api token rotation
adilson24648d94779b
diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/create.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/create.mdxnew file mode 100644index 0000000000..ff52658216--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/create.mdx@@ -0,0 +1,104 @@+---+title: "Create"+openapi: "POST /api/v2/secret-rotations/cloudflare-api-token"+---++<Note>+ Check out the configuration docs for [Cloudflare API Token Rotations](/documentation/platform/secret-rotation/cloudflare-api-token) to learn how to obtain the required parameters.+</Note>++Creates a Cloudflare API Token secret rotation. Infisical will create and rotate API tokens via your [Cloudflare connection](/integrations/app-connections/cloudflare) and write them 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 API token 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 (max 100 characters). A timestamp is appended to each generated token. |+| `parameters.policies` | array | Yes | The access policies to attach to the generated Cloudflare API token. Each policy scopes a set of permission groups to either the entire account or a set of zones. At least one policy is required. |+| `parameters.policies[].effect` | string | Yes | Whether the policy grants or denies the permission groups: `"allow"` or `"deny"`. |+| `parameters.policies[].scope` | string | Yes | The resources the policy applies to: `"account"` (the entire account), `"all-zones"` (every zone in the account), or `"zones"` (specific zones). |+| `parameters.policies[].zoneIds` | string[] | Conditional | The IDs of the zones the policy applies to. Required when `scope` is `"zones"`, and rejected for the other scopes. |+| `parameters.policies[].permissionGroupIds` | string[] | Yes | The IDs of the Cloudflare permission groups to grant. At least one is required. |+| `parameters.allowedIps` | string[] | No | The IP addresses or CIDR blocks the generated Cloudflare API token is restricted to. |+| `parameters.disallowedIps` | string[] | No | The IP addresses or CIDR blocks the generated Cloudflare API token is denied from. |+| `secretsMapping.tokenId` | string | Yes | Secret key name to store the generated API token's ID (e.g. `CLOUDFLARE_API_TOKEN_ID`). |+| `secretsMapping.apiToken` | string | Yes | Secret key name to store the generated API token's value (e.g. `CLOUDFLARE_API_TOKEN`). |+| `description` | string | No | Optional description. |++## Sample request++```bash+curl --request POST \+ --url https://us.infisical.com/api/v2/secret-rotations/cloudflare-api-token \+ --header 'Content-Type: application/json' \+ --header 'Authorization: Bearer <ACCESS_TOKEN>' \+ --data '{+ "name": "my-cloudflare-rotation",+ "projectId": "<project-id>",+ "description": "Cloudflare API token rotation",+ "connectionId": "<cloudflare-connection-id>",+ "environment": "dev",+ "secretPath": "/",+ "isAutoRotationEnabled": true,+ "rotationInterval": 30,+ "rotateAtUtc": { "hours": 0, "minutes": 0 },+ "parameters": {+ "name": "infisical-rotated-token",+ "policies": [+ {+ "effect": "allow",+ "scope": "zones",+ "zoneIds": ["<zone-id>"],+ "permissionGroupIds": ["<permission-group-id>"]+ }+ ],+ "allowedIps": ["203.0.113.0/24"]+ },+ "secretsMapping": {+ "tokenId": "CLOUDFLARE_API_TOKEN_ID",+ "apiToken": "CLOUDFLARE_API_TOKEN"+ }+ }'+```++## Sample response++```json+{+ "secretRotation": {+ "id": "<rotation-id>",+ "name": "my-cloudflare-rotation",+ "description": "Cloudflare API token rotation",+ "secretsMapping": {+ "tokenId": "CLOUDFLARE_API_TOKEN_ID",+ "apiToken": "CLOUDFLARE_API_TOKEN"+ },+ "isAutoRotationEnabled": true,+ "activeIndex": 0,+ "connectionId": "<cloudflare-connection-id>",+ "rotationInterval": 30,+ "rotateAtUtc": { "hours": 0, "minutes": 0 },+ "type": "cloudflare-api-token",+ "parameters": {+ "name": "infisical-rotated-token",+ "policies": [+ {+ "effect": "allow",+ "scope": "zones",+ "zoneIds": ["<zone-id>"],+ "permissionGroupIds": ["<permission-group-id>"]+ }+ ],+ "allowedIps": ["203.0.113.0/24"]+ }+ }+}+```diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/delete.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/delete.mdxnew file mode 100644index 0000000000..98274cf7aa--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/delete.mdx@@ -0,0 +1,4 @@+---+title: "Delete"+openapi: "DELETE /api/v2/secret-rotations/cloudflare-api-token/{rotationId}"+---diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-id.mdxnew file mode 100644index 0000000000..648627f63d--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-id.mdx@@ -0,0 +1,4 @@+---+title: "Get by ID"+openapi: "GET /api/v2/secret-rotations/cloudflare-api-token/{rotationId}"+---diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-name.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-name.mdxnew file mode 100644index 0000000000..fb3ad4bf8c--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-name.mdx@@ -0,0 +1,4 @@+---+title: "Get by Name"+openapi: "GET /api/v2/secret-rotations/cloudflare-api-token/rotation-name/{rotationName}"+---diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-generated-credentials-by-id.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-generated-credentials-by-id.mdxnew file mode 100644index 0000000000..05d16c281c--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/get-generated-credentials-by-id.mdx@@ -0,0 +1,4 @@+---+title: "Get Credentials by ID"+openapi: "GET /api/v2/secret-rotations/cloudflare-api-token/{rotationId}/generated-credentials"+---diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/list.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/list.mdxnew file mode 100644index 0000000000..ddaf430973--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/list.mdx@@ -0,0 +1,4 @@+---+title: "List"+openapi: "GET /api/v2/secret-rotations/cloudflare-api-token"+---diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/rotate-secrets.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/rotate-secrets.mdxnew file mode 100644index 0000000000..c48ce022a2--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/rotate-secrets.mdx@@ -0,0 +1,4 @@+---+title: "Rotate Secrets"+openapi: "POST /api/v2/secret-rotations/cloudflare-api-token/{rotationId}/rotate-secrets"+---diff --git a/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/update.mdx b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/update.mdxnew file mode 100644index 0000000000..c25b820b1a--- /dev/null+++ b/docs/api-reference/endpoints/secret-rotations/cloudflare-api-token/update.mdx@@ -0,0 +1,4 @@+---+title: "Update"+openapi: "PATCH /api/v2/secret-rotations/cloudflare-api-token/{rotationId}"+---diff --git a/docs/docs.json b/docs/docs.jsonindex 59448520ee..82c6959805 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -536,6 +536,7 @@{"group": "SaaS & Platforms","pages": [+ "documentation/platform/secret-rotation/cloudflare-api-token","documentation/platform/secret-rotation/convex-access-key","documentation/platform/secret-rotation/databricks-service-principal-secret","documentation/platform/secret-rotation/datadog-application-key-secret",@@ -2819,6 +2820,19 @@"api-reference/endpoints/secret-rotations/snowflake-user-key-pair/update"]},+ {+ "group": "Cloudflare API Token",+ "pages": [+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/create",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/delete",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-id",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/get-by-name",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/get-generated-credentials-by-id",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/list",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/rotate-secrets",+ "api-reference/endpoints/secret-rotations/cloudflare-api-token/update"+ ]+ },{"group": "Supabase API Key","pages": [diff --git a/docs/documentation/platform/secret-rotation/cloudflare-api-token.mdx b/docs/documentation/platform/secret-rotation/cloudflare-api-token.mdxnew file mode 100644index 0000000000..7cba93d995--- /dev/null+++ b/docs/documentation/platform/secret-rotation/cloudflare-api-token.mdx@@ -0,0 +1,160 @@+---+title: "Cloudflare API Token"+description: "Learn how to automatically rotate Cloudflare API tokens."+---++<Note>+ **Rotation Type: Dual-Phase**++ This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.+</Note>++## 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 the **Account** - **API Tokens** - **Edit** permission. 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 API Token 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.++ ++ 2. Select the **Cloudflare API Token** option.++ ++ 3. Configure the rotation behavior, then click **Next**.++ - **Cloudflare Connection** - The connection that will create and delete API tokens 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.++ ++ 4. Set the Cloudflare API token parameters, then click **Next**.++ The **General** tab defines the token Infisical generates:++ - **Token Name** - The name for the generated token, up to 100 characters. A timestamp is appended to each generated token so every rotation produces a distinct name in Cloudflare.+ - **Access Policies** - The permissions granted to the generated token. Add a policy for each permission group you want to grant, using **Add policy**. Each policy has:+ - **Effect** - Whether to `Allow` or `Deny` the selected permission group.+ - **Scope** - The resources the policy applies to:+ - `Entire account` - The whole Cloudflare account the connection is bound to.+ - `All zones` - Every zone in the account, including zones added later.+ - `Specific zones` - Only the zones you select.+ - **Zones** - The zones the policy applies to. Shown only when the scope is `Specific zones`, and required in that case.+ - **Permission group** - The Cloudflare permission group to grant. The list is fetched through your Cloudflare Connection and filtered to the groups that are valid for the selected scope.++ Policies that target the same effect, scope, and zones are combined into a single Cloudflare policy when the token is created.++ The **Restrictions** tab optionally limits where the generated token can be used:++ - **Allowed IPs** (optional) - The generated token 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 token cannot be used from these IP addresses or CIDR blocks, one entry per line.++ ++ 5. Specify the secret names that the rotated API token will be mapped to. Then click **Next**.++ - **Token ID** - The name of the secret in Infisical where the generated token's ID will be stored.+ - **API Token** - The name of the secret in Infisical where the generated token's value will be stored.++ ++ 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.++ ++ 7. Review your configuration, then click **Create Secret Rotation**.++ ++ 8. Your **Cloudflare API Token** rotation is created. The current API token is available as a secret at the mapped path. Rotations will create a new token, switch the active secret to it, then revoke the previous token for zero-downtime rotation.++ ++ <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 token can never expire while it is still the active or previous credential.+ </Note>+ </Tab>+ <Tab title="API">+ To create a Cloudflare API Token rotation, call the [Create Cloudflare API Token Rotation](/api-reference/endpoints/secret-rotations/cloudflare-api-token/create) API endpoint.++ ### Sample request++ ```bash Request+ curl --request POST \+ --url https://us.infisical.com/api/v2/secret-rotations/cloudflare-api-token \+ --header 'Content-Type: application/json' \+ --data '{+ "name": "my-cloudflare-rotation",+ "projectId": "<project-id>",+ "description": "Cloudflare API token rotation",+ "connectionId": "<cloudflare-connection-id>",+ "environment": "dev",+ "secretPath": "/",+ "isAutoRotationEnabled": true,+ "rotationInterval": 30,+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "parameters": {+ "name": "infisical-rotated-token",+ "policies": [+ {+ "effect": "allow",+ "scope": "account",+ "permissionGroupIds": ["<permission-group-id>"]+ }+ ],+ "allowedIps": ["203.0.113.0/24"]+ },+ "secretsMapping": {+ "tokenId": "CLOUDFLARE_API_TOKEN_ID",+ "apiToken": "CLOUDFLARE_API_TOKEN"+ }+ }'+ ```++ ### Sample response++ ```bash Response+ {+ "secretRotation": {+ "id": "<rotation-id>",+ "name": "my-cloudflare-rotation",+ "description": "Cloudflare API token rotation",+ "secretsMapping": {+ "tokenId": "CLOUDFLARE_API_TOKEN_ID",+ "apiToken": "CLOUDFLARE_API_TOKEN"+ },+ "isAutoRotationEnabled": true,+ "activeIndex": 0,+ "connectionId": "<cloudflare-connection-id>",+ "rotationInterval": 30,+ "rotateAtUtc": { "hours": 0, "minutes": 0 },+ "type": "cloudflare-api-token",+ "parameters": {+ "name": "infisical-rotated-token",+ "policies": [+ {+ "effect": "allow",+ "scope": "account",+ "permissionGroupIds": ["<permission-group-id>"]+ }+ ],+ "allowedIps": ["203.0.113.0/24"]+ }+ }+ }+ ```+ </Tab>+</Tabs>diff --git a/docs/images/app-connections/cloudflare/cloudflare-api-token-configure-permissions.png b/docs/images/app-connections/cloudflare/cloudflare-api-token-configure-permissions.pngnew file mode 100644index 0000000000..22d39bd159Binary files /dev/null and b/docs/images/app-connections/cloudflare/cloudflare-api-token-configure-permissions.png differdiff --git a/docs/integrations/app-connections/cloudflare.mdx b/docs/integrations/app-connections/cloudflare.mdxindex 1db71bd115..e7bfcff661 100644--- a/docs/integrations/app-connections/cloudflare.mdx+++ b/docs/integrations/app-connections/cloudflare.mdx@@ -74,6 +74,28 @@ Infisical supports connecting to Cloudflare using API tokens and Account ID forThese permissions allow Infisical to upload, update, and delete custom SSL certificates in your Cloudflare zones.+ Add these permissions to your API token and click **Continue to summary**, then **Create Token** to generate your API token.+ </Accordion>+ </AccordionGroup>+ </Tab>+ <Tab title="Secret Rotation">+ <AccordionGroup>+ <Accordion title="Cloudflare API Token">+ Use the following permissions to grant Infisical access to create and revoke Cloudflare API tokens during rotation:++ ++ **Required Permissions:**+ - **Account** - **API Tokens** - **Edit**++ The **API Tokens** - **Edit** permission is what allows Infisical to create the replacement token and revoke the previous one on each rotation cycle. Without it, rotation fails when creating the new token.++ <Note>+ Infisical also uses this connection to list the zones and permission groups you can choose from when configuring the rotation. If you plan to scope generated tokens to specific zones, add **Account** - **Account Settings** - **Read** as well.+ </Note>++ 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></AccordionGroup>diff --git a/docs/snippets/RotationsBrowser.jsx b/docs/snippets/RotationsBrowser.jsxindex a223f0c616..fce87e4536 100644--- a/docs/snippets/RotationsBrowser.jsx+++ b/docs/snippets/RotationsBrowser.jsx@@ -41,6 +41,15 @@ export const RotationsBrowser = () => {category: "Data Analytics",rotationType: "Dual-Phase",},+ {+ name: "Cloudflare API Token",+ slug: "cloudflare-api-token",+ path: "/documentation/platform/secret-rotation/cloudflare-api-token",+ description:+ "Learn how to automatically rotate Cloudflare API tokens.",+ category: "Cloud Providers",+ rotationType: "Dual-Phase",+ },{name: "Convex Access Key",slug: "convex-access-key",