# API Key not working

**URL:** <https://community.hubspot.com/t/api-key-not-working/68212>\
**Category:** APIs & Integrations\
**Created:** [October 31, 2022, 1:19pm UTC](https://community.hubspot.com/t/api-key-not-working/68212 "2022-10-31T13:19:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AAwachi](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@AAwachi](https://community.hubspot.com/u/AAwachi)\
**Post date:** [October 31, 2022, 1:19pm UTC](https://community.hubspot.com/t/api-key-not-working/68212/1 "2022-10-31T13:19:13Z")

</div>

I just made a new private app, replaced my old API key with the new Access Token and It’s just not working and Is not connecting my site with hubspot. Is the API URL still [https://api.hubapi.com](https://api.hubapi.com) ? Or did i need to do anything more then just make a private app?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 31, 2022, 4:12pm UTC](https://community.hubspot.com/t/api-key-not-working/68212/2 "2022-10-31T16:12:21Z")

</div>

Hey, @AAwachi 👋 One question — how are you including your Private App key for authorization? Private App keys are **not** included in the request URL. You’ll need to include it in the request header. Here is more information:

- [Authentication Overview](https://legacydocs.hubspot.com/docs/methods/auth/oauth-overview)
- [Using OAuth 2.0 access tokens](https://legacydocs.hubspot.com/docs/methods/oauth2/using-access-tokens) (applies to Private Apps)

If you are including your Private App as a bearer token in the Authorization http header, can you share an example request and response, please? Along with the specific endpoint you are using.

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![jparakkalli](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@jparakkalli](https://community.hubspot.com/u/jparakkalli)\
**Post date:** [October 31, 2022, 4:36pm UTC](https://community.hubspot.com/t/api-key-not-working/68212/3 "2022-10-31T16:36:52Z")

</div>

Same issue for me also. i am calling from [Asp.net](http://Asp.net) core Skarp.HubSpotClient library like this

…

\_hubspotContactClient = new HubSpotContactClient(“token”);

\_hubspotContactClient.GetByIdAsync\<MyModelClass\>(12345);

…

---

<div class="post-metadata">

**Author:** ![AAwachi](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@AAwachi](https://community.hubspot.com/u/AAwachi)\
**Post date:** [November 1, 2022, 8:06am UTC](https://community.hubspot.com/t/api-key-not-working/68212/4 "2022-11-01T08:06:09Z")

</div>

I just added it here

 ![AAwachi_1-1667289963589.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/7/f7b06650217ad75a5050341c5f364c270ba80a6a.png)

The old API key worked when I had it placed in the Access Key section but know when I am using private apps and paste the new access key in it’s just not connecting, is the code need to be different?

---

<div class="post-metadata">

**Author:** ![PAtlan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/patlan/32/42298_2.png) [@PAtlan](https://community.hubspot.com/u/PAtlan)\
**Post date:** [November 1, 2022, 8:01am UTC](https://community.hubspot.com/t/api-key-not-working/68212/5 "2022-11-01T08:01:47Z")

</div>

It took me a while to understand, but the Access Token does not behave like an API Key. It behaves like an OAuth token. For example, if you try out one of the examples in the API documentation, you need to check OAuth instead of API (actually I just checked, and they’ve added a third option: Private App Access token ;-))

If you’re like me and very unclear on authentication protocols, I’d suggest looking at the API Doc and/or trying to set up tests via Postman. It’s great to understand what’s going on.
