Created
April 14, 2021 23:24
-
-
Save dukedorje/07af17b05a6a658f0653cfac3c54718b to your computer and use it in GitHub Desktop.
Curl command to clear cloudflare cache with API Token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE}/purge_cache" \ | |
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
--data '{"files":["'$DEPLOY_URL'/index.html", "'$DEPLOY_URL'/manifest.json", "'$DEPLOY_URL'/asset-manifest.json", "'$DEPLOY_URL'/robots.txt"]}' | |
# Uses new API Token. You can give it only the power to purge caches | |
# Note the single quotes around $DEPLOY_URL -- this is to unquote the single quotes so it'll interpolate the variable properly |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment