Configure a Cloud Connector rule via API
Last updated Aug 18, 2026 You can configure Cloud Connector rules using the Cloudflare API.
Required permissions
The API token used in API requests to manage Cloud Connector rules must have at least the following permission:
- Zone > Cloud Connector > Write
Note
A token with this permission is only valid for the Cloud Connector endpoints described in this page. You cannot use it to interact with the http_cloud_connector phase via Rulesets API.
Endpoints
To obtain the complete endpoint, append the Cloud Connector endpoints listed below to the Cloudflare API base URL:
https://api.cloudflare.com/client/v4
The {zone_id} argument is the zone ID (a hexadecimal string). You can find this value in the Cloudflare dashboard.
The following table summarizes the available operations.
| Operation | Verb + Endpoint |
|---|---|
| List Cloud Connector rules | GET /zones/{zone_id}/cloud_connector/rules |
| Create/update/delete Cloud Connector rules | PUT /zones/{zone_id}/cloud_connector/rules |
Example API calls
List of Cloud Connector rules
The following example returns a list of existing Cloud Connector rules:
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Cloud Connector Read</code>
- <code>Cloud Connector Write</code>
</details>
Rulesbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cloud_connector/rules" \
--request GET \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
"result": [
{
"id": "<RULE_1_ID>",
"provider": "aws_s3",
"expression": "http.request.uri.path wildcard \"/images/*\"",
"description": "Connect to S3 bucket containing images",
"enabled": true,
"parameters": {
"host": "examplebucketwithimages.s3.north-eu.amazonaws.com"
}
}
],
"success": true,
"errors": [],
"messages": []
}
Create/update/delete Cloud Connector rules
Caution
To create a new rule and keep all existing rules, you must include them all in your request body. Omitting an existing rule in the request body will delete the corresponding Cloud Connector rule.
The following example request will replace all existing Cloud Connector rules with a single rule:
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Cloud Connector Write</code>
</details>
Put Rulesbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cloud_connector/rules" \
--request PUT \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '[
{
"expression": "http.request.uri.path wildcard \"/images/*\"",
"provider": "cloudflare_r2",
"description": "Connect to R2 bucket containing images",
"parameters": {
"host": "mybucketcustomdomain.example.com"
}
}
]'
The required body parameters for each rule are: expression, provider, and parameters.host.
The provider value must be one of the following: cloudflare_r2, aws_s3, azure_storage, gcp_storage, and oci_storage.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/rules/cloud-connector/create-api/#page","headline":"Configure a Cloud Connector rule via API","description":"Create Cloud Connector rules using the Cloudflare API.","url":"https://developers.cloudflare.com/rules/cloud-connector/create-api/","inLanguage":"en","image":"https://developers.cloudflare.com/rules/cloud-connector/create-api/og.png?v=a182bcd614f9d7ff","dateModified":"2026-08-18","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Create Cloud Connector rules in the Cloudflare dashboard. title: Configure a Cloud Connector rule in the dashboard image: https://developers.cloudflare.com/rules/cloud-connector/create-dashboard/og.png?v=9eebfbcb7a5d7f8d
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/rules/llms.txt
Use this file to discover all available pages before exploring further.
Docs