429 - Too many requests leads to the inability to login to desktop apps

Hi,

In testing the API I ran into a 429 error while making a call to GetCashBalanceSnapshot once a second. Could I get some clarification whether once request per second to this call should trigger the error (I don’t think it should)?

As an unfortunate side effect it looks like the rate limits are applied on the user level instead of the app level, which made it impossible to log into the desktop apps or this forum during the time of being blocked. The mobile app worked however.

Thanks,
Matthias

That is actually too many times for the REST API, which isn’t intended for real-time use. But, what you can do is use a websocket to get real-time data. Go to the WebSockets section of our JS Tutorial for more details.

Basically, you can open a long-running connection to our websocket server using a websocket client locally. Using its syncRequest feature, you can get realtime data including things like balance snapshots whenever you need them. Once you have read a bit, look at the Calculating P&L section for a realistic example of when and how to use syncrequests.