First discussed at
https://answers.netlify.com/t/netlify-redirect-splat-subdomain/22983
.
/api/:org/* https://:org.example.com/:splat
The value of
:org
will become the subdomain for the site you are redirecting to.