PATCH method not allowed for the api_token authentication scheme

Hello,
I apologize in advance for my English.

I encountered a strange problem, I assume I am doing something wrong. I’m trying to make a script that will enable/disable rate limiting when the CPU reaches X%. Unfortunately, but when trying to run a CURL query, it throws me an error {"success":false,"errors":[{"code":10000,"message":"PATCH method not allowed for the api_token authentication scheme"}]}

I have created an API key here, which I am typing in my command as -H "Authorization: Bearer AUTH_KEY

But unfortunately it still does not work, I have no idea what I am doing wrong, here the whole command

curl --request PATCH "https://api.cloudflare.com/client/v4/zones/ZONE_ID/rate_limits/RATE_RULES_ID" -H "X-Auth-Email: MAIL" -H "Authorization: Bearer AUTH_KEY" -H "Content-Type: application/json" --data "{\"id\":\"RATE_RULES_ID\",\"disabled\":true}"

I also tried this way, but unfortunately it does not work.

curl --silent -o /dev/null -X PATCH "https://api.cloudflare.com/client/v4/zones/ZONE_ID/rate_limits/RATE_RULES_ID" -H "X-Auth-Email: MAIL" -H "X-Auth-Key: Global_API_Key" -H "Content-Type: application/json" --data '{"id":"RATE_RULES_ID","disabled":false}'

Thank you in advance for your help

Hi, it looks like you’re using the old Rate Limiting rules. Please check out the docs for the new endpoint: Create rate limiting rules via API · Cloudflare Web Application Firewall (WAF) docs

1 Like

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