# Requests failing with error 401 "Unauthorized request"

**URL:** <https://community.shiphero.com/t/requests-failing-with-error-401-unauthorized-request/63>\
**Category:** GraphQL API\
**Created:** [July 31, 2019, 7:01pm UTC](https://community.shiphero.com/t/requests-failing-with-error-401-unauthorized-request/63 "2019-07-31T19:01:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremyw](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jeremyw](https://community.shiphero.com/u/jeremyw)\
**Post date:** [July 31, 2019, 7:01pm UTC](https://community.shiphero.com/t/requests-failing-with-error-401-unauthorized-request/63/1 "2019-07-31T19:01:30Z")

</div>

Hello,

Yesterday (2019-07-30) I was able to process requests just fine, and today I ran the same query with the same credentials, and I’m receiving back an error that just says “{‘message’: ‘Unauthorized request’}” with an error code of 401.

Is anyone else seeing something like this? Any ideas how to resolve it?

Thanks,  
Jeremy

---

<div class="post-metadata">

**Author:** ![seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@seba](https://community.shiphero.com/u/seba)\
**Post date:** [July 31, 2019, 7:43pm UTC](https://community.shiphero.com/t/requests-failing-with-error-401-unauthorized-request/63/2 "2019-07-31T19:43:31Z")

</div>

@jeremyw looks like your token has expired. You can refresh it hitting `/ auth/refresh` passing your refresh token as explained in the docs [https://developer.shiphero.com/getting-started/](https://developer.shiphero.com/getting-started/)

---

<div class="post-metadata">

**Author:** ![jeremyw](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jeremyw](https://community.shiphero.com/u/jeremyw)\
**Post date:** [July 31, 2019, 7:57pm UTC](https://community.shiphero.com/t/requests-failing-with-error-401-unauthorized-request/63/3 "2019-07-31T19:57:09Z")

</div>

Ah. Thanks, @seba. How long do I typically have before I have to refresh the token? Also, do I have to wait until my current token expires, or can I refresh it ahead of time?

---

<div class="post-metadata">

**Author:** ![seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@seba](https://community.shiphero.com/u/seba)\
**Post date:** [July 31, 2019, 9:19pm UTC](https://community.shiphero.com/t/requests-failing-with-error-401-unauthorized-request/63/4 "2019-07-31T21:19:54Z")

</div>

@jeremyw usually a month. And yes you can refresh before that time (the old one will still be valid though until it expires)
