# HTTP API to get session token with Postman

**URL:** <https://discuss.blues.com/t/http-api-to-get-session-token-with-postman/1120>\
**Category:** Notecard API\
**Created:** [December 12, 2022, 10:50am UTC](https://discuss.blues.com/t/http-api-to-get-session-token-with-postman/1120 "2022-12-12T10:50:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![markwkiehl](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/markwkiehl/32/622_2.png) [@markwkiehl](https://discuss.blues.com/u/markwkiehl)\
**Post date:** [December 12, 2022, 10:50am UTC](https://discuss.blues.com/t/http-api-to-get-session-token-with-postman/1120/1 "2022-12-12T10:50:56Z")

</div>

I continue to receive a “ **Status: Bad Request** ” regardless of what options I try using in Postman to send a POST to get a session token. This is not my first time using Postman for an API, and I’m usually pretty successful in a short amount of time.

I am sending a POST to: [https://api.notefile.net/auth/login](https://api.notefile.net/auth/login)

I am sending ‘{“username”:“[you@youremail.com]”, “password”: “[your\_password]”}’ as JSON in Postman as shown in the documentation ([Using the Notehub API - Blues Wireless Developers](https://dev.blues.io/guides-and-tutorials/using-the-notehub-api/#authenticating)) has same result.

I also tried setting Authorization to ‘Basic Auth’ and entering my Notehub username and password returns same response.

I’m starting to think another problem exists. I logged out and back into [notehub.io](http://notehub.io) to verify my login credentials. Is using my Notehub login credentials for the API correct?

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [December 12, 2022, 2:37pm UTC](https://discuss.blues.com/t/http-api-to-get-session-token-with-postman/1120/2 "2022-12-12T14:37:23Z")

</div>

Hi @markwkiehl,

It looks like you have everything formatted correctly. A couple of things you might try:

1. Make sure you’re using standard ASCII quotes and not smart quotes—aka `"name"` and not `”name”`
2. Make sure you’re _not_ including the brackets in your body—aka don’t use `[` and `]`.

Your POST body should look something like this.

```auto
{"username":"tj@blues.com","password":"yourpassword"}

```

You could also try sending the request through `curl` to see if you have something incorrectly configured in Postman.

TJ

---

<div class="post-metadata">

**Author:** ![markwkiehl](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/markwkiehl/32/622_2.png) [@markwkiehl](https://discuss.blues.com/u/markwkiehl)\
**Post date:** [December 12, 2022, 11:22pm UTC](https://discuss.blues.com/t/http-api-to-get-session-token-with-postman/1120/3 "2022-12-12T23:22:48Z")

</div>

tjvantoll, thank you for trying to help me.

My request is formatted exactly as you suggested. No “” or strange double quotes.

I also have trouble with executing any CLI JSON request (-req), but no problems with requests from the In-Browser Terminal. I’m stumbling and struggling a lot more than I usually do with Notecard / Notehub for some reason.

Any chance my problems are unique to Windows OS? Has anyone successfully performed Notecard CLI requests from Windows OS? How about obtaining a session token with something other than cURL?

---

<div class="post-metadata">

**Author:** ![markwkiehl](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/markwkiehl/32/622_2.png) [@markwkiehl](https://discuss.blues.com/u/markwkiehl)\
**Post date:** [December 13, 2022, 10:59am UTC](https://discuss.blues.com/t/http-api-to-get-session-token-with-postman/1120/4 "2022-12-13T10:59:26Z")

</div>

It turns out cURL is installed with Windows 10 & 11 OS. I tried the cURL command, and after a lot of reformatting what was published in the Notecard documents, I got the following to work:

curl – verbose --request POST --location [https://api.notefile.net/auth/login](https://api.notefile.net/auth/login) --data “{"username":"[you@youremail.com]", "password": "[your\_password]"}”

Note that the values for “username” and “password” need to be URL encoded., the double quotes within the JSON needs to be escaped, and the JSON needs to be bounded by double quotes for Windows OS.
