# How to fetch all entities?

**URL:** <https://community.dynatrace.com/t/how-to-fetch-all-entities/43808>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [January 24, 2024, 3:23pm UTC](https://community.dynatrace.com/t/how-to-fetch-all-entities/43808 "2024-01-24T15:23:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mango\_byte](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mango\_byte](https://community.dynatrace.com/u/mango_byte)\
**Post date:** [January 24, 2024, 3:23pm UTC](https://community.dynatrace.com/t/how-to-fetch-all-entities/43808/1 "2024-01-24T15:23:39Z")

</div>

Hi, I am trying to fetch all entities as mentioned on official documentation https://{environmentid}.live.dynatrace.com/api/v2/entities

and getting response:

{“error”: {“code”: 400,“message”: “Constraints violated.”,“constraintViolations”: [{“path”: “entitySelector”,“message”: “must be set if next-page-key is not defined”,“parameterLocation”: “QUERY”,“location”: null}]}}Kindly help in clarifying where I am wrong and how to fetch all entities?Thanks

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [January 24, 2024, 3:32pm UTC](https://community.dynatrace.com/t/how-to-fetch-all-entities/43808/2 "2024-01-24T15:32:32Z")

</div>

Hi,

I think you are missing entitySelector:

```markup
curl -X 'GET' \
  'https://XXXXXXXXXX.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22HOST%22%29' \
  -H 'accept: application/json; charset=utf-8' \
  -H 'Authorization: Api-Token XXXXXXXXXX'

```

Best regards

---

<div class="post-metadata">

**Author:** ![Khalid\_Alkhouli](https://avatars.discourse-cdn.com/v4/letter/k/eb9ed0/32.png) [@Khalid\_Alkhouli](https://community.dynatrace.com/u/Khalid_Alkhouli)\
**Post date:** [December 7, 2025, 1:31pm UTC](https://community.dynatrace.com/t/how-to-fetch-all-entities/43808/3 "2025-12-07T13:31:27Z")

</div>

This only gets HOST entities, not all entities. Shouldn’t there be like a wildcard to use to include all entities?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [December 7, 2025, 7:44pm UTC](https://community.dynatrace.com/t/how-to-fetch-all-entities/43808/4 "2025-12-07T19:44:50Z")

</div>

[@Khalid\_Alkhouli](https://community.dynatrace.com/user/96377)&nbsp;, no the Dynatrace Classic API requires an entityType. You can loop through the available entities using [get entity types API](https://docs.dynatrace.com/docs/shortlink/api-entities-v2-get-all-entity-types)&nbsp;and fetch those entity per type. It’s not possible to return multiple entity types in one query.
