Getting "code":10000,"message":"Authentication error" while using api

So,

I was trying to use this script posted here(Block list of ips) to block IPs that are attacking our server via API.

I already entered my Zone id, email, authenkey on the script.

But when i run it, i got these error:
./block.sh badips.txt
{“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}
curl: (6) Could not resolve host: –data
curl: (3) nested brace in URL position 25:
{“mode”:“block”,“scope”:{“id”:“id”,“name”:“My Organization”,“type”:“organization”},“configuration”:{“target”:“ip”,“value”:“101.108.174.251”},“notes”:“Mass Block”}

So what could be the issue here?
I double/ triple check the email and authenkey already.

Thanks

The syntax of your cURL call is broken. Double check that and if something is unclear clarify it at e.g. StackExchange. That’s a scripting/Bash issue. Your credentials will be all right.

1 Like

I am using CURL like this, where do you think the problem could be?

curl -sSX POST "https://api.cloudflare.com/client/v4/zones/$zones/firewall/access_rules/rules" \
    -H "X-Auth-Email: $email" \
    -H "X-Auth-Key: $authkey" \
    -H "Content-Type: application/json" \
    –data "{\"mode\":\"block\",\"scope\":{\"id\":\"$id\",\"name\":\"$org_name\",\"type\":\"organization\"},\"configuration\":{\"target\":\"ip\",\"value\":\"$ip\"},\"notes\":\"$notes\"}" ;

I am afraid Bash scripting is beyond the scope of the forum.