Issue: All requests to generateContent are blocked with:
“reason”: “API_KEY_SERVICE_BLOCKED”
Full error response:
{
"error": {
"code": 401,
"message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.",
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "``type.googleapis.com/google.rpc.ErrorInfo``",
"reason": "API_KEY_SERVICE_BLOCKED",
"metadata": {
"service": "``generativelanguage.googleapis.com``",
"method": "google.ai.generativelanguage.v1beta.GenerativeService.GenerateContent"
}
}
]
}
}
Verified before posting:
- Generative Language API shows as “Enabled” in Google Cloud Console for the project
- Tested with the original API key created via Google AI Studio
- Generated a brand new, completely unrestricted API key (Application restrictions: None) — same error
- API key restrictions show “Gemini API” only, no application-level restrictions
- Tested directly via a Java HttpClient POST request to:
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
with the key passed via the x-goog-api-key header - Free tier / no billing account set up on this project
Project is on Google AI Studio’s default free-tier project (gen-lang-client-XXXXXXXXXX), key created July 24 2026.
This looks similar to other reports of API_KEY_SERVICE_BLOCKED / “project denied access” where all standard troubleshooting steps pass but the block persists at what appears to be a project or account level (e.g. [link to the thread you found: https://discuss.ai.google.dev/t/api-key-service-blocked-on-generativelanguage-googleapis-com-100-error-rate-all-checks-pass/171819\]).
Would appreciate help understanding whether this is a project-level flag that needs to be cleared on Google’s end, and what the resolution path is.
Thanks.