A2oz

How Do I Enable Cloudflare API?

Published in Cloudflare 2 mins read

To enable Cloudflare API, you need to create an API token within your Cloudflare dashboard. Here's how:

1. Access Cloudflare Dashboard

  • Log in to your Cloudflare account.
  • Navigate to the My Profile section.
  • Click on API Tokens.

2. Create a New API Token

  • Click on Create Token.
  • Choose a Name for your token.
  • Select the API Permissions you want to grant.
  • Click on Create Token.

3. Copy Your API Token

  • Your API token will be displayed on the screen.
  • Copy the token and store it securely.
  • Note: You will only be able to see this token once, so make sure to copy it before closing the window.

4. Utilize Your API Token

  • Use your API token to authenticate your API requests.
  • Refer to the Cloudflare API documentation for detailed instructions on using your API token for specific requests.

Example:

curl -X GET "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
-H "Authorization: Bearer <YOUR_API_TOKEN>" \
-H "Content-Type: application/json"

This example shows how to use your API token to retrieve DNS records for a specific zone.

Remember:

  • Never share your API token publicly.
  • Store your API token securely to prevent unauthorized access.
  • Use the appropriate API permissions for your specific needs.

Related Articles