How to deploy to Cloudflare Pages programmatically?

I'm making a website builder that allows users to deploy their website to cloudflare pages as https://<uuid>.<website-builder>.com . How do I go about this?

Do I use the Cloudflare Create Project API endpoint (https://developers.cloudflare.com/api/python/resources/pages/) to do this? If so, how do I upload the code into to the project?
Interact with Cloudflare's products and services via the Cloudflare API
Was this page helpful?