# Undefined index: apikey

**URL:** <https://community.postman.com/t/undefined-index-apikey/7311>\
**Category:** Help Hub\
**Created:** [August 21, 2019, 3:17pm UTC](https://community.postman.com/t/undefined-index-apikey/7311 "2019-08-21T15:17:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_88](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@William\_88](https://community.postman.com/u/William_88)\
**Post date:** [August 21, 2019, 3:17pm UTC](https://community.postman.com/t/undefined-index-apikey/7311/1 "2019-08-21T15:17:01Z")

</div>

Hello, I’m trying to send a POST request and I receive following error:

{  
“status”: “error”,  
“timestamp”: 1566398098,  
“error”: {  
“code”: 0,  
“message”: “Undefined index: apikey”  
}  
}

I tried to put my apikey like headers and also directly in the URL adding it like parameter but the error is still the same, where I’m wrong?

---

<div class="post-metadata">

**Author:** ![aamir.ahmed](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@aamir.ahmed](https://community.postman.com/u/aamir.ahmed)\
**Post date:** [August 22, 2019, 6:41am UTC](https://community.postman.com/t/undefined-index-apikey/7311/2 "2019-08-22T06:41:33Z")

</div>

Hi @William_88,

Welcome to the Postman community! Have you navigated to the Authorization tab as shown in the below screenshot and selecting the Type as API Key and entered the apikey values?

 ![addAPIKey](https://us1.discourse-cdn.com/getpostman/original/3X/1/b/1b0ef046592ae0e7f70e03f4ce5347a889fbf4a3.png)

---

<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:** [August 22, 2019, 7:37am UTC](https://community.postman.com/t/undefined-index-apikey/7311/3 "2019-08-22T07:37:22Z")

</div>

Hey @William_88,

Without knowing more about the API you’re using, it’s just going to be a guessing game as to _where_ that api key needs to be placed.

Is this a public API that has some documentation that you can share?

---

<div class="post-metadata">

**Author:** ![William\_88](https://avatars.discourse-cdn.com/v4/letter/w/f04885/32.png) [@William\_88](https://community.postman.com/u/William_88)\
**Post date:** [August 22, 2019, 12:23pm UTC](https://community.postman.com/t/undefined-index-apikey/7311/4 "2019-08-22T12:23:00Z")

</div>

Hello, thank you for the answer.  
See below what say the documentation about the authentication:

Example of request authentication:

```auto
apikey=c3KJ7M5jw8SKSrq3QnKA8D7DHZCpwSlx&nonce=1455036025843&apisignature=9a6729684c40a7c66892782cc3b0426833e699a1b77e1a5b44d63d82ba83667

```

Where parameters are:

```
apikey - Your key generated in your account
nonce - current unix timestamp
apisignature - signature (digest) of the request params passed through HMAC-SHA256

```

To generate the apisignature, you have to pass the request payload (i.e. apikey, nonce + request parameters) through hash method using the secret key provided from the UI

And below an example in Javascript:

```auto
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js"></script>
<script>
    var xhr = new XMLHttpRequest(),
        secret = 'aefij3ldaase_ase23fdAdwjnA2123fFa',
        body = 'apikey=' + 'dgsdrij234fsdfgkhr' + '&nonce=' + Date.now();

    var signature = CryptoJS.HmacSHA256(body, secret);

    xhr.open('POST', 'https://www.account.com/api/offer/list');
    xhr.setRequestHeader('Content-Type', 'text/plain');
    xhr.setRequestHeader('Accept', 'application/json');  
    xhr.send(body + '&apisignature=' + signature);    
</script>

```

I already tried something that not require authentication and it worked but no result when is required the authentication.
