Cloudflare: Instructions to quickly get Zone ID and create API Token
NetworkServer

Cloudflare: Instructions to quickly get Zone ID and create API Token

Today’s article will guide you how to get Zone ID and create API Token from Cloudflare quickly and easily. We will often need to use Zone ID and API Token when setting up and configuring the network, such as configuring Dynamic DNS or setting up Wildcard SSL.

1. What is Zone ID?

Zone ID is a unique identification number for each domain name (zone) that you manage on Cloudflare. Zone ID is used in many Cloudflare API commands to identify the exact domain you want to operate on.

For example: When you want to update DNS via API, you will need to provide a Zone ID so Cloudflare knows which domain to edit.

2. How to get Zone ID on Cloudflare

Visit Cloudflare’s homepage at https://www.cloudflare.com and log in to your account.

Instructions to get Zone ID Cloudflare

After logging in, you will see a list of domains added to Cloudflare. Click on the domain name you want to find Zone ID

After entering the domain’s management page, scroll down to the bottom of the page Overview, in the right column you will see the item Zone ID is in the section API.

For example:

Zone ID: 43423423423432430abcdefCode language: Nginx (nginx)

Please copy this Zone ID to use when needed.

3. What is API Token and why is it necessary to create an API Token?

API Tokens is a security token that allows access and operations on Cloudflare via API. You can create API Tokens with specific permissions depending on each purpose of use, helping to increase security.

For example, you can create an API Token just for updating DNS, or another API Token for managing Firewall Rules.

4. How to create API Token on Cloudflare

Visit https://dash.cloudflare.com/profile/api-tokens to enter the Tokens API management page. Or from the Cloudflare homepage, click the Account icon and select My Profile

Next, click on API Token in the left Menu

To create a new Token, click the Create Token button

Cloudflare has created many templates so we can quickly configure parameters for Token. If you only need API Token related to DNS, click on the Use template button of the Edit Zone DNS section

Next, configure permissions for Token. Then click Continue to Summary

  • Select permissions Zone:Edit to be able to read and edit domain information.
  • Select the specific domain (or all domains) that this API Token will be allowed to access.

Click Create Token to confirm

Cloudflare will display your API Token only once. Please copy and save this code for use.

Note: Do not share your API Token with others and avoid storing it in unsafe places.

You can confirm whether the token is active or not by typing the command line curl ... enter the terminal. If you see a line in the returned result "status": "active" means the token is active.

{"result":{"id":"2a8376b6ab629d04aba6957570fd1d56","status":"active"},"success":true,"errors":(),"messages":({"code":10000,"message":"This API Token is valid and active","type":null})}%Code language: JavaScript (javascript)

5. Security note

  • You should use it API Tokens instead of Global API Key to enhance security.
  • Grant only the necessary permissions to the API Token.
  • Each application should use a separate API Token.
  • Delete API Tokens that are no longer in use.
  • Use password management tools like Bitwarden or 1Password to securely store API Tokens.
Comment Policy: We truly value your comments and appreciate the time you take to share your thoughts and feedback with us.

Note: Comments that are identified as spam or purely promotional will be removed.

To enhance your commenting experience, consider creating a Gravatar account. By adding an avatar and using the same e-mail here, your comments will feature a unique and recognizable avatar, making it easier for other members to identify you.

Please use a valid e-mail address so you can receive notifications when your comments receive replies.

Related posts

[Proxmox] Set up USB Passthrough for KVM virtual machine

Mark Lee

Dynamic DNS and Wildcard SSL configuration for Caddy Server

Mark Lee

What is CMS? A Comprehensive Guide to Content Management Systems

Mark Lee

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More