Google Translate API authentication key and usage

From, there's a need to set the environmental variable:

export GOOGLE_APPLICATION_CREDENTIALS='/path/to/credential.json'

Then a curl request can be made as such:

curl -s -X POST -H "Content-Type: application/json" \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    --data "{
  'q': 'The Great Pyramid of Giza (also known as the Pyramid of Khufu or the
        Pyramid of Cheops) is the oldest and largest of the three pyramids in
        the Giza pyramid complex.',
  'source': 'en',
  'target': 'es',
  'format': 'text'
}" ""

Where there is a Bearer authentication key in the header of the request that comes from the value of the gcloud auth application-default print-access-token command.

After trying several calls to gcloud auth application-default print-access-token, every call seems to create a unique token per call.

My questions are ,

  • How long does the authentication key from print-access-token lasts before it expires?

  • Is there a way to create a fix key that isn't dynamically generated from gcloud auth application-default print-access-token and without the need to setup the environmental variable?

  • Is there a way to generate the print-access-token programmatically without calling the gcloud command line executable?

There are also seems to be a way to create a static key and use it as described in and e.g.

How can the static key be used in the the curl call in place of the Authorization: Bearer?