Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1Unauthenticated REST Interface2==============================4The REST API can be enabled with the `-rest` option.6The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet, port 18332 for testnet,7port 48332 for testnet4, port 38332 for signet, and port 18443 for regtest.9REST Interface consistency guarantees10-------------------------------------12The [same guarantees as for the RPC Interface](/doc/JSON-RPC-interface.md#rpc-consistency-guarantees)13apply.15Default HTTP caching16--------------------18REST responses include `Cache-Control` headers by default:20* `public, immutable, max-age=86400` for `/block` and `/block/notxdetails`21binary and hex responses, `/blockpart`, `/blockfilter` and `/spenttxouts` in22all formats, and `/deploymentinfo/<BLOCKHASH>.json`. The TTL is deliberately23short so caches do not hold older response shapes across software upgrades.24* `no-store` for `/block` and `/block/notxdetails` JSON, `/tx`, `/headers`,25`/blockfilterheaders`, `/blockhashbyheight`, `/chaininfo`, `/mempool`,26`/getutxos`, `/deploymentinfo.json`, and all error responses. These responses27can change with active chain or node state and do not currently provide cache28validators such as `ETag` or `Last-Modified`.30If you front `bitcoind` with a reverse proxy or CDN such as Caddy or nginx with31the headers-more module, you can override these defaults there. Keep overrides32scoped to responses you know are safe to cache more aggressively.34Supported API35-------------37#### Transactions38`GET /rest/tx/<TX-HASH>.<bin|hex|json>`40Given a transaction hash: returns a transaction in binary, hex-encoded binary, or JSON formats.41Responds with 404 if the transaction doesn't exist.43By default, this endpoint will only search the mempool.44To query for a confirmed transaction, enable the transaction index via "txindex=1" command line / configuration option.46#### Blocks47- `GET /rest/block/<BLOCK-HASH>.<bin|hex|json>`48- `GET /rest/block/notxdetails/<BLOCK-HASH>.<bin|hex|json>`50Given a block hash: returns a block, in binary, hex-encoded binary or JSON formats.51Responds with 404 if the block doesn't exist.53The HTTP request and response are both handled entirely in-memory.55With the /notxdetails/ option JSON response will only contain the transaction hash instead of the complete transaction details. The option only affects the JSON response.57- `GET /rest/blockpart/<BLOCK-HASH>.<bin|hex>?offset=<OFFSET>&size=<SIZE>`59Given a block hash: returns a block part, in binary or hex-encoded binary formats.60Responds with 404 if the block or the byte range doesn't exist.62#### Blockheaders63`GET /rest/headers/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>`65Given a block hash: returns <COUNT> amount of blockheaders in upward direction.66Returns empty if the block doesn't exist or it isn't in the active chain.68*Deprecated (but not removed) since 24.0:*69`GET /rest/headers/<COUNT>/<BLOCK-HASH>.<bin|hex|json>`71#### Blockfilter Headers72`GET /rest/blockfilterheaders/<FILTERTYPE>/<BLOCK-HASH>.<bin|hex|json>?count=<COUNT=5>`74Given a block hash: returns <COUNT> amount of blockfilter headers in upward75direction for the filter type <FILTERTYPE>.76Returns empty if the block doesn't exist or it isn't in the active chain.78*Deprecated (but not removed) since 24.0:*79`GET /rest/blockfilterheaders/<FILTERTYPE>/<COUNT>/<BLOCK-HASH>.<bin|hex|json>`81#### Blockfilters82`GET /rest/blockfilter/<FILTERTYPE>/<BLOCK-HASH>.<bin|hex|json>`84Given a block hash: returns the block filter of the given block of type85<FILTERTYPE>.86Responds with 404 if the block doesn't exist.88#### Blockhash by height89`GET /rest/blockhashbyheight/<HEIGHT>.<bin|hex|json>`91Given a height: returns hash of block in best-block-chain at height provided.92Responds with 404 if block not found.94#### Spent transaction outputs95`GET /rest/spenttxouts/<BLOCK-HASH>.<bin|hex|json>`97Given a block hash: returns a collection of spent transaction output lists,98one per transaction in the block.99Responds with 404 if the block doesn't exist or its undo data is not available.101#### Chaininfos102`GET /rest/chaininfo.json`104Returns various state info regarding block chain processing.105Only supports JSON as output format.106Refer to the `getblockchaininfo` RPC help for details.108#### Deployment info109`GET /rest/deploymentinfo.json`110`GET /rest/deploymentinfo/<BLOCKHASH>.json`112Returns an object containing various state info regarding deployments of113consensus changes at the current chain tip, or at <BLOCKHASH> if provided.114Only supports JSON as output format.115Refer to the `getdeploymentinfo` RPC help for details.117#### Query UTXO set118- `GET /rest/getutxos/<TXID>-<N>/<TXID>-<N>/.../<TXID>-<N>.<bin|hex|json>`119- `GET /rest/getutxos/checkmempool/<TXID>-<N>/<TXID>-<N>/.../<TXID>-<N>.<bin|hex|json>`121The getutxos endpoint allows querying the UTXO set, given a set of outpoints.122With the `/checkmempool/` option, the mempool is also taken into account.123See [BIP64](https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki) for124input and output serialization (relevant for `bin` and `hex` output formats).126Example:127```128$ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp129{130"chainHeight" : 325347,131"chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb",132"bitmap": "1",133"utxos" : [134{135"height" : 2147483647,136"value" : 8.8687,137"scriptPubKey" : {138"asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG",139"desc" : "addr(mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD)#gj9tznmy",140"hex" : "76a9141c7cebb529b86a04c683dfa87be49de35bcf589e88ac",141"type" : "pubkeyhash",142"address" : "mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD"143}144}145]146}147```149#### Memory pool150`GET /rest/mempool/info.json`152Returns various information about the transaction mempool.153Only supports JSON as output format.154Refer to the `getmempoolinfo` RPC help for details.156`GET /rest/mempool/contents.json?verbose=<true|false>&mempool_sequence=<false|true>`158Returns the transactions in the mempool.159Only supports JSON as output format.160Refer to the `getrawmempool` RPC help for details. Defaults to setting161`verbose=true` and `mempool_sequence=false`.163*Query parameters for `verbose` and `mempool_sequence` available in 25.0 and up.*166Risks167-------------168Running a web browser on the same node with a REST enabled bitcoind can be a risk. Accessing prepared XSS websites could read out tx/block data of your node by placing links like `<script src="http://127.0.0.1:8332/rest/tx/1234567890.json">` which might break the nodes privacy.
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.