Our Servebolt Optimizer plugin allows you to directly connect your site to Cloudflare via their API. Connecting your site to your Cloudflare account can be done in two ways. Creating a Cloudflare API token or using the Cloudflare API key.
Create Cloudflare API token
A Cloudflare API token is the most preferred way to connecting your site to your Cloudflare account. A token allows for much more granular access control. You can learn more about how to create a Cloudflare API token here.
Recommended permissions for API tokens
When you create an API token with Cloudflare, you can select what permissions to set for it. We recommend these:
Zone > Zone > Edit
Zone > Cache Purge > Purge
We also recommend setting the zone resources for the specific zone/domain that will use the API token.
Use Cloudflare API key
The other option is using your general Cloudflare API key to connect your site to your Cloudflare account. The drawback of using the API key is that it connects your entire account – with every zone (domain) in there. You can find your Cloudflare API key by following these instructions.
Connect Cloudflare to your site via the API token
After you’ve created the API token, you’ll then need to use that token – which looks like a long string of numbers and text – to connect your site. Navigate to the Servebolt Optimizer plugin menu, specifically the Cache menu, in the Dashboard of your site. On that page you’ll be asked to make a choice of what Authentication type to use. Select API token and you’ll be prompted to enter the API token.
Additionally, you’ll need to enter the Cloudflare Zone ID of your domain. You can find this on the overview page of your domain in your Cloudflare account. In the bottom of your right hand sidebar.
Connect Cloudflare to your site via the API key
After you’ve copied the API key from you Cloudflare profile account, you’ll then need to use that key – which looks like a long string of numbers and text – to connect your site. Navigate to the Servebolt Optimizer plugin menu called Cloudflare Cache in the Dashboard of your site and select API key for Authentication type.
Once you’ve selected the API key, you’ll be prompted to enter the email address connected to your Cloudflare account and the API key you just copied.
After you’ve entered both, you’ll be able to select which domain/Zone ID to connect to.