Error code 7003, with template based API Token


I am trying to modify DNS values (IP), with an API Token based tine DNS edit template, but I am getting error code 7003, i am no geting the Zone_ID and the DNS_Record_ID

With the global API key my script works, but I don`t like use the global.

My account is the free suscription, can I use the API token custom?

Need I to add some other permission to the token?

the current template adds:
_ [email protected]’s Account
___ domain[.]net - DNS:Edit


Those should work. Can you share more of the error output and your script so we can get a better picture.

Thanks, the error:
“code”: 7003,
“message”: “Could not route to /client/v4/zones/null/dns_records/null, perhaps your object identifier is invalid?”

the script uses the next routine:

get the zone id for the requested zone

zoneid=$(curl -s -X GET “https[:]//api[.]Cloudflare[.[com/client/v4/zones?name=$zone&status=active”
-H “X-Auth-Email: $cloudflare_auth_email”
-H “X-Auth-Key: $cloudflare_auth_key”
-H “Content-Type: application/json” | jq -r ‘{“result”} | .[0] | .id’)

echo “Zoneid for $zone is $zoneid”

get the dns record id

dnsrecordid=$(curl -s -X GET “https[:]//api{.]Cloudflare[.]com/client/v4/zones/$zoneid/dns_records?type=A&name=$dnsrecord”
-H “X-Auth-Email: $cloudflare_auth_email”
-H “X-Auth-Key: $cloudflare_auth_key”
-H “Content-Type: application/json” | jq -r ‘{“result”} | .[0] | .id’)

echo “DNSrecordid for $dnsrecord is $dnsrecordid”

Your variables are being filled in. You should to make sure that zoneid and dnsrecordid are being set correctly from their responses.

Yes, the script do that, with the global api key,

but not with the custom token.

Ah, can you try adding Zone:Zone:Read permissions to the API token.

Thanks Cyber-Jak3, didn`t work…

I have used all this permissions: All zones - Zone Versioning:Edit, Zone Versioning:Read, Zone Settings:Edit, Zone Settings:Read, Zone:Read, DNS:Read, Zone:Edit, DNS:Edit