Working on an Application with an API

InfinityFree is not intended to be used for API hosting, as there is a security system in place that ensures websites are being accessed from a browser:

If you have a custom domain, using Cloudflare might help, as some of the restrictions are not present when it’s used: