Can I rewrite URL's using the CF API on the free plan?

I’ve been trying for days to use the API to rewrite URL’s, add rules, add a CNAME DNSS record, etc and they all consistently fail with 400 bad request. I’m pretty sure the parameters are correct, and calls to GET work fine, but all PUT/POST calls fail with 400. I cant find this specific question anywhere, I’ve looked all over the CF docs, but there doesn’t seem to be any information specific to what plan is needed to update zones with the API.

The only hint that the failure may be related to the plan was from a random comment in a reddit forum that implied that Enterprise level was required to update zones via the API!

The API is available to all plan. Some features are limited on the API to match the dashboard. Can you share the request you are trying to make?


Hey there, thanks for responding. As usual, soon after I made this post, I dug around some more and found my errors! Not sure if these may help others, but I was not showing all of the error messages from my API call so all I saw was the 400 bad request. When I logged the entire message I saw that the functions were not defined correctly… Specifically I was trying to set the cache-control header with an expression of (*), I changed it to a set and that fixed that error.

I also found out that when you delete a zone from CF, it doesn’t actually delete all the associated data. It keeps the zone id and reuses it if you re-add the domain name! I don’t see that fact documented anywhere??

During my testing, I will add/delete the same zone/domain name multiple times. That was causing the call to add a CNAME record to fail since you can only have one CNAME record with the same values. I had to add code to check if the zone id exists, then delete any existing rules and re-add them all.


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