Skip to content

Get Cloudflare API

The purpose of this work is to connect the panel to the Cloudflare. By doing this, when you create a subdomain in the panel; Cloudflare automatically creates them and gets a certificate for them. Also, the process of creating workers is automated. Follow the steps below in order to get the Cloudflare key token.

  1. First of all, log in to your Cloudflare account and register your domain. If you need more information for this, please read this link.

  2. From here , go to My Profile > API Tokens.

  3. Select Create Token.

  1. Choose a template from available templates or create a custom token. We suggest to use Edit zone DNS template as in the example below.

  1. In this step, configure Zone permission and resources as follows.

You can change token permissions from (Account, User, or Zone). Most groups offer "Edit" or "Read" options. "Edit" is full CRUDL (create, read, update, delete, list) access, while "Read" is read and list permission if necessary. See available token permissions for more information.

Proceed as follows to apply changes to your domains and Workers.

  • Set the Zone permission to DNS and in Edit mode to allow adding different subdomains.

  • Click the Add more button and select the Workers Scripts option in the Account section and give it Edit permission.

  • In the Account Resources section, select All accounts.

  • In the Zone Resources section, allocate resources to your account. That is, select All zones from an account and then select your Cloudflare account.

  • Finally, click Continue to summary.

  • Select Create Token to create the token.

Token summary screen displaying the resources and permissions selected

  1. Copy the token.

Finally, click Continue to summary.

After creating the token; go to the panel and in Very advanced settings; paste the token in the specified field as shown in the image below.

Now, if you create a new subdomain in the domains section of the panel; Cloudflare settings are done automatically. Also, workers are created automatically.


Last update: April 17, 2024

Comments