# Finding the last deployment for a group using REST API

**URL:** <https://hub.mender.io/t/finding-the-last-deployment-for-a-group-using-rest-api/3814>\
**Category:** General Discussions\
**Tags:** api, management-api\
**Created:** [June 30, 2021, 2:29pm UTC](https://hub.mender.io/t/finding-the-last-deployment-for-a-group-using-rest-api/3814 "2021-06-30T14:29:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![teonaseverin](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@teonaseverin](https://hub.mender.io/u/teonaseverin)\
**Post date:** [June 30, 2021, 2:29pm UTC](https://hub.mender.io/t/finding-the-last-deployment-for-a-group-using-rest-api/3814/1 "2021-06-30T14:29:06Z")

</div>

Hi everyone,

I am using a production server (v 2.6.1) and I am trying to automise some steps when it comes to accepting devices or creating deployments using the API.

In this context, when I add a new device to a group, I would like to be able to automatically create a new deployment on that group (with the group’s latest update), so that the new device runs the same version as the other devices on the group. My question is, is there a way to find out the last deployment for a specific group or device using the REST API? I’ve search through the documentation, but I didn’t manage to find this information.

Thank you very much!

---

<div class="post-metadata">

**Author:** ![lramirez](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lramirez/32/1195_2.png) [@lramirez](https://hub.mender.io/u/lramirez)\
**Post date:** [June 30, 2021, 8:58pm UTC](https://hub.mender.io/t/finding-the-last-deployment-for-a-group-using-rest-api/3814/2 "2021-06-30T20:58:57Z")

</div>

Hi @teonaseverin,

You can use devices endpoint defined here: [Mender API docs](https://docs.mender.io/api/#management-api-device-inventory)

For example, you can filter it by:

${MENDER-URL}/api/management/v1/inventory/devices?group=cool-group-name

Look at **group=name** above

And the value in the response you are looking for is:

```
   { "name": "artifact_name",
    "value": "release-1", «-- This value
    "scope": "inventory"}

```

Please let me know if this is useful for you 🙂

Luis
