Cloudflare API as a OpenAPI file/export

Currently, Cloudflare has a large and often changing API, but there does not seem to be an OpenAPI file/export for it.

The result is that SwaggerHub, Postman and github are full of third party attempts to create language bindings for the API that are out of date and incomplete. From another post on the forums made about 18 months ago it seems that the raw json/yaml was being provided at the API endpoint for at least a short period of time.

This now appears to be automated and published here:

Do note from the repo though:

Please Note: The schemas in this repository are in a preview state and are not for production use . Expect failures or issues in using the schemas in any way, including OpenAPI tooling at this time. Further updates will be announced via this repository and the Cloudflare blog as things change.

Sadly, that is one of the many ‘in part’ attempts to publish the API as an OpenAPI file, rather than a real answer as it covers about 5 endpoints out of 100+ endpoints in the full API.

In many ways it is more an indication of just how much work Cloudflare would have to do to complete such a project and without such work the APIs have to be hand implemented by every developer who wants to use them.

Where are you seeing it only covering about 5 endpoints? It’s a >2MB file covering hundreds of them.

OK, my mistake Cloudflare structure is a little different to what I am used to and they have not included the tags needed to allow SwaggerHub to display things in a logical way.

While Cloudflare’s docs list APIs as a long list like

Accounts Members
Account Roles
Account Subscriptions

Zero Trust organization
Access service tokens

They all fall under the URL of /accounts

For anyone who wants to try this with SwaggerHub, it can be imported, but the rendering of the API to a browser needs a lot of memory, my copy of Firefox is currently using 4GB to hold the page. Also, a lot of errors are reported so it is not possible to export to a selected language.