Got a 500 response when purging cache with API

Hi all,

I have tried to do a manual cache purge for a hosted zone. What I did was:

  1. Create an API token with Zone / Purge Cache > Edit
  2. With the generated token and the zone ID, call:
curl -X POST 
    https://api.cloudflare.com/client/v4/zones/${zone_id}/purge_cache
     -H "Authorization: Bearer ${api_token}"
     -H "Content-Type: application/json"
     --data '{"purge_everything":true}'

What is expected is a 200 response with JSON. However, what I got was instead a 500 response with an empty body. Any ideas on if my request is malformed, or is it a glitch or bug on the platform side? Thanks.

Thank you, I do see a defect report on this issue with a fix in process. That fix looks like it’s slated for early to mid August - sometime between now & mid-aug, but I’m sorry @kelvin.wong.jv, I don’t have a firm date but have added myself to the fix ticket to get updates and will post back once I see movement. Again, sorry for the issue.

No problem, glad to know the team acknowledges this and the fix is on the way. Thanks for the heads-up!

@cloonan does this issue mean that the purge API is non-functional right now, or are the 500 responses purely aesthetic (i.e. can we safely ignore the error)? If it’s non-functional, is there a workaround we can use until this is fixed without using a global API token?

Can confirm this is also happening to us!

I was preciously getting this error, but tried it again today and it seems to be working. Has the fix been pushed out? Or did I just get lucky?

It works for me now too. I guess @cloonan and the CF team have rolled out the updates?

Nice. I don’t recall a jira update, but will check details.