How to get zone id for all domains

Hi,
i am trying to automate DNS update using api.
1st thing that i need to do is to get the list of zone id’s, how can we get all those id’s using curl or any other commands, or can i get that info. from Cloudflare dashboard?

https://api.cloudflare.com/#zone-list-zones

Thank you for providing that that link, i am not sure where i’ll find the information to get the id’s for multiple zones.
examples says to run the command with zone id’s. after doing a quick search, some users says to use the string as id(https://dash.cloudflare.com/STRING/DOMAIN_NAME.com),
when i use that string getting this error:
[{“code”:1000,“message”:“Invalid zone identifier”}

so i am sure i am missing something here.
Thank you,

Well, the parameters are all optional. Dont provide any and you get all zones.

Try something like this:

curl -s -X GET "https://api.cloudflare.com/client/v4/zones/?per_page=100" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json"| jq -r '.result[] | "\(.id) \(.name)"'

Replace auth_email and auth_key with your own values. You will need jq in your path.

1 Like

This topic was automatically closed after 31 days. New replies are no longer allowed.