Gemini API 403 PERMISSION_DENIED: "Your project has been denied access"
The Gemini API (the generativelanguage.googleapis.com service you reach with a Google AI Studio key) returns 403 PERMISSION_DENIED when it recognises your API key but will not run inference for the Google Cloud project behind it. Google's troubleshooting guide groups these under "Project restricted or unavailable" and gives a separate remedy for each project state. This page follows that structure, quotes what the official pages say on 9 November 2026, and shows how to tell this error apart from a bad or missing key.
The 30-second answer
- Read the message text and open Projects in Google AI Studio. The project's status (Verification needed, Restricted, Free tier unavailable, Payment needed or Unavailable) tells you which fix applies.
FREE_TIER_VERIFICATION_REQUIRED: verify the project with a phone via the link in the error, or set up billing to use the paid tier instead.- A new API key in the same project does not help for verification or free-tier eligibility; Google evaluates both at the project level. A new key is the fix only when the message says the key was leaked or blocked.
- Do not retry. Google lists 403 among the client errors that should not be retried.
- A wrong key is a different error: a made-up key returned
400 API_KEY_INVALIDin today's test, not 403.
The exact error
Google's troubleshooting guide describes the general case as 403 PERMISSION_DENIED with the text "Your project has been denied access". The only full message body Google publishes for this family is the verification one, on its verification page (the project number is Google's placeholder):
Project 123456789012 must be verified before it can use the Gemini API Free tier. Verify the project at https://aistudio.google.com/verify?project=123456789012, or set up billing at https://aistudio.google.com/billing to use the paid tier instead. Learn more at https://ai.google.dev/gemini-api/docs/verification.
Source: Troubleshooting guide, "Project restricted or unavailable" and Project and account verification, both fetched 9 November 2026. The full JSON body of a project-level 403 is not shown in those pages and is not reproduced here.
Verified against Google's docs and a live bogus-key test — 9 November 2026
Not reproduced: a project-level 403 needs a real project that Google has restricted, so it cannot be triggered at zero cost or without an account. Every cause and fix below is cited from Google's documentation, not observed.
Reproduced: what the API returns for a made-up key and for no key, so you can rule those out. Environment: curl 8.7.1, macOS 15.7.9, no SDK, no real key. Response headers are trimmed to the status line.
$ curl -s -i -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent" \
-H "x-goog-api-key: BOGUS_KEY_FOR_TEST" -H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"hi"}]}]}'
HTTP/2 400
{
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "generativelanguage.googleapis.com"
}
},
{
"@type": "type.googleapis.com/google.rpc.LocalizedMessage",
"locale": "en-US",
"message": "API key not valid. Please pass a valid API key."
}
]
}
}
The same request with the x-goog-api-key header removed did return a 403, but a different one:
HTTP/2 403
{
"error": {
"code": 403,
"message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
"status": "PERMISSION_DENIED"
}
}
So if your 403 message mentions "unregistered callers", your key is not reaching Google at all (unset environment variable, header stripped by a proxy); that is not a project restriction. GET /v1beta/models and POST /v1beta/interactions gave the same two results for a bogus key and no key. The key was rejected before anything else, so this test says nothing about whether the model name in the URL is valid.
Not verified: the status labels and buttons inside Google AI Studio (they need a signed-in account), and how long access takes to return after a fix.
Cause 1: the project needs verification
Documented signal: the project shows Verification needed, or the 403 carries FREE_TIER_VERIFICATION_REQUIRED. The verification page says this applies to the free tier "on additional projects or projects created outside Google AI Studio", and that Google AI Studio may separately ask for account verification after unusual activity.
Fix (as documented), either of:
- Open the link from the error (
https://aistudio.google.com/verify?project=PROJECT_NUMBER) or click Verify project on the Projects page, click Verify device, scan the QR code with an Android phone or iPhone, wait for "Project verified", then retry the request. You need the Owner or Editor IAM role on the project. - Set up billing instead. The verification page states that paid tier projects do not require project verification.
Documented limits: verification needs a physical phone (Android with Google Play services, or iPhone on iOS 16.4 or later with App Clips on); desktops, emulators, rooted phones, SMS and hardware keys do not work, and each phone can verify only a limited number of projects in a rolling period. Google does not publish that number.
Cause 2: the project is not eligible for the free tier
Documented signal: Free tier unavailable. The troubleshooting guide says "Not all Google Cloud projects or accounts are eligible for the Gemini API free tier." It does not list the eligibility criteria.
Fix (as documented): link an active Cloud Billing account on the AI Studio Billing page to move the project to the paid tier. Two caveats from the same section: creating a new API key in the same project will not resolve it, and upgrading does not unlock free-tier quota; usage is billed at Gemini API pricing or deducted from eligible Google Cloud credits.
Cause 3: the billing account has a payment problem
Documented signal: the project is already linked to a Cloud Billing account and shows Payment needed, or the 403 cites an outstanding balance. The billing page adds that a missed payment for other Google Cloud services on the same billing account can suspend Gemini API access regardless of remaining Prepay credits, and names a delinquent or overdue balance, a declined payment, and an invalid or expired payment method as triggers.
Fix (as documented): clear the past-due balance or update the payment method on the AI Studio Billing page or the Google Cloud Billing console. The guide says the project "regains API access automatically" once the account is in good standing. A Prepay balance that simply ran out is documented as a different code (402, "Your Prepay credit balance is depleted"), not 403.
Cause 4: the API key was leaked or blocked
Documented signal: the 403 message says the key was reported as leaked or blocked. Google quotes this wording for leaked keys:
Your API key was reported as leaked. Please use another API key.
Fix (as documented): generate a new key on the AI Studio API Keys page and update your application; do not embed keys in client-side code or public repositories. The API keys page also says the Gemini API rejects requests from unrestricted standard keys and blocks unrestricted keys that have been dormant for an extended period (shown with a Blocked tag); it does not state which HTTP status those rejections return.
Cause 5: the project or billing account is suspended
If Google has suspended the Google Cloud project or Cloud Billing account for a policy violation, the guide says to check the associated email address, review suspension notices in the Google Cloud Console, and follow the Project Suspension Guidelines. No code change or new key resolves this.
The guide names two more statuses, Restricted and Unavailable, but does not say which of its sections each one maps to. If you see either, use the message text of the 403 to pick the matching cause above.
What the general 403 row says
The troubleshooting guide no longer carries its own error-code table; it points to the API errors page, which documents Interactions API codes. Its 403 row reads: permission_denied, "Your API key lacks permission for this resource, or your project is restricted or requires verification or billing changes", with the action "Check your API key permissions, verification status, and billing status." That page does not mention tuned models, so tuned-model authentication is not covered here. Separately, the AI Studio troubleshooting page lists further checks that can produce PERMISSION_DENIED in API responses: accepted Terms of Service, a supported region, the 18+ age requirement, automated security checks, and the project not being flagged for abuse.
Confirm the fix with an inference call, not models.list
The troubleshooting guide warns that read-only endpoints such as models.list "only validate that your API key exists and don't check project tier eligibility or billing status". Test with a real generateContent call, using a model ID from Google's models page:
curl -s -i -X POST "https://generativelanguage.googleapis.com/v1beta/models/MODEL_ID:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" -H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"hi"}]}]}'
This is the request shape used in the bogus-key test above; a successful response with a valid key was not run for this page.
FAQ
Will creating a new API key fix a Gemini API 403? Only if the message says the key itself was reported as leaked or blocked. Both the troubleshooting and verification pages state that eligibility and verification are applied at the Google Cloud project level, so a new key in the same project returns the same error.
Is a 403 the same as an invalid API key? No. In today's test a made-up key returned HTTP 400 with API_KEY_INVALID, and a missing key returned a 403 about "unregistered callers". The project-level 403 is a third case: the key is recognised, the project is not allowed to run inference. (The API errors page lists a missing or invalid key as authentication / 401 for the Interactions API; the live endpoint returned 400 for a bogus key in this test.)
models.list returns 200 with my key. Why does generateContent return 403? Because, per Google's guide, metadata endpoints do not check tier eligibility or billing status. A 200 there does not mean inference is enabled for the project.
Should I retry a 403? No. Google's retry guidance says to retry only transient errors such as 429, 408 or 5xx, and not 400, 402 or 403. The official SDKs' automatic retries are documented for 429 and 5xx only.
Related
- Gemini API 429 RESOURCE_EXHAUSTED: rate limits and quota
- Anthropic API 403 permission_error: causes and fixes
- OpenAI "No such organization" error: fix
Verified on 9 November 2026: causes and remedies cited from Google's Gemini API troubleshooting, verification, billing, API keys, API errors and AI Studio troubleshooting pages as fetched that day; bogus-key (400) and no-key (403) responses reproduced with curl 8.7.1 against generativelanguage.googleapis.com. A project-level 403 was not reproduced, and Google AI Studio screens were not checked.