Export data via Secured API to google sheets

Is there a way to securely export data from Metabase via API?

Basically I want to pull large volumes of data once metabase analyzes them with the custom query into google sheets.

you'll have to build a data pipeline for that (external code)

I can build it in Gscript with Javascript.
The question is how.

Are there examples of how to pull data via api with authentication not just a public url and is it part of the basic tier?

You can use the POST /api/card/{id}/query/{export-format} with format CSV using your API Key.

If you go to a question and click Download, it uses this endpoint, so you can check it with the Network tab to see how the payload and response look.