API Key permissions to clear cache programatically

Hello,

I am working on a script which purges the CF cache programaticaly based on some events.
I am using PHP and cURL to achieve this. We generated and API Key with “Account Settings → Edit” permissions.

But when we make the API request returns: {“success”:false,“errors”:[{“code”:10000,“message”:“Authentication error”}]}

Do we need to assign the API key other permissions as well? If so which are those?

I am also tried sending it 2 different ways in the header but none worked:
X-Auth-Key: my_api_key
'Authorization: Bearer my_api_key

I don’t think it’s “Account Settings”. Try this:

1 Like