59 lines
3.0 KiB
Markdown
59 lines
3.0 KiB
Markdown
---
|
|
title: Tutorial on automating subdomain registration on Cloudflare
|
|
---
|
|
|
|
<div dir="ltr" markdown="1">
|
|
|
|
# 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](/manager/domain-worker-cdn-and-tunneling/Domain-types-and-how-to-register-them/).
|
|
|
|
2. From [here](https://dash.cloudflare.com/profile/api-tokens/) , go to **My Profile** > **API Tokens**.
|
|
|
|
3. Select `Create Token`.
|
|
|
|

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

|
|
|
|
5. 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](https://github.com/fundamentals/api/reference/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`.
|
|
|
|
6. Select **Create Token** to create the token.
|
|
|
|

|
|
|
|
7. `Copy the token`.
|
|
|
|

|
|
|
|
8. Finally, click `Continue to summary`.
|
|
|
|
# How to use Cloudflare API in HiddifyManager
|
|
After creating the token; go to the Manager 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 Manager; Cloudflare settings are done automatically. Also, workers are created automatically.
|