# Help with API Authentication Error

**URL:** <https://community.shiphero.com/t/help-with-api-authentication-error/2950>\
**Category:** Getting Started\
**Created:** [June 18, 2024, 7:31pm UTC](https://community.shiphero.com/t/help-with-api-authentication-error/2950 "2024-06-18T19:31:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregbowers](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/gregbowers/32/876_2.png) [@gregbowers](https://community.shiphero.com/u/gregbowers)\
**Post date:** [June 18, 2024, 7:31pm UTC](https://community.shiphero.com/t/help-with-api-authentication-error/2950/1 "2024-06-18T19:31:35Z")

</div>

Hello 🙂

I am new to using the ShipHero API and I am facing an issue . I am trying to authenticate my requests ; but I keep getting an “Invalid Credentials” error. 🤔 🤔  
I have generated a new API key from the ShipHero dashboard.  
I am using Python and the requests library to send my API requests.

import requests;

url = "https:// public -api.shiphero.com/auth/token "  
headers = {  
“Content-Type”: “application/json”,  
“Authorization”: “Bearer MY\_API\_KEY”  
}  
response = requests.get(url, headers=headers)  
print(response.status\_code)  
print(response.json())

Despite this, the response I get is:  
{  
“error”: “invalid\_credentials”,  
“message”: “The provided credentials are invalid.”  
}  
I have rechecked the API key and even regenerated it a couple of times to ensure it’s correct. I have checked [Getting Started – Developer Resources | ShipHero](https://developer.shiphero.com/getting-started/) [mulesoft](https://www.igmguru.com/digital-marketing-programming/mulesoft-training/) documentation but still need help .

Has anyone else faced this issue? Any suggestions would be greatly appreciated!

Thanks in advance!

Thank you  
gregbowers

---

<div class="post-metadata">

**Author:** ![tomasfd](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tomasfd](https://community.shiphero.com/u/tomasfd)\
**Post date:** [June 19, 2024, 4:06pm UTC](https://community.shiphero.com/t/help-with-api-authentication-error/2950/2 "2024-06-19T16:06:49Z")

</div>

Hi Greg,

It looks like you are hitting the token endpoint `https://public-api.shiphero.com/auth/token` using the authorization header. The authorization header and the bearer token acquired are to authenticate while querying to the graphql endpoint: `https://public-api.shiphero.com/graphql.`

Have a nice day!
