# Why it says hapikey does not exist when trying to make the API call request ?

**URL:** <https://community.hubspot.com/t/why-it-says-hapikey-does-not-exist-when-trying-to-make-the-api-call-request/63125>\
**Category:** APIs & Integrations\
**Tags:** php, developer-tools, contacts\
**Created:** [August 17, 2022, 11:39am UTC](https://community.hubspot.com/t/why-it-says-hapikey-does-not-exist-when-trying-to-make-the-api-call-request/63125 "2022-08-17T11:39:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EMCC](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@EMCC](https://community.hubspot.com/u/EMCC)\
**Post date:** [August 17, 2022, 11:39am UTC](https://community.hubspot.com/t/why-it-says-hapikey-does-not-exist-when-trying-to-make-the-api-call-request/63125/1 "2022-08-17T11:39:02Z")

</div>

Hello,  
I am trying to implement the contact creation API using a html form to capture leads. I have created the API key by creating the private app in my hubspot account. But when i am using that particular API key to make the request API call it says api key does not exist.

Can anyone help me with this?  
MY ENDPOINT:

`$endpoint = 'https://api.hubapi.com/contacts/v1/contact?hapikey=XXX-XXX-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';`

Error:  
curl Errors: Status code: 401 Response: {“status”:“error”,“message”:“This hapikey doesn’t exist.”,“correlationId”:“c8ba6603-59a8-43f7-bbda-8330085593af”}

---

<div class="post-metadata">

**Author:** ![LeeBartelme](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leebartelme/32/95647_2.png) [@LeeBartelme](https://community.hubspot.com/u/LeeBartelme)\
**Post date:** [August 17, 2022, 1:56pm UTC](https://community.hubspot.com/t/why-it-says-hapikey-does-not-exist-when-trying-to-make-the-api-call-request/63125/2 "2022-08-17T13:56:19Z")

</div>

The [API key method for authentication is being sunset at the end of November](https://developers.hubspot.com/changelog/upcoming-api-key-sunset) and new development really should take place using private apps and a token. In that case you’ll use your private app token in an Authorization header. I know this doesn’t answer your question, but if you are working on new items you’ll have to change it very soon. I don’t know how much support you’ll get using the depreciated method.

I can’t tell if the error is saying the key is “invalid” i.e. **THIS** hapikey doesn’t exist or if it can’t find it in the request. I’d verify you are using the correct key.

---

<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:** [August 23, 2022, 8:07pm UTC](https://community.hubspot.com/t/why-it-says-hapikey-does-not-exist-when-trying-to-make-the-api-call-request/63125/3 "2022-08-23T20:07:38Z")

</div>

Hey, @LeeBartelme I think this error is telling us that they put the private app key in the request URL, like you do for an API key, instead of including it in the request header.

Thanks for taking the time to help @EMCC 🙌 I appreciate you!

---

<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:** [August 23, 2022, 8:04pm UTC](https://community.hubspot.com/t/why-it-says-hapikey-does-not-exist-when-trying-to-make-the-api-call-request/63125/4 "2022-08-23T20:04:16Z")

</div>

Hey, @EMCC 👋 If you’ve already made the switch to Private Apps, which it sounds like you did, then you’ll need to include your private app key in your header and not in the request URL.

Here’s a quick test I ran using Postman:

- Created Private App in my app test account

- Used this endpoint — [Create a new Contact](https://legacydocs.hubspot.com/docs/methods/contacts/create_contact)  
`POST /contacts/v1/contact​`

- My request

- Which returns a 200OK response

In summary, you’ll need to treat your private app key like an OAuth token and include in your request header. More info here:

- [Authentication Overview](https://legacydocs.hubspot.com/docs/methods/auth/oauth-overview)
- Authorization: Bearer {token} header

Have fun building! — Jaycee
