Hi, This question is weird. By Custom API, do you mean the new Api page or Web Service?
When you access the API, you must specify the name of the environment in the endpoint url.

And in other software, such as Power BI and Power Automate, the environment is generally selected first and then the API is selected.

So first make sure that the extension in your production environment is the same as the Sandbox environment.
Hope this helps as well.
Thanks.
ZHU