API GET call to just list all the zones


I am trying to run an API call to get a list of all the zones, and not able to filter it out to just the zones without all the extra data. Does anybody know, and/or, can provide an example of how to use filters for Cloudflare API calls, I am lost on this one.

I tried filtering via zones?fields=name and its combination or -d (field:name) and i am still getting the full data dump, but i simple want the list off all the zones.

Thanks in advance!

To retrieve a list of all the zones using Cloudflare’s API and filter out unnecessary data, you can use the fields parameter. Here is an example API call with filters:

curl -X GET "https://api.cloudflare.com/client/v4/zones?per_page=50&order=status&direction=desc&match=all" \
     -H "Authorization: Bearer <API_TOKEN>" \
     -H "Content-Type:application/json" \
     --data '{"status":"active","fields":"id,name"}'

In this example, we’re filtering out all fields except for id and name.

You can modify the filter to suit your needs by changing the “fields” value in above curl command.

Note that when specifying multiple fields to be included or excluded from response it is necessary to separate them with commas.