# How to get "Authorization: Bearer $SENSU\_TOKEN"?

**URL:** <https://discourse.sensu.io/t/how-to-get-authorization-bearer-sensu-token/1526>\
**Category:** Sensu Go\
**Created:** [December 16, 2019, 10:49am UTC](https://discourse.sensu.io/t/how-to-get-authorization-bearer-sensu-token/1526 "2019-12-16T10:49:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![palourde](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/palourde/32/60_2.png) [@palourde](https://discourse.sensu.io/u/palourde)\
**Post date:** [December 16, 2019, 5:13pm UTC](https://discourse.sensu.io/t/how-to-get-authorization-bearer-sensu-token/1526/2 "2019-12-16T17:13:17Z")

</div>

Hi @masifpak,

If you just need to manually query the API, you could export your user access token to your environment variables and use that as the bearer token; keep in mind that this access token is valid for a maximum of 5 minutes so you might need to refresh it often. Here’s how you could use it:

```auto
$ eval $(sensuctl env)
$ curl -H "Authorization: Bearer $SENSU_ACCESS_TOKEN" http://127.0.0.1:8080/api/[...]

```

Alternatively, you could create and use an API key to authenticate against the API if you need long-lived tokens: [https://docs.sensu.io/sensu-go/5.15/reference/apikeys/](https://docs.sensu.io/sensu-go/5.15/reference/apikeys/).

---

_[View the full topic](https://discourse.sensu.io/t/how-to-get-authorization-bearer-sensu-token/1526)._
