Clears cached content of one of your Cloudflare zones: everything, or by URLs, host names, cache tags or URL prefixes.
curl -X POST "https://api.primaryapi.com/v1/run/cloudflare.purge_cache" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"zone":"example.com","urls":["https://www.example.com/css/styles.css","https://www.example.com/js/index.js"]}'{
"output": {
"found": true,
"data": {
"count": 2,
"accepted": true,
"zone": "example.com",
"purged": "urls", …
}
},
"credits": 1
}Input and output
7 fields
example.com.["https://www.example.com/css/styles.cs….7 fields
Good to know
Changes your account. This call creates, edits or deletes something in the connected account, live. Confirm before running it. With an Idempotency-Key it never runs twice, and monitors can’t schedule it.
Runs as your connected Cloudflare account. Needs the "Purge cache" permission.
Purging changes what your live site serves. The next request for purged content goes to your origin, and Cloudflare does not serve purged content again even if the origin is down.
Prefer URLs, tags, hosts or prefixes over everything.
Every URL, host and prefix must belong to the zone.
Accepted means Cloudflare took the request, not that anything was cached.
The same key and credits work for every API.