List Api Help pls

CloudFlare api list help
#!/bin/bash

MY_IP=$(curl https://ifconfig.me/ip) # ideally radar.cloudflare.com/ip but dont support

AUTH_KEY="###"
AUTH_EMAIL="###"
API_ACCOUNT_ID="###"
API_LIST_ID="###"
API_ENDPOINT="https://api.cloudflare.com/client/v4/accounts/$API_ACCOUNT_ID/rules/lists/$API_LIST_ID/items"

curl -X POST "$API_ENDPOINT" \
-H "X-Auth-Email: $AUTH_EMAIL" \
-H "X-Auth-Key: $AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"items":[{"ip":"'"$MY_IP"'"}]}'
#!/bin/bash

MY_IP=$(curl https://ifconfig.me/ip) # ideally radar.cloudflare.com/ip but dont support

AUTH_KEY="###"
AUTH_EMAIL="###"
API_ACCOUNT_ID="###"
API_LIST_ID="###"
API_ENDPOINT="https://api.cloudflare.com/client/v4/accounts/$API_ACCOUNT_ID/rules/lists/$API_LIST_ID/items"

curl -X POST "$API_ENDPOINT" \
-H "X-Auth-Email: $AUTH_EMAIL" \
-H "X-Auth-Key: $AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"items":[{"ip":"'"$MY_IP"'"}]}'
bash list-whitelist-ip.sh
{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
{"success":false,"errors":[{"code":10000,"message":"Authentication error"}]}
2 Replies
Chaika
Chaikaā€¢9mo ago
Are you using the Global API Key or a API Token? API Tokens should be like: -H "Authorization: Bearer $AUTH_Token" \ That json is invalid as well, and a "POST" would be endlessly appending your IPs to the list, I assume you'd want to replace the list each time, ex
curl -X PUT "$API_ENDPOINT" \
-H "X-Auth-Email: $AUTH_EMAIL" \
-H "X-Auth-Key: $AUTH_KEY" \
-H "Content-Type: application/json" \
--data "[{\"ip\":\"$MY_IP\"}]"
curl -X PUT "$API_ENDPOINT" \
-H "X-Auth-Email: $AUTH_EMAIL" \
-H "X-Auth-Key: $AUTH_KEY" \
-H "Content-Type: application/json" \
--data "[{\"ip\":\"$MY_IP\"}]"
:) EpickyHrac
:) EpickyHracOPā€¢9mo ago
I use Global API Key šŸ¤¦ā€ā™‚ļø for me, I got all time bad email in script (I just have only email alias without hostname) Working now, but Thanks, anyways šŸ˜„ And is possible add array of ipv4? like 2 ips)?
Want results from more Discord servers?
Add your server