Purge Cache using a Global API

Hey everyone :wave:t2:

Is the only way purging a cache is knowing the zone id? Is there an API call where I can purge cache and pass the domain instead of zone id?

I remember using it before, but I’m not sure it got deprecated?

If there’s no option, what’s the programmatic to fetch the zone id and do a cache purge? Any tips?

You’d have to hit the API to get the zone ID first:
https://api.cloudflare.com/#zone-list-zones

I’ve looked at this before, I was hoping this is not the only way. But do I have to traverse all pages of domains? We got a couple of hundreds. Is there an API call just to get a zone for a particular domain?

Like get zone id for example.com

It does that. Look at the optional parameters.

1 Like