Getting staking balance for Avalanche address

I need to get AVAX staked balance for specific address. After reading documentation I found platform.getBalance API endpoint which looks promising, but I don’t get the desired output.

What I want is actually staked balance showed here - but I need to enter extended public key and C-chain address to get it. Is there any way to get that via API calls?

PS. Is there a way to avoid 429 error which I started to get after a few experimental calls to your API?

Rate limits on the public API are needed on a free public service in order for us to be able to keep providing it to everyone.

So you cannot avoid 429 error if you cross the limit, but you can handle it gracefully: whenever you get a 429 error, you will also get a Retry-After header in the response. If you respect that, and don’t do another request until after the time indicated, you’ll be ok. If you do not, you (your IP, that is) get locked out from the service for an hour.

There is actually a way to never get a 429: run a node yourself. It’s not that hard, nor resource-intensive. You can get a node up in minutes and synced within a day, and then you can run as many requests as you need, as fast as it can handle.

1 Like

Thank you for your reply!

Do you have any idea why am I getting 0 balance from platform.getBalance API call, but I see value of staked coins in the second link that I posted (where I put C-chain address and xpub key)?