Got the dreaded ""User location is not supported for the API use." in Dallas Texas

After weeks of solid performance, starting yesterday I received sporadic “User location is not supported for the API use.” After about an hour of this, the API went to solid errors. My VPS is in Dallas, Texas. At this point the “Make your first request” demo on the Quickstart fails with the same message.

What is going on? Thanks!

Hi @John_Koenig, Welcome to forum!!

Can you please confirm how you are calling the API? (Colab, locally, via Cloud Run, etc?)
Also, can you share what error code it is throwing?

Thanks

I am calling the API using the “Get Started” code:
curl “https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=[MYKEYHERE]
-H ‘Content-Type: application/json’
-X POST
-d ‘{
“contents”: [
{
“parts”: [
{
“text”: “Explain how AI works in a few words”
}
]
}
]
}’

When I execute this (Ubuntu LTS24) from IP 104.128.239.110 (Dallas, Texas) I receive this result:
{
“error”: {
“code”: 400,
“message”: “User location is not supported for the API use.”,
“status”: “FAILED_PRECONDITION”
}
}

The code works from other IP addresses. When I reflect my calls through a proxy server, everything works fine.

The issue has been magically resolved. All the same environment and code. But now the spurious error message is gone and the proper response is received.