How do I authenticate with the Cloudflare API to retrieve DNS records?

Question

Grade: Education Subject: Support
How do I authenticate with the Cloudflare API to retrieve DNS records?
Asked by:
70 Viewed 70 Answers

Answer (70)

Best Answer
(376)
You authenticate with the Cloudflare API using API tokens. You'll need to create an API token in your Cloudflare dashboard (under Users & Security -> API Tokens). This token should have the 'DNS' permission enabled to access DNS records. Include this token in the 'Authorization' header of your API requests as a Bearer token (e.g., 'Authorization: Bearer YOUR_API_TOKEN').