# Getting 400 Error - API Key not found

**URL:** <https://discuss.ai.google.dev/t/getting-400-error-api-key-not-found/66264>\
**Category:** Gemini API\
**Tags:** api, gemini-api\
**Created:** [February 15, 2025, 1:45am UTC](https://discuss.ai.google.dev/t/getting-400-error-api-key-not-found/66264 "2025-02-15T01:45:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![viacoo](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/viacoo/32/31867_2.png) [@viacoo](https://discuss.ai.google.dev/u/viacoo)\
**Post date:** [February 15, 2025, 1:45am UTC](https://discuss.ai.google.dev/t/getting-400-error-api-key-not-found/66264/1 "2025-02-15T01:45:41Z")

</div>

I created a paid API key on AI Studio by linking it to my Google Cloud project.

After running my Python Project (having the api key correctly set) it tells me:

```auto
Invalid argument provided to Gemini: 400 API Key not found. Please pass a valid API key. [reason: "API_KEY_INVALID"
domain: "googleapis.com"
metadata {
  key: "service"
  value: "generativelanguage.googleapis.com"
}
, locale: "en-US"
message: "API Key not found. Please pass a valid API key."
]

```

I don’t know what to do to be honest, because I created a new api key in a new account, I created a new api key and I didn’t use it in some hours just in case…, but the error is showing again and again right after running the code. The thing is that it was working some days ago with a free API key.

Hope someone can help me with this.

---

<div class="post-metadata">

**Author:** ![Siva\_Sravana\_Kumar\_N](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/siva_sravana_kumar_n/32/5462_2.png) [@Siva\_Sravana\_Kumar\_N](https://discuss.ai.google.dev/u/Siva_Sravana_Kumar_N)\
**Post date:** [March 18, 2025, 8:44pm UTC](https://discuss.ai.google.dev/t/getting-400-error-api-key-not-found/66264/3 "2025-03-18T20:44:51Z")

</div>

Hi @viacoo,

Welcome to the forum! To best assist you, could you please share a small code snippet showing how you’re passing the API key? This will help me understand the situation and provide more specific guidance. Thanks!

Cheers!

---

<div class="post-metadata">

**Author:** ![Aniket\_Rathod](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/aniket_rathod/32/91619_2.png) [@Aniket\_Rathod](https://discuss.ai.google.dev/u/Aniket_Rathod)\
**Post date:** [February 8, 2026, 12:13pm UTC](https://discuss.ai.google.dev/t/getting-400-error-api-key-not-found/66264/5 "2026-02-08T12:13:42Z")

</div>

Found any way i am facing same issue.
