How to Update route of a specific worker via API
Is there any way to update the route of a cloudflare worker via API.
I can see the documentation having the create route update route and delete route API ok but those are just for the zone but not for the specific worker.
3 Replies
Support AI
According to the Cloudflare documentation, you can update a route for a specific worker using the Workers Routes API.
Here is an example of how to update a route using the API:
PATCH https://api.cloudflare.com/client/v4/accounts/{account_id}/workers/routes/{route_id}
You can find the route_id
by listing all routes for a specific worker using the following API:
GET https://api.cloudflare.com/client/v4/accounts/{account_id}/workers/routes
You can then use the route_id
to update the route.
Please note that you need to replace {account_id}
with your actual account ID and {route_id}
with the actual route ID you want to update.
You can find more information about the Workers Routes API in the Cloudflare documentation: https://developers.cloudflare.com/api/operations/workers-routes-update-route
Source: https://developers.cloudflare.com/api/operations/workers-routes-update-routeSources
Feedback
Feedback has been submitted! Thank you :)
This is an AI generated response, it may not be 100% accurate. Please validate the output. You can ask followups by replying to this message or mentioning me.
Yes, thank you, it was the script parameter that I was missing.