# Unable to Get API token

**URL:** https://discuss.elastic.co/t/unable-to-get-api-token/232051
**Category:** Elasticsearch
**Created:** [May 11, 2020, 2:55pm UTC](https://discuss.elastic.co/t/unable-to-get-api-token/232051 "2020-05-11T14:55:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![remo\_anil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/remo_anil/32/54483_2.png) [@remo\_anil](https://discuss.elastic.co/u/remo_anil)
#### Post date: [May 11, 2020, 2:55pm UTC](https://discuss.elastic.co/t/unable-to-get-api-token/232051/1 "2020-05-11T14:55:55Z")

</div>

Hi all,

Need help !! This is my first post.

i am trying to get API token/Key to read some logs from Kibana server using API.  
Below is the information i Have used.

API URI - [http://xxxxxxxxxxxxxxxx:9200/\_xpack/security/oauth2/token](http://xxxxxxxxxxxxxxxx:9200/_xpack/security/oauth2/token)  
Body - {  
"grant\_type": "password",  
"username" : "username",  
"password" : "password"

}

but getting below error  
'{  
"error": {  
"root\_cause": [  
{  
"type": "security\_exception",  
"reason": "missing authentication token for REST request [/\_xpack/security/oauth2/token]",  
"header": {  
"WWW-Authenticate": "Basic realm="security" charset="UTF-8""  
}  
}  
],  
"type": "security\_exception",  
"reason": "missing authentication token for REST request [/\_xpack/security/oauth2/token]",  
"header": {  
"WWW-Authenticate": "Basic realm="security" charset="UTF-8""  
}  
},  
"status": 401  
}'

Please assist.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 8, 2020, 2:56pm UTC](https://discuss.elastic.co/t/unable-to-get-api-token/232051/2 "2020-06-08T14:56:07Z")

</div>

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