Map wildcard subdomains to static site folders in CDN?

We’re building a multi-tenant CMS. We’d like to support tens of thousands of tenants. We’d like to have a wildcard cert on our domain ( and give a subdomain to each tenant ( Can we map each subdomain to a folder in your CDN, where we can store a static site? e.g. -> <somewhere in cloudflare>/acmecorp -> <somewhere in cloudflare>/alpha

We’d also like to offer our tenants the ability to use their own domain, so if acmecorp has, we’d like to be able to give them an SSL cert and direct to /acmecorp as well.

Ideally, we’d like to programmatically handle as much of the above as possible, especially the subdomain to CDN folder mappings and CDN folder creation. We’d also like for there to be as few moving parts as possible between someone typing into their browser and hitting their static site at /acmecorp.

Firstly, I’d love to know if the above is possible at Cloudflare. Second, if someone could provide links or examples doing the above, it will be greatly appreciated.