Cache Control Cloudflare API Key Permissions

Using my Cloudflare Global API key the Cache Control works fine. When I define what I think are appropriate permissions for the key I get the following error in the cache modal on any site that do not have Cloudflare proxy enabled (all of domains DNS are on Cloudflare though).

( Cloudflare ) Error Purging Cache. Please check the log page for more info.

On the log page for the site in question it says:

| Disabled | Plugin Not Found
Cloudflare | 16 minutes ago | 1 | Cloudflare => Cache auto cleared on: (2025-10-22 09:31:12)

What permissions do I need so the Cache Control plugin knows not to try to clear the cache of a domain on Cloudflare that does not actual have proxy enabled?

Here is what I currently have setup:

Thanks

Hey @eSIlverStrike

I’m checking with the dev team and will update you as soon as I can.

Any word on the permissions needed? For security reasons I rather not use a key that gives permissions that are not needed.

Hey @eSIlverStrike

API key permissions cannot be used to exclude specific domains/sites from processing.

Right now, our Cloudflare cache call doesn’t skip zones that aren’t proxied; it attempts a purge on everything you selected. That’s why you’re seeing the purge error on domains with proxy off.

This is something we will address in a future MainWP Child plugin release.

Required API key permissions for general usage:
Zone: Read
Cache Purge: Purge

Okay… when I use the Global API key that has full permissions to everything the error doesn’t happen though (( Cloudflare ) Error Purging Cache. Please check the log page for more info.)

I’ll just leave the tight permissions as is for now on the API key since it is something you will be addressing in the future and since it is not really hurting anything since those sites don’t have a Cloudflare cache to clear. I do wonder why the api key with all permissions doesn’t produce the error though.

Just an update… a different error started happening on all sites even those with Cloudflare proxy enabled. I am using the 2 permissions you gave. This error has happened previously. I am not sure why.

This is what shows in the logs for sites that have Cloudflare proxy enabled:

Nginx Helper => Cache auto cleared on: (2025-10-27 08:35:10)
Cloudflare => There was an issue purging the cache. {“code”:6003,“message”:“Invalid request headers”,“error_chain”:[{“code”:6103,“message”:“Invalid format for X-Auth-Key header”}]}-{“code”:7003,“message”:“Could not route to /client/v4/zones/purge_cache, perhaps your object identifier is invalid?”}

If I switch to the global API key that has permissions for everything it works fine.

I have since deleted the old token I created with the permissions and created a new one with the same permissions and the error is still happening.

Hey @eSIlverStrike

The team will investigate the details of this, but it does appear that full permissions for the API key.

I will update you in this thread once we have a new release of the Cache Control add-on ready.

Hey @eSIlverStrike

Sorry about the delay on this.

The team has prepared a fix for this. Let me know if you’d like me to send you a pre-release version via a Direct Message.

Sure. Let me know the security settings needed for the key as well.

I’ve just sent you the pre-release version in a DM.

The team has added a new method of authentication via Token, along with the existing Email/API key.

The old method of Email/API key still requires full permissions.

While the new Token will only have the permissions assigned when creating the token in Cloudflare.

When is this update planned to be released?

I will check with the team for an ETA.

Have you had the chance to test the pre-release I sent you via a DM?

No I had not yet.

I didn’t want to use my production mainwp site since I saw I needed to also update the child plugin and I assumed I would have to do that for all websites connected else the cache control for the other websites would have stopped working.

Could I have just updated one client and tested?

Yes, you can test it by installing the Child plugin on only one client site, and the Cache Control add-on on your Dashboard site.

Okay I tested it.

One site had the updated client and I updated the Cache Control Addon.

I removed my regular Cloudflare API settings (email and API key) and I switched on the Use Cloudflare Token. I then created a token which I just added Clearing of cache permission too and added it to the Token setting of the addon.

I then synched all sites. I then added a change to the homepage of the website with the dropbox client plugin and updated one other site with the latest version of the client plugin (non dropbox version)

I then cleared the cache of all sites and all sites had there cache cleared.

So things look like they work. Even with sites which did not have the updated client. Is this because they now have the code required to use a token?

Any feedback from my post above regarding being able to update my MainWP client since the latest version seems to work with the beta version of the Cache Control plugin?

Also one problem I have with the current implementation of the Token is I cannot set custom ones for specific websites.

The reason I need to do this is the token API only is for websites directly on my Cloudflare Account. Some cloudflare accounts are my clients and while they have given me access on my account the token cannot see those websites (where as the Global API could).

I would like to request a feature were I could get the client to create a custom token and I could apply it to a specific website.

Hey @eSIlverStrike

Checking with the dev team. Will get back to you as soon as I can.

Any word on this question?