Skip to main content
Question

C# How to determine if Rate Limit was exceeded immediately after xxxx.Sms().Post(msg) call

  • April 2, 2026
  • 1 reply
  • 5 views

Hi, My code is in C#. It is a texting app.  I am assuming that after sending a single SMS message,  I should be able to determine if that single call exceeded the rate limit.  My call to send a SMS message is as follows:

 var resp = await restClient.Restapi().Account().Extension().Sms().Post(requestBody);

Once control returns from the await, how do I obtain the info on whether the rate limit was exceeded?  Is an exception thrown?  Is there a return structure?  Do I have to make another call to read the RateLmit results of above Sms.Post() ?

A C# example to get the Rate Limit info of the above call would be very helpful.

Thank you,

Jim

 

1 reply

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • April 2, 2026

Add this to your code and try it out

var eventsExtension = new EventsExtension();

await restClient.InstallExtension(eventsExtension);

void EventHandler(object sender, HttpMessages httpMessages)
{
httpMessages.Headers.First(i => i.Key == "X-Rate-Limit-Remaining").Value.First();
Console.WriteLine("Remaining: " + rateLimitRemaining);
}

eventsExtension.RequestSuccess += EventHandler;

Or use the rate limit extension directly

https://github.com/ringcentral/RingCentral.Net/tree/master/RingCentral.Net.RateLimit

For more rate limit headers, check out this article.