# How to get "this" device's uuid from node sdk

**URL:** <https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073>\
**Category:** Product support\
**Tags:** raspberrypi3\
**Created:** [August 30, 2019, 3:32pm UTC](https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073 "2019-08-30T15:32:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joseph](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/joseph/32/2157_2.png) [@joseph](https://forums.balena.io/u/joseph)\
**Post date:** [August 30, 2019, 3:32pm UTC](https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073/1 "2019-08-30T15:32:20Z")

</div>

Hi,

I’m trying to setup a fleet of local pi3 servers which all need to communicate with a distant api server.  
They all need to authenticate with their own credentials, so I thought I’d use device environment variables to store these individual credentials and get them from the node sdk on boot.

Now I’m actually getting the environment variables successfully using `balena.models.device.envVar.getAllByApplication('my-app')`, but I expected to get only the variables of the machine performing the call to the balena api through the sdk.  
Instead of this I get the environment variables of all the devices.  
It seems I could pick the right ones if only I knew the device’s uuid, but I can’t figure out how to get this uuid from my node program.

Is this even possible, or am I supposed to create an application per server (which doesn’t sound like the right thing to do for the exact same node program) ?  
Maybe I missed a specific method in the documentation ?

---

<div class="post-metadata">

**Author:** ![joseph](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/joseph/32/2157_2.png) [@joseph](https://forums.balena.io/u/joseph)\
**Post date:** [August 30, 2019, 3:43pm UTC](https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073/2 "2019-08-30T15:43:19Z")

</div>

Ok, nevermind, it was me being stupid.  
All vars are accessible from `process.env` (I guess that’s why they are called environment variables), so the sdk is not even needed.  
Everything working great now 🙂

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [August 30, 2019, 4:35pm UTC](https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073/3 "2019-08-30T16:35:08Z")

</div>

Hi @joseph,

I am glad you were able to figure this out! Please let us know if you have any further issues deploying to balenaCloud.

---

<div class="post-metadata">

**Author:** ![xginn8](https://avatars.discourse-cdn.com/v4/letter/x/8baadc/32.png) [@xginn8](https://forums.balena.io/u/xginn8)\
**Post date:** [August 30, 2019, 4:37pm UTC](https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073/4 "2019-08-30T16:37:45Z")

</div>

Hi @joseph,

I am glad you were able to figure this out! Please let us know if you have any further issues deploying to balenaCloud.

---

<div class="post-metadata">

**Author:** ![joseph](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/joseph/32/2157_2.png) [@joseph](https://forums.balena.io/u/joseph)\
**Post date:** [August 30, 2019, 5:06pm UTC](https://forums.balena.io/t/how-to-get-this-devices-uuid-from-node-sdk/29073/5 "2019-08-30T17:06:48Z")

</div>

Thanks !

So I guess the answer to my original question (how to get “this” device’s uuid from the sdk) lies in the solution I found : you could match a device env var with its uuid when parsing the result of

```auto
balena.models.device.envVar.getAllByApplication('my-app')

```

(In case it would be helpful to someone)
