# How can I fetch all Kubernetes events for the past month using the Dynatrace API

**URL:** <https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api, tokens\
**Created:** [June 16, 2026, 4:24am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185 "2026-06-16T04:24:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arunkumarbnp](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Arunkumarbnp](https://community.dynatrace.com/u/Arunkumarbnp)\
**Post date:** [June 16, 2026, 4:24am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/1 "2026-06-16T04:24:03Z")

</div>

I’m trying to retrieve Kubernetes events from the last month using the Dynatrace API, but I can only get 20 events at a time. How can I fetch all events for the past month? api details: {{baseUrl}}/it\_prod-dynatrace-environment-apac/v2/events?entitySelector=entityId(KUBERNETES\_CLUSTER-0FB79669080C9DD5)&from=now-30d&to=now&pageSize=500

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [June 16, 2026, 5:35am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/2 "2026-06-16T05:35:16Z")

</div>

[@Arunkumarbnp](https://community.dynatrace.com/user/87029)&nbsp;How are you querying the API? Does the initial response include&nbsp;nextPageKey ?

---

<div class="post-metadata">

**Author:** ![Arunkumarbnp](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Arunkumarbnp](https://community.dynatrace.com/u/Arunkumarbnp)\
**Post date:** [June 16, 2026, 6:03am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/3 "2026-06-16T06:03:51Z")

</div>

Hi&nbsp;[@p\_devulapalli](https://community.dynatrace.com/user/21657)&nbsp;  
Thanks for your response  
I use this api in postman  
&nbsp;api details: {{baseUrl}}/it\_prod-dynatrace-environment-apac/v2/events?entitySelector=entityId(KUBERNETES\_CLUSTER-0FB79669080C9DD5)&from=now-30d&to=now&pageSize=500

I tried with nextpagekey, I got the below error

“path”: “entitySelector”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “message”: “must not be used in combination with nextPageKey query parameter.”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “parameterLocation”: “QUERY”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “location”: null

“path”: “to”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “message”: “must not be used in combination with nextPageKey query parameter.”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “parameterLocation”: “QUERY”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “location”: null

“path”: “pageSize”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “message”: “must not be used in combination with nextPageKey query parameter.”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “parameterLocation”: “QUERY”,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; “location”: null

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [June 16, 2026, 7:03am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/4 "2026-06-16T07:03:41Z")

</div>

[@Arunkumarbnp](https://community.dynatrace.com/user/87029)&nbsp;When using&nbsp;nextpagekey, you need to omit&nbsp;all other query parameters and just use&nbsp;nextpagekey in the request to get a response.

---

<div class="post-metadata">

**Author:** ![Arunkumarbnp](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Arunkumarbnp](https://community.dynatrace.com/u/Arunkumarbnp)\
**Post date:** [June 16, 2026, 7:11am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/5 "2026-06-16T07:11:31Z")

</div>

[@p\_devulapalli](https://community.dynatrace.com/user/21657)

Thanks for your reply,

If an entity is not explicitly specified in the API request, will nextPageKey still fetch all events for hosts and Kubernetes clusters within the management zone? Or does it only return events for entities that are directly referenced in the query?  
I need k8 events only

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [June 16, 2026, 11:08pm UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/6 "2026-06-16T23:08:04Z")

</div>

[@Arunkumarbnp](https://community.dynatrace.com/user/87029)&nbsp;Yes, the nextPageKey&nbsp;would fetch the response from next page with the filters set in first response. You would see only events of the specific cluster set in your first query

---

<div class="post-metadata">

**Author:** ![Arunkumarbnp](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Arunkumarbnp](https://community.dynatrace.com/u/Arunkumarbnp)\
**Post date:** [June 17, 2026, 4:32am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/7 "2026-06-17T04:32:15Z")

</div>

[@p\_devulapalli](https://community.dynatrace.com/user/21657)&nbsp;  
Can you please share me the right api, I’ll check and let you know if it works

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [June 17, 2026, 6:48am UTC](https://community.dynatrace.com/t/how-can-i-fetch-all-kubernetes-events-for-the-past-month-using-the-dynatrace-api/56185/8 "2026-06-17T06:48:53Z")

</div>

> **[Events API v2 - GET list events](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/events-v2/get-events)**
>
> List events of your monitoring environment via the Dynatrace API.
