# "type":"token.unauthorized\_access","message":"Invalid API Key"

**URL:** <https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156>\
**Category:** Question and Answers\
**Created:** [April 8, 2024, 9:31am UTC](https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156 "2024-04-08T09:31:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicodumans](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nicodumans](https://forums.nylas.com/u/nicodumans)\
**Post date:** [April 8, 2024, 9:31am UTC](https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156/1 "2024-04-08T09:31:08Z")

</div>

Hello,

I just try to use your product.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/nylas3/original/1X/c11d73221eb5b287fe75c1f8995cc6b776514f6e.png)

I have this return:

```auto
{
  "request_id": "efb192e2-b764-4d1a-a288-7ca6a87806d6",
  "error": {
    "type": "token.unauthorized_access",
    "message": "Invalid API Key"
  }
}

```

I well change ‘YOUR\_API\_KEY’.

Can you help me ?

Best regards,  
Nicolas

---

<div class="post-metadata">

**Author:** ![ram](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.nylas.com/ram/32/3_2.png) [@ram](https://forums.nylas.com/u/ram)\
**Post date:** [April 8, 2024, 6:13pm UTC](https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156/2 "2024-04-08T18:13:08Z")

</div>

Hi @nicodumans, thanks for reaching out!

I notice you receive `Invalid API Key`, did you replace `YOUR_API_KEY` with a API Key created on the [Nylas Dashboard](https://dashboard-v3.nylas.com) for the specific application?

 ![Screenshot 2024-04-08 at 2.11.58 PM](https://us1.discourse-cdn.com/flex015/uploads/nylas3/original/1X/308562bf3d890d1771f84d4d4826a62df1dae2ef.png)

The API Key value will start with something like `nyk_`

---

<div class="post-metadata">

**Author:** ![guyh](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@guyh](https://forums.nylas.com/u/guyh)\
**Post date:** [April 10, 2024, 11:21am UTC](https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156/3 "2024-04-10T11:21:20Z")

</div>

@ram  
I am getting the same problem in the sandbox app

I did replace the “YOUR\_API\_KEY”, I tried replacing manually, also the UI replaces it automatically (there is even a comment at the top of the code snippet in the UI saying they did it for me)  
I tried regenerating the api key and replacing again  
recreating the app  
recreating the grant

nothing worked, any clues?

EDIT: It worked when I recreated the app with USA data residency, this isn’t good for me because I work in Europe, you should probably check this out

---

<div class="post-metadata">

**Author:** ![nicodumans](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nicodumans](https://forums.nylas.com/u/nicodumans)\
**Post date:** [April 10, 2024, 10:00pm UTC](https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156/4 "2024-04-10T22:00:08Z")

</div>

Hello @ram

Yes I do that. 🥲

---

<div class="post-metadata">

**Author:** ![ram](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.nylas.com/ram/32/3_2.png) [@ram](https://forums.nylas.com/u/ram)\
**Post date:** [April 12, 2024, 7:58pm UTC](https://forums.nylas.com/t/type-token-unauthorized-access-message-invalid-api-key/156/5 "2024-04-12T19:58:27Z")

</div>

Hi @guyh, thanks for sharing, just to clarify your comment:

> EDIT: It worked when I recreated the app with USA data residency, this isn’t good for me because I work in Europe, you should probably check this out

Were you using an US Region `Nylas API Key` with the EU [Nylas API URL](https://developer.nylas.com/docs/dev-guide/platform/data-residency/) (`https://api.eu.nylas.com`)causing the error?
