Portal Community

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

Configuration

Connection

FieldTypeRequiredDescription
ApiTokenstringrequiredScoped Cloudflare API Token with Cache Purge permission. Store in BizFirst Credentials Manager.

Operation Fields

FieldTypeRequiredDescription
ZoneIdstringrequired32-character hexadecimal Zone ID.
UrlsarrayrequiredArray 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

CodeConditionResolution
MISSING_API_TOKENApiToken is emptySet the ApiToken credential with Cache Purge permission
MISSING_ZONE_IDZoneId is emptyProvide the Zone ID
UNKNOWN_ERRORInvalid URL format or exceeds 30 URL limitEnsure all URLs include protocol and subdomain; split into batches of 30 if needed

Output

Success Port

FieldTypeDescription
idstringPurge job ID assigned by Cloudflare — log for audit trail
statusstringok 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

ExpressionReturns
{{ $node.PurgeByUrl.output.id }}Purge job ID for audit log
{{ $node.PurgeByUrl.output.status }}"ok" on success

Node Policies & GuardRails

PolicyDetail
Use exact URLs including query stringsCloudflare treats /page and /page?q=1 as separate cache entries — purge each variant if needed
Batch requests for more than 30 URLsIf you need to purge more than 30 URLs, split into multiple cache/purgeByUrl calls using a Loop node
Use Cache Purge scoped tokenToken needs only Cache Purge permission — do not use a broader token
Store ApiToken in Credentials ManagerNever hardcode the token in configuration JSON
Log purge job IDsStore 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.