# Retrieving events

**URL:** <https://discuss.blues.com/t/retrieving-events/3278>\
**Category:** Uncategorized\
**Created:** [September 6, 2025, 5:46pm UTC](https://discuss.blues.com/t/retrieving-events/3278 "2025-09-06T17:46:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rksteeves](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rksteeves](https://discuss.blues.com/u/rksteeves)\
**Post date:** [September 6, 2025, 5:46pm UTC](https://discuss.blues.com/t/retrieving-events/3278/1 "2025-09-06T17:46:07Z")

</div>

Has anything changed the lasted few days, definitely less that a week?

I had a python program to retrieve from notehub, events over the past 24 hours. It stopped working a couple of days ago. I ran it directly from my laptop to check and I am getting a 400 status from my request.

Code below

headers = CaseInsensitiveDict()  
headers[“Content-Type”] = “application/json”

data = ‘{“username":"xxxxxxx”, “password”: “xxxxx”}’

resp = requests.post(url, headers=headers, data=data)

print(resp.status\_code)

Randy

---

<div class="post-metadata">

**Author:** ![marcin](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@marcin](https://discuss.blues.com/u/marcin)\
**Post date:** [September 6, 2025, 9:22pm UTC](https://discuss.blues.com/t/retrieving-events/3278/3 "2025-09-06T21:22:02Z")

</div>

Hello Randy,

You’re using session tokens as the authentication method for the Notehub API.

A couple of days ago, we have introduced a new authentication mechanism using personal access tokens: [New in Notehub: Personal Access Tokens - Blues - Product Updates](https://new.blues.dev/new-in-notehub-personal-access-tokens-2lQfCw)

These changes are aimed at improving an overall system security by giving our users capabilities to manage their API tokens in Notehub. However, in order to be able to manage these tokens, we introduced a restriction on the number of tokens each user may have in a given moment of time. The current limit is set at 10.

Does your script use the _/auth/login_ endpoint to generate a new token each time you run it? If yes, my guess is that it hits the limit of available tokens.

If my guess is correct, you need to:

1. create a new API token in the Notehub UI (using [these instructions](https://dev.blues.io/api-reference/notehub-api/api-introduction/#authentication-with-personal-access-tokens))
2. copy the API token
3. adapt your script to always use this token in your Notehub API requests. As a security precaution, we advise that you read the token from an environmental variable you create on your machine and don’t put it directly into your script.

Please let me know if this helps. If not, we’ll continue debugging.

Cheers,  
Marcin

---

<div class="post-metadata">

**Author:** ![rksteeves](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rksteeves](https://discuss.blues.com/u/rksteeves)\
**Post date:** [September 6, 2025, 10:41pm UTC](https://discuss.blues.com/t/retrieving-events/3278/4 "2025-09-06T22:41:00Z")

</div>

Thanks, I will look into this tomorrow and let you know.

randy

---

<div class="post-metadata">

**Author:** ![rksteeves](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@rksteeves](https://discuss.blues.com/u/rksteeves)\
**Post date:** [September 7, 2025, 2:08pm UTC](https://discuss.blues.com/t/retrieving-events/3278/5 "2025-09-07T14:08:44Z")

</div>

Your suggestion fixed the problem.

I was creating tokens dynamically. I deleted all but a couple of tokens and created a new one and added it into my program and the program worked as expected.

Thanks for your hlp

Randy
