API access to update customer's DNS

In my SaaS product, I want to allow users to point their domain to my server as “Custom Domain”, which requires adding of CNAME record in their DNS and TXT record for verification.

I want to automate this process of adding CNAME and TXT to the customer’s DNS, whose DNS is managed by Cloudflare using the API from the backend application.

Does Cloudflare provide this option? If so, what are the requirements to work on behalf of the customer? (Just updating/adding DNS record, nothing else).

Cloudflare provides this option through the API. You can add DNS records including CNAME and TXT using this endpoint: Cloudflare API Documentation and update DNS records with this one: Cloudflare API Documentation.

In order to make these changes on behalf of your customers, you’ll need their API key and Zone ID. Please remind your customers not to share their Global API Key with you (or anyone else) and instead create an API Token with the necessary permissions.

Thanks @cloonan. Since it will be a one-time job, we do not want to ask users to look for the API key and Zone ID. Can it be done using Oauth2 and authorizing the user by logging into their Cloudflare account?

Not really, you’d still need an API token & zone ID

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.