# Getting API Key

**URL:** <https://discuss.blues.com/t/getting-api-key/3536>\
**Category:** Notehub.io\
**Tags:** encryption\
**Created:** [April 27, 2026, 1:06pm UTC](https://discuss.blues.com/t/getting-api-key/3536 "2026-04-27T13:06:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlosG](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@carlosG](https://discuss.blues.com/u/carlosG)\
**Post date:** [April 27, 2026, 1:06pm UTC](https://discuss.blues.com/t/getting-api-key/3536/1 "2026-04-27T13:06:40Z")

</div>

In this example ([GitHub - tjvantoll/notecard-ack-example: An example web application showing how to do acknowledgments for Notecard- and Notehub-based projects · GitHub](https://github.com/tjvantoll/notecard-ack-example)) a Notehub API Key is required. I tried to use this command: curl -X GET -L ‘[https://api.notefile.net/v1/projects//devices//public-key](https://api.notefile.net/v1/projects//devices//public-key)’ -H ‘Authorization: Bearer \<access\_token\>’

I have generated a token “api\_key\_xxxx..” and introduced in \<access\_token\>. However, it doesn’t work. I get this message:

{“err”:“anonymous users cannot use the API. please provide an authentication token”,“code”:401,“status”:“Unauthorized”,“details”:{“transaction\_id”:“b7b9604f5e279ac5”}}

Can someone explain how to get an API key then?

Thanks

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [April 27, 2026, 1:59pm UTC](https://discuss.blues.com/t/getting-api-key/3536/2 "2026-04-27T13:59:23Z")

</div>

Hi @carlosG,

The recommended way to create an API key is via [Personal Access Tokens](https://dev.blues.io/api-reference/notehub-api/api-introduction/#authentication-with-personal-access-tokens). I would follow those guides in order to access the Notehub APIs.

Thanks,  
Rob

---

<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:** [April 27, 2026, 2:13pm UTC](https://discuss.blues.com/t/getting-api-key/3536/3 "2026-04-27T14:13:34Z")

</div>

@carlosG And thanks for pointing this out!

This example predated our introduction of Personal Access Tokens, and I forgot to update the web app. It should be good to go now. Here’s the relevant update: [notecard-ack-example/webapp/app/page.tsx at 4af4f61ba34e9c68939c9f7787cbf2ad44c39c97 · tjvantoll/notecard-ack-example · GitHub](https://github.com/tjvantoll/notecard-ack-example/blob/4af4f61ba34e9c68939c9f7787cbf2ad44c39c97/webapp/app/page.tsx#L23-L24).

Thanks!

TJ

---

<div class="post-metadata">

**Author:** ![carlosG](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@carlosG](https://discuss.blues.com/u/carlosG)\
**Post date:** [May 3, 2026, 12:22pm UTC](https://discuss.blues.com/t/getting-api-key/3536/4 "2026-05-03T12:22:25Z")

</div>

Thanks @tjvantoll , I think some integrations are failing since the introduction of the PATs. For example, the integration with Blynk. The tutorial is outdated and the Blynk console is requiring “ClientID” and “Client Secret” to be obtained from Notehub Programmatic API access, which is not on Notehub anymore.

[Routing Data to Cloud - IoT Connectivity at Blues](https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud/blynk/)

So, can you please indicate what credentials are now needed for integration with Blynk?

many thanks,

Carlos

---

<div class="post-metadata">

**Author:** ![carlosG](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@carlosG](https://discuss.blues.com/u/carlosG)\
**Post date:** [May 3, 2026, 4:44pm UTC](https://discuss.blues.com/t/getting-api-key/3536/5 "2026-05-03T16:44:21Z")

</div>

Another issue: In the notecard-ack-example, with the PAT, APP\_UID and Device\_UID placed in a .env file, I get this error from the browser:

[browser] Uncaught TypeError: Cannot set properties of undefined (setting ‘accessToken’)  
at Home (app/page.tsx:26:19)

Thanks,

Carlos

---

<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:** [May 4, 2026, 3:00pm UTC](https://discuss.blues.com/t/getting-api-key/3536/6 "2026-05-04T15:00:57Z")

</div>

> I think some integrations are failing since the introduction of the PATs. For example, the integration with Blynk. The tutorial is outdated and the Blynk console is requiring “ClientID” and “Client Secret” to be obtained from Notehub Programmatic API access, which is not on Notehub anymore.
> 
> [Routing Data to Cloud - IoT Connectivity at Blues](https://dev.blues.io/guides-and-tutorials/routing-data-to-cloud/blynk/?_gl=1*c6cu09*_gcl_au*NTI5NTc1MTcyLjE3NzQyNzA2NDM.*_ga*MTE5MTgwMzI5Ny4xNzM0NDYzMTY0*_ga_PJ7RGMWWBX*czE3Nzc5MDQ4MDYkbzgyOCRnMSR0MTc3NzkwNTg1MiRqNTkkbDAkaDI5MjQxODkwNg..&_ga=2.149220150.1864312963.1777896332-1191803297.1734463164)
> 
> So, can you please indicate what credentials are now needed for integration with Blynk?

Ah, thanks for letting us know. You do need the same credentials, but the section they’re in is now named “OAuth” [Notehub API Introduction - IoT Connectivity at Blues](https://dev.blues.io/api-reference/notehub-api/api-introduction/#authentication-with-oauth-bearer-tokens) .

I’ll update the tutorial this week.

> Another issue: In the notecard-ack-example, with the PAT, APP\_UID and Device\_UID placed in a .env file, I get this error from the browser:
> 
> [browser] Uncaught TypeError: Cannot set properties of undefined (setting ‘accessToken’)  
> at Home (app/page.tsx:26:19)

Make sure you have a `.env` file in the `webapp` folder with the following variables defined [notecard-ack-example/webapp at main · tjvantoll/notecard-ack-example · GitHub](https://github.com/tjvantoll/notecard-ack-example/tree/main/webapp#environment-variables) .

I just ran the project locally and I found a [few small issues that I also pushed](https://github.com/tjvantoll/notecard-ack-example/commit/02ec7ffe00eb23b7e856a997428382e2c2eb6c82), so you’ll want to pull down those changes as well.

Thanks for taking the time to let us know about these issues. If you hit any other problems let me know.

TJ

---

<div class="post-metadata">

**Author:** ![carlosG](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@carlosG](https://discuss.blues.com/u/carlosG)\
**Post date:** [May 4, 2026, 8:25pm UTC](https://discuss.blues.com/t/getting-api-key/3536/7 "2026-05-04T20:25:22Z")

</div>

Thanks @tjvantoll. I had a typo in one of the variables. So, that part is solved. The problem I am facing now is related to installing the dependencies. When running ‘npm install’ and ‘npm install --force’ there are 2 moderate severity vulnerabilities remaining. The server cannot run due to several [browser] Uncaught Error: [object Object].

I am planning to create a clean next app and add progressively your code to it.

Thanks,

Carlos

---

<div class="post-metadata">

**Author:** ![carlosG](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@carlosG](https://discuss.blues.com/u/carlosG)\
**Post date:** [May 5, 2026, 8:52am UTC](https://discuss.blues.com/t/getting-api-key/3536/8 "2026-05-05T08:52:59Z")

</div>

I have now re-built the next app from scratch. The issue is when running eventApiInstance.getEvents().then().catch()

The browser gives a long list of errors, like:

[browser] Uncaught Error: [object Object]  
at coerceError (file://C:/Users/… /blues-app/.next/dev/static/chunks/node\_modules\_next\_dist\_115brz8._.js:2275:73)  
at Object.decorateDevError (file://_…_/blues-app/.next/dev/static/chunks/node\_modules\_next\_dist\_115brz8._.js:2294:19)

The Swan on Notecarrier-F is conected to Notehub. The .env file is located at the same folder as page.tsx and contains the right credentials.

Thanks,

Carlos

---

<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:** [May 5, 2026, 2:52pm UTC](https://discuss.blues.com/t/getting-api-key/3536/9 "2026-05-05T14:52:25Z")

</div>

Hey @carlosG,

> The .env file is located at the same folder as page.tsx and contains the right credentials.

The `.env` should be in the root of the Next project. (In the same folder as the `package.json` file.)

That should explain the issue you’re having with the browser errors. I’m not really sure what’s causing your npm issues though, unfortunately. I do like the idea of just starting a new project and copying changes over though—basically all of the relevant logic is in `page.tsx`.

TJ
