<p>You could do that by fetching an API from a Block Explorer</p>
<ul>
<li><a href="https://mempool.space/docs/api/rest#get-address-utxo" rel="nofollow noreferrer">Mempool.space</a></li>
<li><a href="https://github.com/Blockstream/esplora/blob/master/API.md#get-addressaddresstxs" rel="nofollow noreferrer">BlockStream.info</a></li>
<li><a href="https://blockchair.com/api/docs#link_203" rel="nofollow noreferrer">Blockchair.com</a></li>
</ul>
<p>Or by adding a wallet on your Bitcoin node and fetching <a href="https://developer.bitcoin.org/reference/rpc/listunspent.html" rel="nofollow noreferrer">listunspent</a></p>
<blockquote>
<p>without getting api error</p>
</blockquote>
<p>Which API are you using?</p>

CC BY-SA 4.0
2022-04-03T05:58:35.160Z
Do you have any code that fetch balance from these API's
I am using blockchain API
Guest34122123
CC BY-SA 4.0
2022-04-02T16:08:20.307Z
2022-04-02T16:08:20.307Z
jaonoctus
<p>you can request this API (it's free to use): <a href="https://rapidapi.com/juliakafarska/api/bitcoin-api" rel="nofollow noreferrer">https://rapidapi.com/juliakafarska/api/bitcoin-api</a></p>
<pre><code>import requests

url = &quot;https://bitcoin-api.p.rapidapi.com/balancesByAddress&quot;

payload = {&quot;addresses&quot;: [&quot;16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe&quot;, &quot;34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo&quot;]}
headers = {
    &quot;content-type&quot;: &quot;application/json&quot;,
    &quot;X-RapidAPI-Key&quot;: &quot;YOUR_KEY_HERE&quot;,
    &quot;X-RapidAPI-Host&quot;: &quot;bitcoin-api.p.rapidapi.com&quot;
}

response = requests.request(&quot;POST&quot;, url, json=payload, headers=headers)

print(response.text)
</code></pre>
<p>response:</p>
<pre><code>{
  &quot;note&quot;: &quot;Balances for 2 wallet addresses&quot;,
  &quot;count&quot;: 2,
  &quot;data&quot;: [
    {
      &quot;id&quot;: 14122055,
      &quot;address&quot;: &quot;16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe&quot;,
      &quot;btc&quot;: 0.00525093
    },
    {
      &quot;id&quot;: 25721113,
      &quot;address&quot;: &quot;34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo&quot;,
      &quot;btc&quot;: 0.00111145
    }
  ]
}
</code></pre>

CC BY-SA 4.0
2022-09-30T10:56:01.690Z
2022-09-30T11:01:55.677Z
2022-09-30T11:01:55.677Z
Julia
<p><a href="https://i.sstatic.net/DkcFA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DkcFA.png" alt="enter image description here" /></a></p>
<p>i have script that checks one by one read line by line and tell us, with balance address and also range from 2010 to 2023, you can select range, also you can take output to a file....</p>

CC BY-SA 4.0
2023-10-31T08:54:05.337Z
2023-10-31T08:54:05.337Z
workonly for
<p>Alternative using <a href="https://github.com/Blockstream/esplora/blob/master/API.md" rel="nofollow noreferrer">https://github.com/Blockstream/esplora/blob/master/API.md</a></p>
<pre><code>import requests

address_list = [&quot;bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf&quot;, &quot;1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY&quot;, &quot;19SXCX6jvQxzfYfzRRMxjLBkqrNt6BUSJ2&quot;]
for addr in address_list:
    print(requests.get(f&quot;https://blockstream.info/api/address/{addr}&quot;).text)
</code></pre>
<p><strong>output</strong></p>
<pre><code>{&quot;address&quot;:&quot;bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf&quot;,&quot;chain_stats&quot;:{&quot;funded_txo_count&quot;:874627,&quot;funded_txo_sum&quot;:1002983034753356,&quot;spent_txo_count&quot;:874417,&quot;spent_txo_sum&quot;:1002858836755824,&quot;tx_count&quot;:844034},&quot;mempool_stats&quot;:{&quot;funded_txo_count&quot;:3,&quot;funded_txo_sum&quot;:2604371991,&quot;spent_txo_count&quot;:3,&quot;spent_txo_sum&quot;:2650678155,&quot;tx_count&quot;:3}}
{&quot;address&quot;:&quot;1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY&quot;,&quot;chain_stats&quot;:{&quot;funded_txo_count&quot;:82575,&quot;funded_txo_sum&quot;:535871315837629,&quot;spent_txo_count&quot;:82540,&quot;spent_txo_sum&quot;:535843538512098,&quot;tx_count&quot;:82340},&quot;mempool_stats&quot;:{&quot;funded_txo_count&quot;:0,&quot;funded_txo_sum&quot;:0,&quot;spent_txo_count&quot;:0,&quot;spent_txo_sum&quot;:0,&quot;tx_count&quot;:0}}
{&quot;address&quot;:&quot;19SXCX6jvQxzfYfzRRMxjLBkqrNt6BUSJ2&quot;,&quot;chain_stats&quot;:{&quot;funded_txo_count&quot;:1,&quot;funded_txo_sum&quot;:43915252,&quot;spent_txo_count&quot;:0,&quot;spent_txo_sum&quot;:0,&quot;tx_count&quot;:1},&quot;mempool_stats&quot;:{&quot;funded_txo_count&quot;:0,&quot;funded_txo_sum&quot;:0,&quot;spent_txo_count&quot;:0,&quot;spent_txo_sum&quot;:0,&quot;tx_count&quot;:0}}
</code></pre>

CC BY-SA 4.0
2022-09-30T14:01:19.450Z
2022-09-30T14:01:19.450Z
jesseaam
<p>I want to check multiple bitcoin addresses balance in python, can someone suggest a script that can do it fast and without getting api error.</p>

<blockchain><python>
What is the fastest way to check balance of multiple BTC address in python
Guest34122123
# What is the fastest way to check balance of multiple BTC address in python

(Asked by: username_0 on 2022-03-31)

I want to check multiple bitcoin addresses balance in python, can someone suggest a script that can do it fast and without getting api error.

**Tags:** blockchain, python


---

## 4 answers

### Answer by username_1 on 2022-04-02. Score: 2

You could do that by fetching an API from a Block Explorer

* [Mempool.space](https://mempool.space/docs/api/rest#get-address-utxo)
* [BlockStream.info](https://github.com/Blockstream/esplora/blob/master/API.md#get-addressaddresstxs)
* [Blockchair.com](https://blockchair.com/api/docs#link_203)

Or by adding a wallet on your Bitcoin node and fetching [listunspent](https://developer.bitcoin.org/reference/rpc/listunspent.html)

> without getting api error

Which API are you using?

> **Comments:**
> **username_0**: Do you have any code that fetch balance from these API's I am using blockchain API  

---

### Answer by username_2 on 2022-09-30. Score: 1

you can request this API (it's free to use): https://rapidapi.com/juliakafarska/api/bitcoin-api
import requests

url = "https://bitcoin-api.p.rapidapi.com/balancesByAddress"

payload = {"addresses": ["16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe", "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"]}
headers = {
    "content-type": "application/json",
    "X-RapidAPI-Key": "YOUR_KEY_HERE",
    "X-RapidAPI-Host": "bitcoin-api.p.rapidapi.com"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

response:
{
  "note": "Balances for 2 wallet addresses",
  "count": 2,
  "data": [
    {
      "id": 14122055,
      "address": "16ftSEQ4ctQFDtVZiUBusQUjRrGhM3JYwe",
      "btc": 0.00525093
    },
    {
      "id": 25721113,
      "address": "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo",
      "btc": 0.00111145
    }
  ]
}


---

### Answer by username_3 on 2023-10-31. Score: 0

[![enter image description here](https://i.sstatic.net/DkcFA.png)](https://i.sstatic.net/DkcFA.png)

i have script that checks one by one read line by line and tell us, with balance address and also range from 2010 to 2023, you can select range, also you can take output to a file....


---

### Answer by username_4 on 2022-09-30. Score: 0

Alternative using https://github.com/Blockstream/esplora/blob/master/API.md
import requests

address_list = ["bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf", "1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY", "19SXCX6jvQxzfYfzRRMxjLBkqrNt6BUSJ2"]
for addr in address_list:
    print(requests.get(f"https://blockstream.info/api/address/{addr}").text)

output
{"address":"bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf","chain_stats":{"funded_txo_count":874627,"funded_txo_sum":1002983034753356,"spent_txo_count":874417,"spent_txo_sum":1002858836755824,"tx_count":844034},"mempool_stats":{"funded_txo_count":3,"funded_txo_sum":2604371991,"spent_txo_count":3,"spent_txo_sum":2650678155,"tx_count":3}}
{"address":"1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY","chain_stats":{"funded_txo_count":82575,"funded_txo_sum":535871315837629,"spent_txo_count":82540,"spent_txo_sum":535843538512098,"tx_count":82340},"mempool_stats":{"funded_txo_count":0,"funded_txo_sum":0,"spent_txo_count":0,"spent_txo_sum":0,"tx_count":0}}
{"address":"19SXCX6jvQxzfYfzRRMxjLBkqrNt6BUSJ2","chain_stats":{"funded_txo_count":1,"funded_txo_sum":43915252,"spent_txo_count":0,"spent_txo_sum":0,"tx_count":1},"mempool_stats":{"funded_txo_count":0,"funded_txo_sum":0,"spent_txo_count":0,"spent_txo_sum":0,"tx_count":0}}


---

