Query Bitcoin UTxOs
Get UTxO details on Bitcoin
In this guide, you will learn to query Bitcoin and extract UTxO information by leveraging the UTxOs by Address endpoint.
Before submitting an API request, ensure you have completed the following:
- Project Name: <Your Project Name>
- Blockchain: Bitcoin
- Network: Testnet
The API allows applications to retrieve a list of all UTxOs that are located at a specific address or controlled by a particular script (script pubkey).
In this example, we will use the Bitcoin Testnet as the selected network for our project.
- Ensure your project is configured to use Bitcoin Testnet.
- Use the following endpoint to get a list of all UTxOs that reside at the specified Bitcoin address or script pubkey:
/addresses/:address/utxos
- Include the required path parameters in your request:
Parameter | Data Type | Description | Required |
---|---|---|---|
address | String | The Bitcoin address or hex-encoded script pubkey. | yes |
- Include optional query parameters as needed:
Parameter | Data Type | Description | Required |
---|---|---|---|
filter_dust | Boolean | Ignore UTxOs containing less than 100,000 sats. | no |
filter_dust_threshold | Integer | Ignore UTxOs containing less than the specified number of satoshis. | no |
count | any | Maximum number of results per page. | no |
order | any | The order in which the results are sorted (by height at which UTxO was produced). | no |
from | int64 | Return only UTxOs created on or after a specific height. | no |
to | int64 | Return only UTxOs created on or before a specific height. | no |
cursor | String | Pagination cursor string; use the cursor included in a page of results to fetch the next page. | no |
- Use cURL or your preferred tool to send the API request:
For this example, we will use:
- address: bc1qh62wlr6cv349jg2ltpfe6dgrjt585gzhlmecdu
- filter_dust: true
- order: desc
qfkWFyfdd8WZIxrXZTCgzRqZyphMA0hk
The API will return a response like the following:
Term | Definition |
---|---|
txid | The transaction ID where the UTXO was created. |
vout | The index of the output in the transaction (txid). |
address | The Bitcoin address that received the UTXO. |
script_pubkey | The script public key associated with the UTXO, usually in hex format. |
satoshis | The amount of satoshis (smallest unit of Bitcoin) in the UTXO. |
confirmations | The number of confirmations that the UTXO has received on the blockchain. |
height | The block height at which the UTXO was created. |
runes | Additional data related to runes, if any (empty in this response). |
inscriptions | Additional data related to inscriptions, if any (empty in this response). |
last_updated | Information about the last block update related to this request. |
block_hash | The hash of the last block where the UTXOs were updated or retrieved. |
block_height | The height of the last block where the UTXOs were updated or retrieved. |
next_cursor | A cursor for pagination to fetch the next page of results, if applicable (null if no further pages). |
Next Steps
Congrats! Now that you've made your API request, let's Submit Your First Transaction.