Purge everything using curl causes Request must contain one of purge_everything

I tried to purge everything using curl with this command in powershell

curl -X POST “https://api.cloudflare.com/client/v4/zones/<my_zone_id_here>/purge_cache” -H “X-Auth-Email: my_email_here” -H “X-Auth-Key: <my_auth_key_here>” -H “Content-Type: application/json” --data ‘{“purge_everything”:true}’

But always getting this error

“result”: null,
“success”: false,
“errors”: [
“code”: 1012,
“message”: “Request must contain one of “purge_everything”, “files”, “tags”, “hosts” or “prefixes””

What am I doing wrong?

I have tested that and works, only what I had to change is quotes ( not sure if this is due to formating here or your formatting

curl -X POST https://api.cloudflare.com/client/v4/zones/<ZONE>/purge_cache -H "X-Auth-Email:<EMAIL>" -H "X-Auth-Key:<KEY>" -H "Content-Type: application/json" --data '{"purge_everything":true}'

“result”: {
“id”: “XXXX”
“success”: true,
“errors”: ,

Really had no luck.

So I tried postman. How do we specify the --data in postman like in curl?

you have body field,

You can use collections, just import it and modify to your needs.

Thanks. Finally it worked in postman. Aside from the format… which is I used body, raw data and its {“purge_everything”:true}

Headers must also be checked. I accidentally unchecked Content-Length

But cannot make it work in curl. I used curl-7.77.0-win64-mingw

Try to use -v in curl to see what actually is sent, you can share screenshot with removed sensitive data. Additionally you could use Charles proxy for example and compare 2 requests, postman VS curl

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.