Guides ·

“User location is not supported for the API use”: why the Gemini API and AI Studio say your region isn’t supported

The short version: when the Gemini API returns User location is not supported for the API use. (status FAILED_PRECONDITION, HTTP 400), or Google AI Studio says it isn’t available in your region, Google has decided the request came from outside its API list, and the exit that matters is the one of the machine that sent the request, not the one your browser shows. As of 2026-10-01, the Gemini API and AI Studio share one list of 229 countries and territories. Mainland China, Hong Kong and Macau are not on it. Hong Kong and Macau are on the Gemini web app list, so there the web app can work while the API fails.

At a glance: which exit Google checksWhen you open AI Studio in a browser, the exit on the browser’s path is what counts. When code on a server or in a terminal calls the Gemini API, that machine’s exit counts, and it doesn’t inherit the browser’s proxy. In Colab, the region of the Colab instance counts, not where you are. At a glance: which exit Google checks Browser: AI Studio on the web May be split Browser Domain rules Browser exit Opening aistudio.google.com uses the exit on the browser’s path. Server / terminal: API calls Own settings Code This machine Machine exit SDKs, curl and CLI tools don’t pick up the browser’s proxy; this machine’s exit counts. Colab: API calls in a notebook By instance Notebook Colab instance Instance exit Judged by where the Colab instance is, not by where you are. Run curl ipjudge.org/en on the machine sending the request.
When the error appears, check the machine that sent the request: the browser, the server or terminal, or the Colab instance. Each can have its own exit.

Sources, all checked on 2026-10-01: Google AI for Developers’ available regions page (last updated 2026-04-28), troubleshooting guide, API errors page, AI Studio troubleshooting page and Gemini API Additional Terms of Service; the Gemini Help Center’s web app regions page; and Google Cloud documentation. Community reports are labeled as such.

What the error looks like and where it shows up

  • Calling the API directly: the response users have posted on the Google AI Developers Forum is {"error":{"code":400,"message":"User location is not supported for the API use.","status":"FAILED_PRECONDITION"}} (forum thread). SDKs usually wrap this in their own exception message.
  • Command-line tools: a user reported API Error: User location is not supported for the API use. (Status: FAILED_PRECONDITION) in Google’s Gemini CLI repository (community report).
  • Google AI Studio: the available regions page says that if you were sent there while trying to open AI Studio, there are three possible reasons: your region isn’t supported (Google AI Studio is not available in your region.), you’re under 18, or you haven’t verified your age on your Google Account. The AI Studio troubleshooting page adds that a 403 Access Restricted error means you’re using AI Studio in a way that doesn’t follow the terms, and that one common reason is not being in a supported region. Outside a supported region you may also see PERMISSION_DENIED or an access restriction error in the AI Studio interface or in API responses.

Google’s current docs don’t quote the User location is not supported message itself. The troubleshooting guide (updated 2026-09-20) now sends you to the API errors page for error codes, which lists failed_precondition as 400 with the description “a prerequisite is not met (for example, disabled billing)”, without mentioning location.

Don’t confuse it with another 400 FAILED_PRECONDITION message. The error table in the 2026-06-10 version of the troubleshooting guide (archived copy) listed Gemini API free tier is not available in your country. Please enable billing on your project in Google AI Studio. That one means the free tier isn’t offered where you are, and Google’s fix was to enable billing on the project. It is a different message from the User location one.

The API list and the web app list are separate

Google publishes separate lists for the Gemini web app, the mobile app, and the Gemini API / AI Studio. As of 2026-10-01:

  • API and AI Studio list: 229 countries and territories. Mainland China, Hong Kong and Macau are absent; Taiwan is listed.
  • Web app list: Hong Kong and Macau are listed; mainland China appears as “Mainland China (Workspace only)”.

The Additional Terms (effective 2026-03-23) say you may only access the services, or make API clients available to users, within an available region; you must be 18 or older; and AI Studio and the Gemini API are for developers building for professional or business purposes. So the list also limits where you can offer an app built on the Gemini API. For the three lists side by side, see Can you use Gemini in China or Hong Kong?

Why the browser works but a server or terminal doesn’t

Google doesn’t publish how the API decides where you are. The one hint on the available regions page is a note for Colab users: region restrictions are applied based on where the Colab instance is, not where the user is. In other words, what counts is where the machine sending the request is, not where you are. When the browser is fine but your code fails, it’s usually one of these:

  1. Code running on a server: when an app on a cloud server calls the API, Google sees the server’s exit, not your laptop’s.
  2. The terminal isn’t using the browser’s proxy: SDKs, curl and command-line tools run in a terminal, which doesn’t inherit the browser’s proxy settings, so requests leave from the terminal’s own exit.
  3. Split routing by domain: the browser opens aistudio.google.com, while your code calls generativelanguage.googleapis.com. With per-domain proxy rules, the two can take different exits. More in Which IP do ChatGPT and Claude actually see?
  4. IPv6 taking another path: DNS lookups on 2026-10-01 returned IPv6 addresses for both generativelanguage.googleapis.com and aistudio.google.com. If your proxy only handles IPv4, requests that prefer IPv6 leave from a different exit. See IPv6 leaks.
  5. Geolocation errors: on the Google AI Developers Forum, users with servers in data centers in Germany and Singapore, both on the list, still got this error. In the second thread one user recovered by creating a new service in a different deployment region, and another found it cleared up after a few days. Google didn’t give a cause (forum threads).

Getting the error in Colab

Per the available regions page, when you call the Gemini API from a Colab notebook, the region is judged by where the Colab instance is, so being in a supported country yourself doesn’t change the result. Google suggests running !curl ipinfo.io in the notebook to see the instance’s location. You can also run !curl ipjudge.org/en: its “Gemini API” row says whether the instance’s exit region is on the API list.

Where Google’s docs point if your region isn’t listed

The available regions page says that if you’re not in one of the listed countries or territories, you can try the Gemini API in Gemini Enterprise Agent Platform. According to Google Cloud’s name changes page, Gemini Enterprise Agent Platform was previously called Vertex AI Platform.

Google’s comparison page (updated 2026-09-30) lists a few differences: you authenticate with Google Cloud service accounts; supported regions may differ between the two; and during Preview, the Interactions API on that platform only supports the global endpoint. “Regions” there means the data center endpoints models are served from (such as us-central1 or global), not a list of countries callers may be in. None of these pages says whether it can be used from mainland China, Hong Kong or Macau, and this article hasn’t checked.

Check the exit of the machine calling the API

On a server or in a terminal: on the machine, and in the terminal, that sends the request, run:

curl ipjudge.org/en
curl -6 ipjudge.org/en

The first command prints that machine’s exit IP, whether it’s residential or datacenter, its location and network, and one row per platform. The “Gemini API” row compares the exit’s region with the API list: on the list it reads “Region is on Google’s list for the Gemini API / AI Studio (a separate list from the web app)”; from a Hong Kong exit it reads “Hong Kong is not on Google’s list for the Gemini API / AI Studio (the web app has its own list)”. The second command only returns a result if the machine has IPv6, and shows whether the IPv6 exit is in the same region.

In a browser: open the Gemini region check. The Gemini card’s main verdict uses the web app list; a separate “API / AI Studio” line underneath compares the region of the exit that opened the page with the API list (checked by IP Judge on 2026-10-01) and reads “region on Google’s list” or “region not on Google’s list”. That line only looks at the region, not at whether the exit is residential or datacenter, since calling the API from servers is normal. If the exit’s region can’t be determined, the line isn’t shown.

Two caveats. First, IP Judge uses its own IP data to place the exit, and Google’s geolocation may differ; Google doesn’t expose the IP it sees, so IP Judge can’t read Google’s side of the decision. Second, a browser check only covers the browser’s path. If your code runs somewhere else, check on that machine. How verdicts are reached is on the method page; for how each platform treats the two places, see the Hong Kong and mainland China pages.

Three checks after the errorFirst, find the machine that sent the request: a browser, a server, a terminal or a Colab instance. Second, run curl ipjudge.org/en on that machine and read the Gemini API row. Third, compare with the API list, not the web app list: if the region isn’t listed, Google’s docs point to Gemini Enterprise Agent Platform; if it is listed and the error persists, check the IPv6 exit, and note that geolocation can be off (community reports). Three checks after the error 1 Find the machine sending the request Browser, server, terminal or Colab instance 2 Check the exit on that machine curl ipjudge.org/en Read the “Gemini API” row; in a browser, the API line on the /en/gemini/ page 3 Use the API list, not the web list Not listed Google’s docs point to Gemini Enterprise Agent Platform Listed but fails Check the IPv6 exit; IP location can be off (community reports) List: Google’s available regions page (updated 2026-04-28)
Work out which machine sent the request, check the exit on that machine, and compare it with the API list rather than the web app list.

FAQ

I’m in Hong Kong and the Gemini web app works. Why does the API return this error?

They use two different lists. As of 2026-10-01, Hong Kong and Macau are on the web app list but not on the API and AI Studio list.

My exit is in a listed country and I still get “User location is not supported”. What now?

On the machine that gets the error, confirm that both the IPv4 and IPv6 exits are in a listed country. Forum users have reported datacenter IPs being placed in the wrong country, and some mention reporting the IP’s location through Google Search Help’s Report IP problems form (community reports; Google hasn’t said whether that form applies to the Gemini API).

Is “free tier is not available in your country” the same error?

No. In the June 2026 version of the troubleshooting guide, that message means the free tier isn’t offered where you are, and Google’s fix was to enable billing on the project. The User location message means the request came from outside the list.

If IP Judge says the region is on the list, is the API guaranteed to work?

No. Google doesn’t publish its rules. What IP Judge can do is read the exit of that machine and compare it with the list Google publishes.

Which kind of IP do you have?

Check my IP for free