Hi Gemini API team,
Every API key generated for my account is issued with an “AQ.” prefix, and these keys are rejected by the Gemini API. Calling
generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent returns:
401 UNAUTHENTICATED
“Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.”
reason: ACCESS_TOKEN_TYPE_UNSUPPORTED
This happens whether I pass the key via ?key= or the x-goog-api-key header.
What I have already tried:
- Google AI Studio → only issues “AQ.” prefix keys.
- Cloud Console → Create credentials → API key, in my project gen-lang-client-07747872..
(project number 5285733113..) → the flow forces the key to be bound to a service account,
producing an “AQ.” key. - A brand-new project with NO organization (perfect-nature-502104-..) with the Generative
Language API enabled → the “Gemini API” restriction checkbox is disabled unless the key is
bound to a service account, and unrestricted keys are not allowed, so I still cannot generate
a standard “AIza” key.
I need a standard “AIza” API key to call the Gemini API from a server-side Google Apps Script.
Could you please restore standard “AIza” API key generation for my account / project
gen-lang-client-07747872.. (5285733113..)?
I have not exposed any key value in this post. Thank you.