Search code examples
apicurlcloudflare

Authentication error using cloudflare api


I repeatedly received an authentication error just like this (not me) when using the Cloudflare api.

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"

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

What am I doing wrong?


Solution

  • I was getting that exact same error message, and I found out that I was using the API Token instead of the API Key in the X-Auth-Key parameter.