rest/getutxos - Bitcoin

This endpoint asks whether specific outpoints are unspent, and returns the ones that are. Outpoints are given as txid-n pairs and may be chained in a single path. Inserting checkmempool considers unconfirmed spends as well.

Parameters

ParameterTypeLocationRequiredDescription
checkmempoolstringpathNoLiteral segment. When present, outputs already spent in the mempool are treated as spent
outpointsstringpathYesOne or more txid-n pairs separated by /
formatstringpathYesResponse format appended to the last outpoint: json, hex, or bin

Request

bashcurl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/getutxos/checkmempool/98bde4a7f407769028cbe725695d388324ab6b83fab4f310005082dd9b8b2de9-0.json'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/getutxos/checkmempool/98bde4a7f407769028cbe725695d388324ab6b83fab4f310005082dd9b8b2de9-0.json'
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/getutxos/checkmempool/98bde4a7f407769028cbe725695d388324ab6b83fab4f310005082dd9b8b2de9-0.json')

print(response.json())

Response

json{
    "chainHeight": 967816,
    "chaintipHash": "000000000000000000019c481c042c0625abe1dc04fe26795e2e24b152791e5f",
    "bitmap": "1",
    "utxos": [
        {
            "height": 967816,
            "value": 0.0011348,
            "scriptPubKey": {
                "asm": "1 4507d40a378867a30aa9c77c02bf59852771d2e65ebef9e176c9951ef451d92b",
                "desc": "rawtr(4507d40a378867a30aa9c77c02bf59852771d2e65ebef9e176c9951ef451d92b)#ecmzx8gj",
                "hex": "51204507d40a378867a30aa9c77c02bf59852771d2e65ebef9e176c9951ef451d92b",
                "address": "bc1pg5ragz3h3pn6xz4fca7q906es5nhr5hxt6l0nctkex23aaz3my4sl5g9ax",
                "type": "witness_v1_taproot"
            }
        }
    ]
}

Response Parameters

FieldTypeDescription
chainHeightnumericHeight at which the query was answered
chaintipHashstringHash of the chain tip at that height
bitmapstringOne character per requested outpoint: 1 if unspent, 0 if spent. Order matches the request
utxosarrayOne entry per unspent outpoint, in request order
utxos[].heightnumericHeight of the block that created the output
utxos[].valuenumericOutput value in BTC
utxos[].scriptPubKeyobjectThe locking script, with asm, desc, hex, type, and address

bitmap is the part to read. Spent outpoints are omitted from utxos entirely, so the array does not line up with the request by index. Walk bitmap character by character: a 1 means the next entry in utxos belongs to that outpoint, a 0 means it was spent and has no entry.

This endpoint answers only about outpoints you already know. It cannot list the outputs belonging to an address; for that use Blockbook api/v2/utxo.

Without the checkmempool segment, an output spent by an unconfirmed transaction is still reported as unspent.

Use Cases

  • Spend Checks: Confirm an output is still unspent before building a transaction
  • Double-Spend Detection: Use checkmempool to catch outputs already spent by a pending transaction
  • Batch Validation: Check several outpoints in one request

Error Handling

HTTP StatusMessageDescription
400Bad requestThe path is malformed, or a hash or height is invalid
403ForbiddenMissing or invalid ACCESS-TOKEN
404Not foundNo object matches the requested hash, height, or outpoint
500Internal errorThe node failed to process the request