Resolve 429 status error

I have created a CRON job to fetch data from NowCerts and create records in HubSpot. The CRON job is working correctly, but I am frequently receiving 429 errors. I have verified that my monthly API rate limit has not been exceeded.

We have set 80 requests per 10 seconds and approximate 7 requests per second. Still we are receiving 429 status error.
On 4th january, I have received 18 errors of 429 status.

Help me to resolve this issue.

Hi @VChadha and welcome, it’s a pleasure to have you here :hugs:
Thanks for sharing these details with the HubSpot Community!
Let’s consult our Top Experts: Hey @Mike_Eastwood, @sylvain_tirreau and @himanshurauthan have you experienced this type of error before? Do you have suggestions to help @VChadha, please?
Sharing here some resources that you might want to check in the meanwhile:
- API usage guidelines and limits
- Error handling
- Using Object APIs
Thanks so much in advance for your valuable insights!
Bérangère

Hi @VChadha
For NodeJS applications, you can utilize the bottleneck package to effectively handle 429 errors. You can find more information about the bottleneck package at bottleneck - npm.

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.

Thanks!

Hi @VChadha, To build on what @GRajput has already shared (thank you), here are some helpful tips for resolving those 429 errors:

For private apps, Free/Starter accounts allow up to 100 requests per 10 seconds, while Professional/Enterprise accounts allow 190.
Although 80 requests per 10 seconds is within the limit, it’s possible that concurrent requests are causing occasional spikes.
Here are a few Recommendations:
- Try implementing exponential backoff and retry logic for rate limits or temporary errors.
- Use batch APIs where possible to help reduce the total number of calls.
- Cache data when you find yourself making the same requests repeatedly.
- Instead of polling, consider using webhooks to receive data proactively.
Don’t forget to monitor the X-HubSpot-RateLimit-Remaining and X-HubSpot-RateLimit-Interval-Milliseconds headers in your API responses, they’re great for keeping an eye on your usage.
I hope this helps! Let us know if you have any more questions or need further assistance.
Have a lovely day!
Bérangère

Agree with the top posters - bottleneckjs is the best way to do this on a typescript/node stack.
FYI, if you’re using the HubSpot node client - I’ve found that the Search API Rate limit isn’t being respected by the default client. So if you’re using the Search API (Which is a lot lower, 5 RPS i believe) then you will need to rate limit those requests yourself.