# Create a new device

**URL:** <https://forums.losant.com/t/create-a-new-device/3846>\
**Category:** Help\
**Tags:** create-device\
**Created:** [June 12, 2021, 1:24pm UTC](https://forums.losant.com/t/create-a-new-device/3846 "2021-06-12T13:24:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_MacKenzie](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@David\_MacKenzie](https://forums.losant.com/u/David_MacKenzie)\
**Post date:** [June 12, 2021, 1:24pm UTC](https://forums.losant.com/t/create-a-new-device/3846/1 "2021-06-12T13:24:01Z")

</div>

Is there an example of an elegant way to create a new device in a workflow when processing a payload and the referenced device doesn’t already exist? The logic is simply:

- JSON/payload triggers workflow
- payload contains attribute like “DeviceID”
- if “DeviceID” does not exist as a Losant device, create it with a pre-defined set of attributes and tags
- then update appropriate attributes contained in payload

I realize I am being a bit lazy, but I am just hoping someone can quickly point me to something. Thank you.

---

<div class="post-metadata">

**Author:** ![Heath](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/heath/32/3036_2.png) [@Heath](https://forums.losant.com/u/Heath)\
**Post date:** [June 14, 2021, 1:40pm UTC](https://forums.losant.com/t/create-a-new-device/3846/2 "2021-06-14T13:40:13Z")

</div>

Hey @David_MacKenzie,

This is actually a very common approach! You can check out our [blog post](https://www.losant.com/blog/how-devices-can-register-themselves-in-losant), although it is a _bit_ dated.

In practice, you would use a [Device: Get Node](https://docs.losant.com/workflows/data/get-device/) to see if the device exists, and if it doesn’t, you would use the [Device: Create Node](https://docs.losant.com/workflows/data/create-device/) to then create the device, and then subsequently update the state of that device (you will need to put the response of the Device: Create Node on the payload to reference the newly created device’s ID in the State node, though).

Please let me know if this helps.

Thank you,  
Heath
