API dns_records error 10000 Authentication Error

I’m trying to do some DNS stuff via the API but I’ve hit a road block at the basic hello world level.

I have created an API token with the permissions “All zones - Zone:Read, DNS:Read”

I can verify the token exists like so:

curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
     -H "Authorization: Bearer <APITOKEN>" \
     -H "Content-Type:application/json"

I get the response “This API Token is valid and active”.

When I try to query my dns entries like so:

curl -X GET "https://api.cloudflare.com/client/v4/zones/<ZONEID>/dns_records?type=A&name=<DOMAIN>&content=127.0.0.1&proxied=undefined&page=1&per_page=20&order=type&direction=desc&match=all" \
     -H "X-Auth-Email: <EMAIL>" \
     -H "X-Auth-Key: <APITOKEN>" \
     -H "Content-Type: application/json"

I get: {“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}

I copied the zone id from right side panel of my domain page on cloudflare and the domain and email are correct. I have also tried using various combinations of my global API key and using the “Authorization: Bearer” header, these either produce the same authentication error or “There was an unknown error.”

I copied these commands straight out of the documentation so I’m not really sure what to do.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.