Where to find API endpoints to create internal/external hostnames?

I have a Cloudflare tunnel setup to my home network for some personal self-hosted services. While learning my way around the dashboard, I decided to try to use the API to help make creating DNS entries faster.

In my investigation, I learned how to manage DNS entries, but I could not figure out how to create "Public Hostname" entries via the API within my tunnel, and made the following observations:

1) If I create a hostname entry via the dashboard GUI, it'll automatically create a DNS CNAME entry, but the converse is not true
2) I can create DNS entries with a POST to https://api.cloudflare.com/api/v4/zones/{{CF-Zone-ID}}/dns_records, but I cannot figure out how do #1 via the API (create a hostname entry)
3) When viewing the network tab of the browser developer tools to try to reverse engineer it, the only thing I'm finding is the same POST above, though it uses dash.cloudflare.com/api, which I'm assuming is a different API for the dashboard vs. the raw API, which makes me think some functions are only available via the dashboard. The user-facing API URL is https://api.cloudflare.com/client/v4

I'd appreciate any guidance on how to do this (add a new tunnel public hostname/DNS mapping) programmatically, thanks!
HRzsoMs.png
huKSHH8.png
Was this page helpful?