Is it possible to create a public hostname in a cloudflare tunnel using the api token?
Yes you can. The docs for it are Cloudflare API Documentation