I'm getting 401 Unauthorized Error

Hi everybody,

I attempted to post a request on Postman, however it was rejected owing to a 401 unauthorised error.

Details (like screenshots):


How I found the problem:

I’ve already tried:
I’ve tried so many times but it seems not to be working.

Hey there, thanks for joining the community.

I signed up with planet.com to see what’s going on, and when looking through their documentation on Basemaps Overview, it appears that the way you’re setting the authentication is incorrect. You don’t send it as an API Key in a header like this.

What they outline are three methods to authenticate: Basic Auth, an Authorization header, or as a query parameter:

Basic Auth
What worked for me, was setting the Auth type to “Basic Auth”, pasting my API Key into the “Username” field, and leaving the “Password” field blank.

Header
Set the auth type to “API Key”, set the “Key” value to “Authorization” and set the value to be a combined string of api-key YOUR_API_KEY for example api-key PLAKc198123abcdef

Query Parameter
Set the auth type to “No Auth”, and instead go into the “Params” portion of the URL builder and add a param key called api_key and set the value to your API key. Note that I wasn’t able to get a successful response from the Orders API using this method, but I was able to call the Mosaics API this way just fine.

1 Like

Thanks, Ian!

The Basic Auth (method 1) worked and I’ve been able to post my order :smile:

1 Like