Cloudflare error code 10000 although authentication code is correct

As said here Cloudflare API Documentation,

I’m trying to list all dns records for one domain (my-website.com).

This works and says token in valid:


curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \

-H "Authorization: Bearer REDACTED" \

-H "Content-Type:application/json"

The response:


{"result":{"id":"9eabaec38a16a2005ee16513c0fb729a","status":"active","not_before":"2023-08-27T00:00:00Z","expires_on":"2023-09-30T23:59:59Z"},"success":true,"errors":[],"messages":[{"code":10000,"message":"This API Token is valid and active","type":null}]}

But when I try to list the DNS records, I see authentication error.

This is the URL in cloudflare for my-website.com’s URL: https://dash.cloudflare.com/c36d3ff9848f2ab40bc2ba288a1fb100/my-website.com/dns/records

This is what I curl:


curl --request GET \

--url https://api.cloudflare.com/client/v4/zones/c36d3ff9848f2ab40bc2ba288a1fb100/dns_records \

--header 'Content-Type: application/json' \

--header 'X-Auth-Key: REDACTED'

--header 'X-Auth-Email: [email protected]' \

--header "Authorization: Bearer REDACTED"

The X-Auth-Key is the Cloudflare Global API.

This is my response:


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

What am I doing or entering wrong?

I’ve tried to do as what says in the docs and other websites, but I can’t figure out what’s wrong.

All the data here are fake and the values are not my actual keys or tokens.

You don’t need X-Auth-Key or X-Auth-Email header if you are using an API token. There is an issue with the docs about it

1 Like

Thanks,

Yes, there’s an issue with the docs.
I found the zone id and account id in my account and replaced in the URL.

It’s solved.

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