What can I do if lightspeed is throttling my api requests?

meatcomputermeatcomputer Posts: 23Member


The program I recently wrote, which uses the lightspeed api, has been working well for weeks. In the last week an employee came to me telling me that lots of errors were coming back from my program. Upon further investigation I found that I was getting an HTTP 429 Error indicating that my program was sending lightspeed too many requests(more than 1 per second) and that I should reduce the amount of requests to avoid being throttled.

Before every request I added a time.sleep(5)

So, a 5 second delay before every single request in my program. What used to take 1 minute now takes at least 5 minutes because of the delays.

Even with these delays I still get the same HTTP 429 error, I even slowed the request rate down to 1 request every 20 seconds but still I get the same error.

I am convinced that my api traffic is being throttled, what can I do about this?


  • gregaricangregarican Posts: 227Member 

    You need to read this, in the event you haven't had time to look at it --> https://community.lightspeedhq.com/en/discussion/28/best-practices. Usually pushing data into LS Retail is more expensive than pulling data from LS Retail, in terms of API call limits. If you inspect the response headers that LS Retail is sending back to your API caller you can see if you are getting close to hitting the limit. And dynamically throttle your calls accordingly.

  • meatcomputermeatcomputer Posts: 23Member

    Thank you so much, now everythings back to normal.

  • gregaricangregarican Posts: 227Member 

    Good! I know the API throttling is variable, depending on the time of day the calls take place. And I think that pushes are weighted 10 times that of API pulls. So if you can make an API GET request at a rate of 1 call per second, then you can only make an API PUT request at a rate of 1 call every 10 seconds. But as far as I've seen 1 call/10 seconds for PUT requests is the stingiest throttling I can recall...

Sign In or Register to comment.