# Assigning device to a group via API results in 404 error

**URL:** <https://hub.mender.io/t/assigning-device-to-a-group-via-api-results-in-404-error/5108>\
**Category:** General Discussions\
**Tags:** api\
**Created:** [July 12, 2022, 1:16am UTC](https://hub.mender.io/t/assigning-device-to-a-group-via-api-results-in-404-error/5108 "2022-07-12T01:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![msaenger](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@msaenger](https://hub.mender.io/u/msaenger)\
**Post date:** [July 12, 2022, 1:16am UTC](https://hub.mender.io/t/assigning-device-to-a-group-via-api-results-in-404-error/5108/1 "2022-07-12T01:16:49Z")

</div>

Hello all. I’m using Mender Professional and had a question regarding using the API (specifically this one [https://docs.mender.io/api/#management-api-device-inventory-assign-group](https://docs.mender.io/api/#management-api-device-inventory-assign-group)) to add an authorized device to a specific group. I’ve seen a handful of incidents (relatively rare) in our device provisioning flow that results in a 404 return code from this API when trying to add a new device that has just been authorized. Under what circumstances could this return a 404 other than the obvious scenario that the device doesn’t exist? If our flow preauthorizes and authorizes a new device and then immediately assigns it to a group, is it possible that the new device isn’t quite finished being provisioned on the backend leading to a 404 error when trying to assign it to a group?

---

<div class="post-metadata">

**Author:** ![msaenger](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@msaenger](https://hub.mender.io/u/msaenger)\
**Post date:** [July 13, 2022, 7:26pm UTC](https://hub.mender.io/t/assigning-device-to-a-group-via-api-results-in-404-error/5108/2 "2022-07-13T19:26:39Z")

</div>

Looks like there were data sync issues on June 16 which is when these errors happened for me. I’m assuming this is likely the cause.

![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/b/b276110bb6ed5fb5afaeb31856b6a219f41ac985.png)

---

<div class="post-metadata">

**Author:** ![diekleinekuh](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/diekleinekuh/32/1716_2.png) [@diekleinekuh](https://hub.mender.io/u/diekleinekuh)\
**Post date:** [November 6, 2023, 3:52pm UTC](https://hub.mender.io/t/assigning-device-to-a-group-via-api-results-in-404-error/5108/3 "2023-11-06T15:52:43Z")

</div>

We also had this happending today. I couldn’t seen anything in the status page today though. Is creating a preauthorized device via API and moving it into a group right afte rcreation succeeded triggering a race condition on mender side maybe?
