RateLimitApiException Property Value Clarification

We’ve been moving management of our clients and users into our own administrative application. This involves calling the management API more often. We’ve run into rate limit exceptions as one would expect when doing a bunch of automated operations in succession. We’re catching the RateLimitApiException exception in our .NET core web service. In the latest SDK we see two properties RetryAfter and Reset on the RateLimit property of the exception object. The former is a long and the latter a nullable DateTimeOffset. In our logs we see that RetryAfter is 1 and the Reset is null.

I’d like to change our code so that it will delay for an appropriate period of time before it continues making requests. It currently just waits 5 seconds. What does the value for RetryAfter represent? Is it seconds, milliseconds, etc? Adding a unit to the SDK documentation would be helpful. I would think that “awaiting” a Task.Delay((int)e.RateLimit.RetryAfter * 1000) would work if the value of 1 indicated to wait one second.

Also, why is the Reset value always null? I have not found an instance in our logs where it is not the case.

Hi @monstarmike

Welcome to the Auth0 Community!

Thank you for asking your question. I’ll contact our SDK team to gather information about these two properties and come back as soon as I have more information.

Thank you, and I appreciate your patience!
Dawid

1 Like

I found out why I was possibly seeing null in the RateLimit.Reset value: Rate Limit header values should be case insensitive · Issue #843 · auth0/auth0.net · GitHub I forked the repo, made the fix, and submitted a PR.

The rate-limit value may be seconds. A Google search returned an AI result that said it was seconds but I couldn’t find that specifically mentioned in any documentation. I just wanted to be sure.