# API to extract host groups and their IDs available in the environment

**URL:** <https://community.dynatrace.com/t/api-to-extract-host-groups-and-their-ids-available-in-the-environment/21504>\
**Category:** Dynatrace API\
**Tags:** hosts-classic, dynatrace-api\
**Created:** [February 15, 2021, 2:13pm UTC](https://community.dynatrace.com/t/api-to-extract-host-groups-and-their-ids-available-in-the-environment/21504 "2021-02-15T14:13:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BHA5472](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@BHA5472](https://community.dynatrace.com/u/BHA5472)\
**Post date:** [February 15, 2021, 2:13pm UTC](https://community.dynatrace.com/t/api-to-extract-host-groups-and-their-ids-available-in-the-environment/21504/1 "2021-02-15T14:13:06Z")

</div>

Is there any API to extract host groups and their ids available in the environment?

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [February 15, 2021, 2:48pm UTC](https://community.dynatrace.com/t/api-to-extract-host-groups-and-their-ids-available-in-the-environment/21504/2 "2021-02-15T14:48:17Z")

</div>

While there is nothing that will grab that values directly, that im aware of, you can get the data that you are looking for via the following API:

 ![28228-1613400191583.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a9deb57c3145679f5eb122338734bcb773dfdff9.png)

and within that Json the data you are looking for exists. But you’ll need to parse that data out.

 ![28256-1613400238850.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/e/4e65e1298910a5cdab77c97f61178e5f4321990d.png)

Parsing Example:

 ![28261-1613400467702.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/8/b80a3f318789a976baf0f4544e87bc52de021e26.png)

 ![28257-1613400478411.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/9/49280ea5ed8fd34d47074718fdeea0a7f0c9025e.png)
