Gemini Auth Key (AQ.) returns 401 ACCESS_TOKEN_TYPE_UNSUPPORTED

Title: Gemini Auth Key (AQ.) returns 401 ACCESS_TOKEN_TYPE_UNSUPPORTED

Description:

I created a Gemini API authorization key (AQ. prefix) in Google AI Studio. The key is bound to a Google Cloud service account that was automatically generated during key creation.

Verified:

  • Generative Language API is enabled.

  • The service account is enabled.

  • The key is bound to the service account.

  • My Google account has Organization Administrator and Owner roles.

When calling generativelanguage.googleapis.com using the x-goog-api-key header, the API returns:

  • HTTP 401

  • UNAUTHENTICATED

  • ACCESS_TOKEN_TYPE_UNSUPPORTED

Could you clarify the correct authentication method for this type of authorization key, and whether this error indicates a backend issue or a configuration problem?

Hello @Celine_li ,

Could you please create a new API key in a new project in Google AI Studio and test it with the below request?

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{"contents": [{"parts": [{"text": "Say hello"}]}]}'

If you still get the 401 error, please share via Direct Message the complete error response and your project ID.

Subject: AQ authorization key returns 401 ACCESS_TOKEN_TYPE_UNSUPPORTED