For mainnet a valid apikey is needed and needs to be send as a query parameter. You can create a temporary mainnet api key for testing the api. The correct url for mainnet is:
Where $SECRET needs to be replaced with your own apikey.
Response
The response from the api contains two fields, status and balance. When status is 200 the request was successful and it will container the value in the balance field. E.g.:
{ "status":200,"balance":19989726659 }
The status field can contain different responses like 400, 401, 404, 422 or 500 depending on the request.
Balance Calculation
The balance is in satoshi's and if you want to change it to BTC, it needs to be divided by 100000000. E.g.:
# Python Examplebalance=7821967447balance_btc=balance/100000000print(f'Balance in Bitcoin: %s'% (balance_btc))