How to consume a gateway private api from a JS application

How can you consume a rest private api wrapped in a vpc… I have setup a private api that returns data from my db… When I test the api in the gateway console everything is working perfect… However I need this end point to be use in a Javascript fetch function in my application. When I try to fetch the data it kicks me out… Not working. I have also tried to attach the vpc number inside the url but nothing worked… Any help would be great

In your VPC, create an interface VPC endpoint for your API endpoint. This endpoint will serve as a private connection point within your VPC, allowing your application to access the API without exposing it to the public internet.