# Using API key in authorization getting 401 error

**URL:** <https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946>\
**Category:** Help Hub\
**Tags:** authentication\
**Created:** [February 3, 2021, 4:03pm UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946 "2021-02-03T16:03:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pnikalas](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pnikalas](https://community.postman.com/u/pnikalas)\
**Post date:** [February 3, 2021, 4:03pm UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946/1 "2021-02-03T16:03:07Z")

</div>

Hello! I’m trying to use POST method to add new info to API but have a problem with authorization.  
Using API key in authorization I getting 401 error.

 ![Screenshot1](https://us1.discourse-cdn.com/getpostman/original/2X/3/350215799554dbe1b143800c221a61961f926957.png)  
 ![Screenshot2](https://us1.discourse-cdn.com/getpostman/original/3X/5/7/570e664d9a9156ada3c28fd9aec07f90392645da.png)

Could you please help? What can be the issue? And what can I do to avoid this error?

---

<div class="post-metadata">

**Author:** ![sseenivasan89](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/sseenivasan89/32/8350_2.png) [@sseenivasan89](https://community.postman.com/u/sseenivasan89)\
**Post date:** [February 3, 2021, 4:29pm UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946/2 "2021-02-03T16:29:13Z")

</div>

Can you confirm the key name is “id” or “token” for your API value

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [February 3, 2021, 10:05pm UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946/4 "2021-02-03T22:05:46Z")

</div>

How do you _know_ that it should be `id`?

Are you following some documentation for that API, if so, can you share a link to it.

I don’t know the implementation of that API but I wouldn’t expect that value to be `id`.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [February 3, 2021, 10:12pm UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946/5 "2021-02-03T22:12:07Z")

</div>

[https://api.affise.com/docs3.1/](https://api.affise.com/docs3.1/)

It looks like the key is `API-Key` which can be used in either the request header or in a query param.

[https://api.affise.com/docs3.1/#add-advertiser](https://api.affise.com/docs3.1/#add-advertiser)

If you take the `curl` at the top of the page and in Postman, open `Import > Raw text` it will create the request for you. You just need to fill in the blanks.

---

<div class="post-metadata">

**Author:** ![pnikalas](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pnikalas](https://community.postman.com/u/pnikalas)\
**Post date:** [February 4, 2021, 9:01am UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946/6 "2021-02-04T09:01:13Z")

</div>

Thank you Danny Dainton! You are the best! All is working!

---

<div class="post-metadata">

**Author:** ![ken4ward](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@ken4ward](https://community.postman.com/u/ken4ward)\
**Post date:** [May 20, 2023, 2:27pm UTC](https://community.postman.com/t/using-api-key-in-authorization-getting-401-error/19946/7 "2023-05-20T14:27:00Z")

</div>

@danny-dainton You deserved a medal
