# Day 12- 30 days for developers\_ Postman API

**URL:** <https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508>\
**Category:** Help Hub\
**Tags:** authentication\
**Created:** [October 20, 2023, 4:26am UTC](https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508 "2023-10-20T04:26:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pstest09](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@pstest09](https://community.postman.com/u/pstest09)\
**Post date:** [October 20, 2023, 4:26am UTC](https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508/1 "2023-10-20T04:26:31Z")

</div>

I have added authorization at the collection level.  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/5/654bc79fa7fd22b6430671f04893587856e0c912.png)  
At the folder level and request level I have selected Inherit auth from parent.  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/1/c1c8eda81f36160a562e69e2f225ad2e2b098bb3.png)

but when I am running the request I am getting a 401 error.  
API key is valid which was inherited to this request.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/5/8/583d272273d64c8c660028b7d4a1e0c63c7d2ecd.png)

Can any one please clarify this ?

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [October 20, 2023, 3:27pm UTC](https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508/2 "2023-10-20T15:27:05Z")

</div>

Day 12 of what?

There are several challenges that are split into days.

Is it the 15 days for testers, or the 30 days for developers?

I suspect is because the key should be called “x-api-key” instead of “apikey”.

Tip: Put your actual API key in an environment variable. (In the current value).

---

<div class="post-metadata">

**Author:** ![pstest09](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@pstest09](https://community.postman.com/u/pstest09)\
**Post date:** [October 22, 2023, 11:30pm UTC](https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508/3 "2023-10-22T23:30:49Z")

</div>

I have updated the heading. But I believe key name we can give anything. That should not be an issue.  
Yes, my API key is placed in the env variable only.

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [October 23, 2023, 8:29am UTC](https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508/4 "2023-10-23T08:29:50Z")

</div>

No, the key name key needs to match what the API is expecting.

[Postman API | Postman Public Workspace | Postman API Network](https://www.postman.com/postman/workspace/postman-public-workspace/documentation/12959542-c8142d51-e97c-46b6-bd77-52bb66712c9a)

## Authentication

_Postman uses API keys for authentication. The API key tells the API server that the request came from you. Everything that you have access to in Postman is accessible with your API key. You can [generate](https://learning.postman.com/docs/developer/postman-api/authentication/#generate-a-postman-api-key) a Postman API key in the [**API keys**](https://postman.postman.co/settings/me/api-keys) section of your Postman account settings._

_You must include an API key in each request to the Postman API with the `X-Api-Key` request header. In Postman, you can store your API key as an [environment variable](https://www.getpostman.com/docs/environments). The Postman API [collection](https://www.getpostman.com/docs/collections) will use it to make API calls._

However, the following is also relevant.

### Using the API key as a query parameter

_Requests that accept the `X-Api-Key` request header also accept the API key when you send it as the `apikey` query parameter. An API key sent as part of the header has a higher priority when you send the key as both a request header and a query parameter._

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [November 22, 2023, 8:29am UTC](https://community.postman.com/t/day-12-30-days-for-developers-postman-api/53508/5 "2023-11-22T08:29:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
