How to get the <sub>.workers.dev zone programmatically?

When setting up a worker and worker route via the dashboard, the route gets assigned to my <sub>.workers.dev zone automatically. For example, I go through the "Create an app"->"Create a worker"->"Deploy "Hello World" script"->Deploy flow and my route is available under diana-247.workers.dev . I'd like to be able to find/retrieve this same zone via the API so when I create a worker/route it gets assigned to the same worker.dev but I can't seem to get this data. I queried the list zones but that only shows my own domains. Is this available elsewhere, if so where?
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
5 Replies
Chaika
Chaika15mo ago
I'd like to be able to find/retrieve this same zone via the API so when I create a worker/route it gets assigned to the same worker.dev but I can't seem to get this data
Can you clarify what you mean by this? You pick a workers.dev subdomain per account, and it stays yours forever
d
dOP15mo ago
Okay, so in other words, I want to retrieve my subdomain, diana-247.workers.dev, programmatically. Is there a way to do so via the API?
d
dOP15mo ago
The reason being, I want to create a worker+route and have it assigned to my workers.dev similar to how it occuers when following the Dashboard steps
No description
Chaika
Chaika15mo ago
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
d
dOP15mo ago
TY I see this works for the API. 🙏
Want results from more Discord servers?
Add your server