# API Throwing error after certain number of pages

**URL:** <https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618>\
**Category:** Get Help\
**Tags:** logs, management-api\
**Created:** [March 10, 2025, 10:00am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618 "2025-03-10T10:00:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jinish.trivedi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jinish.trivedi/32/72479_2.png) [@jinish.trivedi](https://community.auth0.com/u/jinish.trivedi)\
**Post date:** [March 10, 2025, 10:00am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/1 "2025-03-10T10:00:34Z")

</div>

**endpoint** : api/v2/logs  
**url** : https:///api/v2/logs?per\_page=11&q=date:[2024-06-07T12:47:09Z TO 2025-03-03T12:47:09Z]&page=100

**response code** : 400 bad request  
**response body** :

```auto
{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Logs Service server responded with an internal error (potentially load-shedding)"
}

```

---

<div class="post-metadata">

**Author:** ![jinish.trivedi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jinish.trivedi/32/72479_2.png) [@jinish.trivedi](https://community.auth0.com/u/jinish.trivedi)\
**Post date:** [March 10, 2025, 10:01am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/2 "2025-03-10T10:01:46Z")

</div>

additionaly if I reduce the page size (say 10) it throws error on 101th page. how can we mitigate this issue?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 10, 2025, 3:47pm UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/4 "2025-03-10T15:47:08Z")

</div>

Hi @jinish.trivedi

Welcome to the Auth0 Community!

The `potential load shedding` error can be thrown by making too many requests to the Log Server, thus blocking the query or that the query took a long time and caused the service to restart. In the latter case, you can try running the query again after 5-10 minutes and it should be working, if it does not, try making fewer requests.

If you have any other questions, feel free to leave a reply!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![jinish.trivedi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jinish.trivedi/32/72479_2.png) [@jinish.trivedi](https://community.auth0.com/u/jinish.trivedi)\
**Post date:** [March 11, 2025, 9:25am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/5 "2025-03-11T09:25:37Z")

</div>

> [@nik.baleca](#):
>
> The `potential load shedding` error can be thrown by making too many requests to the Log Server, thus blocking the query or that the query took a long time and caused the service to restart. In the latter case, you can try running the query again after 5-10 minutes and it should be working, if it does not, try making fewer requests.

Hello @nik.baleca  
Even without making too many requests, it is still throwing the same error. For example, if I wait for an hour and then hit the API for page 11 and above, it still throws the same error. However, hitting the API for any page from 0 to 10 returns a successful response.

The error specifically occurs on the 11th page and above with a page size of 100 (page 101 and above if page size is 10 instead of 100). There are no issues for pages 0 to 10 (page 0-100 in case of page size of 10), but since the error occurs on page 11 and above, we are missing out on the remaining data.

note that we’re strictly following the rate limit for the api.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 11, 2025, 4:07pm UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/6 "2025-03-11T16:07:38Z")

</div>

Got it!

Could you send me in a DM the tenant name that you are having this issue with?

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![jinish.trivedi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jinish.trivedi/32/72479_2.png) [@jinish.trivedi](https://community.auth0.com/u/jinish.trivedi)\
**Post date:** [March 12, 2025, 6:18am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/7 "2025-03-12T06:18:58Z")

</div>

I have been facing this error for every tenant. I have sent one of the tenant in DM for it.  
This error seems to have a pattern that api throws error whenever page\_size multiplied by page\_number exceeds ~10,000.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 12, 2025, 4:19pm UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/8 "2025-03-12T16:19:34Z")

</div>

Hi again @jinish.trivedi

I could not find any issues when I have inspected your tenant. However, I was able to reproduce the error on my end regarding the log query.

The issue relies in the fact that you are exceeding the 1000 record limit for the query (per\_page multiplied by page). In your case, it would be 11 multiplied by 100 which exceeds the specified limit, that is why your query attempt receives the `potential load shedding` error. In this case, you would need to refine your search to make sure you to not pass this limit when retrieving logs.

You can read more about this in our [documentation](https://auth0.com/docs/deploy-monitor/logs/retrieve-log-events-using-mgmt-api).

If you have any other questions, feel free to leave a reply.

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![jinish.trivedi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jinish.trivedi/32/72479_2.png) [@jinish.trivedi](https://community.auth0.com/u/jinish.trivedi)\
**Post date:** [March 13, 2025, 5:26am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/9 "2025-03-13T05:26:46Z")

</div>

Thank you @nik.baleca ,  
Your response was very helpful

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 27, 2025, 5:27am UTC](https://community.auth0.com/t/api-throwing-error-after-certain-number-of-pages/183618/10 "2025-03-27T05:27:39Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
