Cloudflare DNS icon

Cloudflare DNS

Interact with Cloudflare DNS API

Actions4

Overview

This node interacts with the Cloudflare DNS API to manage DNS records within a specified DNS zone. Specifically, the Create operation for the DNS Record resource allows users to add new DNS records to a Cloudflare-managed domain zone.

Common scenarios where this node is beneficial include:

  • Automating DNS record creation during deployment pipelines.
  • Dynamically adding DNS entries for new services or subdomains.
  • Managing DNS records programmatically without manual intervention in the Cloudflare dashboard.

For example, you can create an A record pointing www.example.com to an IP address, or add MX records for email routing automatically as part of your infrastructure setup.

Properties

Name Meaning
Zone ID The unique identifier of the DNS zone (domain) where the record will be created.
Record Type The type of DNS record to create. Options: A, AAAA, CNAME, MX, TXT, NS, SRV, PTR
Record Name The name of the DNS record, e.g., "www" or "@" for the root domain.
Record Content The content of the DNS record, such as an IP address for A/AAAA records or target for CNAME.
Additional Fields Optional extra settings for the DNS record:
- TTL Time To Live in seconds; 1 means automatic TTL.
- Proxied Boolean indicating if the record should be proxied through Cloudflare's network.
- Comment A user-defined comment attached to the DNS record.
- Tags Comma-separated tags to categorize or label the DNS record.
- Priority Priority value used only for MX and SRV records to determine order of preference.

Output

The output is a JSON array containing the details of the newly created DNS record(s). Each item includes all properties returned by the Cloudflare API for the DNS record, such as its ID, type, name, content, TTL, proxy status, comment, tags, priority, and other metadata.

No binary data is produced by this node.

Dependencies

  • Requires an API authentication token credential configured in n8n to access the Cloudflare DNS API.
  • The node makes HTTPS requests to the Cloudflare API endpoint at https://api.cloudflare.com/client/v4.
  • The user must provide a valid Zone ID corresponding to their Cloudflare DNS zone.

Troubleshooting

  • Cloudflare API Error: If the API returns an error, it is thrown with details from the Cloudflare response. Common causes include invalid Zone ID, insufficient permissions on the API token, or malformed input data.
  • Invalid Record Type or Content: Ensure that the record type matches the expected format of the content (e.g., IP address for A/AAAA, hostname for CNAME).
  • Priority Field Usage: Priority is only applicable for MX and SRV records; setting it for other types may cause errors.
  • Proxied Field: Some record types do not support proxying; enabling it incorrectly may lead to API errors.

To resolve errors, verify the correctness of all input parameters, ensure the API token has appropriate permissions, and consult Cloudflare's API documentation for specific constraints.

Links and References

Discussion