CF_TOKEN="..."
curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
-H "Authorization: Bearer $CF_TOKEN"
curl -X GET "https://api.cloudflare.com/client/v4/zones" \
-H "Content-Type:application/json" \
-H "Authorization: Bearer $CF_TOKEN" \
| jq -r '(.result[] | [.id, .name]) | @tsv'
Get Zone ID by name:
CF_ZONE_NAME="sib.li"
curl -X GET "https://api.cloudflare.com/client/v4/zones?name=$CF_ZONE_NAME&status=active" \
-H "Content-Type:application/json" \
-H "Authorization: Bearer $CF_TOKEN" \
| jq -r '.result[].id'
CF_ZONE_ID="..."
curl -X GET "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records" \
-H "Content-Type:application/json" \
-H "Authorization: Bearer $CF_TOKEN" \
| jq -r '(.result[] | [.id, .type, .name, .content]) | @tsv'
List records by name and type:
curl -X GET "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records?name=$CF_ZONE_NAME&type=A" \
-H "Content-Type:application/x-yaml" \
-H "Authorization: Bearer $CF_TOKEN" \
| jq -r '(.result[] | [.id, .type, .name, .content]) | @tsv'