Portal / Nodes / Cloudflare / cache/purgeByUrl
cache/purgeByUrl
Purge specific URLs from the Cloudflare CDN cache. The most surgical cache invalidation method.
Exact URL match: The URL must exactly match the cached URL including protocol (https://), subdomain, path, and query string. Maximum 30 URLs per request. Purge is immediate — the next request for each URL will hit the origin.
When to Use
- Post-content update: After a CMS publishes an updated product page, blog post, or landing page, purge the specific page URL to ensure visitors immediately see the new content.
- Price change propagation: After updating product pricing in the database, purge the affected product page URLs to prevent users from seeing stale prices from cache.
- API response invalidation: After updating data that backs a specific API endpoint, purge that endpoint URL to clear any cached JSON response.
- Image replacement: After replacing a static image file at a specific path, purge the image URL to clear the old version from CDN edge nodes.
- Static asset update: After a targeted CSS or JavaScript file update, purge the asset URL to force browsers and edge nodes to fetch the latest version.
Configuration
Connection
| Field | Type | Required | Description |
ApiToken | string | required | Scoped Cloudflare API Token with Cache Purge permission. Store in BizFirst Credentials Manager. |
Operation Fields
| Field | Type | Required | Description |
ZoneId | string | required | 32-character hexadecimal Zone ID. |
Urls | array | required | Array of fully-qualified URLs to purge. Maximum 30 URLs per request. Must include protocol and full path. Example: ["https://example.com/products/widget-x", "https://example.com/images/hero.jpg"]. |
Sample Configuration
{
"resource": "cache",
"operation": "purgeByUrl",
"connection": {
"ApiToken": "{{ $credentials.cloudflare_cache_purge }}"
},
"ZoneId": "023e105f4ecef8ad9ca31a8372d0c353",
"Urls": [
"https://example.com/products/widget-x",
"https://example.com/products/widget-x?ref=homepage",
"https://example.com/images/widget-x-hero.jpg"
]
}
Validation Errors
| Code | Condition | Resolution |
MISSING_API_TOKEN | ApiToken is empty | Set the ApiToken credential with Cache Purge permission |
MISSING_ZONE_ID | ZoneId is empty | Provide the Zone ID |
UNKNOWN_ERROR | Invalid URL format or exceeds 30 URL limit | Ensure all URLs include protocol and subdomain; split into batches of 30 if needed |
Output
Success Port
| Field | Type | Description |
id | string | Purge job ID assigned by Cloudflare — log for audit trail |
status | string | ok when the purge request was accepted |
Error Port
On failure, the error port receives an object with code and message.
Sample Output
{
"id": "9a7806061c88ada191ed06f989cc3dac",
"status": "ok"
}
Expression Reference
| Expression | Returns |
{{ $node.PurgeByUrl.output.id }} | Purge job ID for audit log |
{{ $node.PurgeByUrl.output.status }} | "ok" on success |
Node Policies & GuardRails
| Policy | Detail |
| Use exact URLs including query strings | Cloudflare treats /page and /page?q=1 as separate cache entries — purge each variant if needed |
| Batch requests for more than 30 URLs | If you need to purge more than 30 URLs, split into multiple cache/purgeByUrl calls using a Loop node |
| Use Cache Purge scoped token | Token needs only Cache Purge permission — do not use a broader token |
| Store ApiToken in Credentials Manager | Never hardcode the token in configuration JSON |
| Log purge job IDs | Store returned id values in the deployment audit trail for incident investigation |
Examples
Example 1: CMS Publish Hook
When a CMS publishes a new or updated article: (1) The CMS sends a webhook with the updated page URL. (2) The workflow receives the URL via a WebhookTrigger. (3) Call cache/purgeByUrl with that URL (plus any variant URLs with query strings). (4) Log the purge job ID to the CMS deployment log.
Example 2: Post-Deployment URL Invalidation
After a deployment, read the list of changed files from the deployment manifest (an array of paths). Build the full URLs by prepending https://example.com to each path. Split into batches of 30 and call cache/purgeByUrl for each batch using a Loop node.
Example 3: Price Update Cache Invalidation
After a bulk price update in the database, query all affected product IDs. Build URLs for each product page: https://example.com/products/{id}. Pass the array to cache/purgeByUrl (batched in groups of 30). Send a completion notification with the count of URLs purged.