Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Bitview Oracle API
description: 'Bitview is a free, open-source Bitcoin data server: on-chain metrics, blocks, mempool and mining data, with charts and an API, at bitview.space or beside your own Bitcoin Core node.
API for querying Bitcoin blockchain data, mempool state, and on-chain series.
### Features
- **Mempool.space compatible**: Blocks, transactions, addresses, mining, fees, and mempool endpoints match the mempool.space REST API
- **Series**: Thousands of on-chain time-series across multiple indexes (date, block height, etc.)
- **Multiple formats**: JSON and CSV output
- **For LLMs**: `/llms.txt` for discovery, `/api.json` a compact custom summary of this spec for reading (not OpenAPI); build tools from `/openapi.json`
- **MCP**: Stateless, read-only access to these operations at mcp.bitview.space, with no authentication required
### Quick start
```bash
curl -s https://bitview.space/api/blocks/tip/height
curl -s https://bitview.space/api/v1/fees/recommended
curl -s https://bitview.space/api/mempool
curl -s https://bitview.space/api/series/search?q=price
```
### Errors
Errors use `application/problem+json`:
```json
{
"error": {
"type": "not_found",
"code": "series_not_found",
"message": "''foo'' not found, did you mean ''bar''? What became of it: /changes/?id=foo",
"doc_url": "/api"
}
}
```
- **`type`**: Error category, following the status — `invalid_request` (4xx other than 404), `not_found` (404), `unavailable` (503), `timeout` (504), or `internal` (other 5xx); see the `ErrorType` schema
- **`code`**: Machine-readable error code (e.g. `invalid_address`, `series_not_found`, `weight_exceeded`); see the `ErrorCode` schema
### Client Libraries
- JavaScript
- Python
- Rust
- MCP
### Links
- GitHub
- Bitview Studio - Charts of any series, built on this API'
termsOfService: https://bitview.space/terms/
contact:
name: Bitview
url: https://bitview.space/support/
email: support@bitview.space
license:
name: MIT
url: https://github.com/bitcoinresearchkit/mono/blob/main/LICENSE
version: v0.13.0
x-privacy-policy: https://bitview.space/privacy/
tags:
- name: Oracle
description: 'On-chain BTC/USD price derived purely from round-dollar payment patterns in transaction outputs, with no external price feed. Payment activity is binned on a log scale, and a smoothed EMA over recent blocks locates the price.
The live price is at `/api/oracle/price`, confirmed per-height price history at `/api/series/price/height`. How it read each block (what it counted, where it looked, what it found) is at `/api/oracle/blocks/{height}`, and now at `/api/oracle/live`; the payments behind its prices, 144 blocks at a time, at `/api/oracle/payments/{start}`.'
paths:
/api/oracle/price:
get:
tags:
- Oracle
summary: Live BTC/USD price
description: 'Current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the oracle''s recent-block window, with the mempool''s outputs blended in when available, to the cent: `price` of `GET /api/oracle/live`. Confirmed per-height history is available at `GET /api/series/price/height`. Not found before the oracle''s first prices.'
operationId: get_live_price
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Dollars'
'304':
description: 'Not modified: the request''s validator matches the current representation'
'404':
description: Resource not found
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'400':
description: Invalid request parameters
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'500':
description: Internal server error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'503':
description: Service temporarily unavailable
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'504':
description: Request deadline exceeded
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
x-mcp-ignore: true
/api/oracle/live:
get:
tags:
- Oracle
summary: The oracle now
description: 'The oracle''s reading now, as `GET /api/oracle/blocks/{height}` reads a block: with the mempool''s outputs blended in as the next block (`mempool` true, `height` the next block''s, `outputs` the mempool''s), its search from the tip''s answer, `price` the live price; without a mempool at the tip, the tip block''s own. One snapshot: its parts never from two moments, `hash` the confirmed tip it was read at. Not found before the oracle''s first prices, nor before height 508,000.'
operationId: get_oracle_live
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/OracleBlock'
'304':
description: 'Not modified: the request''s validator matches the current representation'
'404':
description: Resource not found
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'400':
description: Invalid request parameters
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'500':
description: Internal server error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'503':
description: Service temporarily unavailable
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'504':
description: Request deadline exceeded
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
x-mcp-ignore: true
/api/oracle/blocks/{height}:
get:
tags:
- Oracle
summary: The oracle at a block
description: 'How the oracle read a confirmed block, after height 508,000: what it counted (the smoothed histogram of the payments of the block and the 11 before it, by amount on its log scale; the block''s outputs as its filter judged them, each skipped one under the first rule that skips it), where it looked (every candidate bin in its window, 12 below the block before''s answer to 11 above, with its score) and what it found (the bin it picked and its price). Bins: 200 a decade, a bin `round(log10(sats) * 200)`; as where $100 lands, a bin is the price `10^(10 - bin / 200)` dollars. A settled block''s never changes.'
operationId: get_oracle_block
parameters:
- in: path
name: height
required: true
schema:
$ref: '#/components/schemas/Height'
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/OracleBlock'
'304':
description: 'Not modified: the request''s validator matches the current representation'
'404':
description: Resource not found
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'400':
description: Invalid request parameters
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'500':
description: Internal server error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'503':
description: Service temporarily unavailable
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'504':
description: Request deadline exceeded
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
x-mcp-ignore: true
/api/oracle/payments/{start}:
get:
tags:
- Oracle
summary: The oracle's payments, 144 blocks at a time
description: 'For each of the 144 blocks from `start` (a multiple of 144, else a bad request; from 508,032, earlier ones out of range): its payments as the oracle filters them, each read as each of its 19 round-dollar amounts ($1 to $10,000) at its exact amount in sats, counted by the price each reading implies, in buckets a tenth of a bin wide (0.115% of price) over the block''s search window: finer than the oracle''s bins, the evidence behind its prices. The chunk at the tip holds its blocks so far, `hash` its last block''s; a whole, settled chunk never changes.'
operationId: get_oracle_payments
parameters:
- in: path
name: start
description: The first block's height.
required: true
schema:
description: The first block's height.
$ref: '#/components/schemas/Height'
style: simple
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/OraclePayments'
'304':
description: 'Not modified: the request''s validator matches the current representation'
'404':
description: Resource not found
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'400':
description: Invalid request parameters
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'500':
description: Internal server error
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'503':
description: Service temporarily unavailable
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
'504':
description: Request deadline exceeded
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorBody'
x-mcp-ignore: true
components:
schemas:
OraclePayments:
description: '144 blocks'' payments, each read as each of the oracle''s 19 round-dollar amounts ($1 to
$10,000) at its exact amount in sats, counted by the price each reading implies in buckets a
tenth of the oracle''s bins.
A reading of `sats` as `amount` dollars implies $100 lands at bin
`(log10(sats) + 2 - log10(amount)) * 200`; bucket `b` holds the readings in bins
`[b * step, (b + 1) * step)`, prices from `10^(10 - (b + 1) * step / 200)` up to
`10^(10 - b * step / 200)` dollars.'
type: object
properties:
hash:
description: 'The last block''s hash: it commits to every block before it.'
allOf:
- $ref: '#/components/schemas/BlockHash'
step:
description: 'A bucket''s width in oracle bins: 0.1, a price range of 0.115%.'
type: number
format: double
blocks:
description: Each block's, in order.
type: array
items:
$ref: '#/components/schemas/OracleBlockPayments'
required:
- hash
- step
- blocks
ErrorDetail:
type: object
properties:
type:
description: Error category, following the HTTP status
allOf:
- $ref: '#/components/schemas/ErrorType'
code:
description: Machine-readable error code
allOf:
- $ref: '#/components/schemas/ErrorCode'
message:
description: Human-readable description
type: string
doc_url:
description: Link to API documentation
type: string
format: uri-reference
required:
- type
- code
- message
- doc_url
Height:
description: 'A block height: how many blocks came before it.'
type: integer
format: uint32
minimum: 0
examples:
- 0
- 210000
- 420000
- 840000
Dollars:
description: An amount in US dollars.
type: number
format: double
examples:
- 0.0
- 100.5
- 30000.0
- 69000.0
- 84342.12
OracleBlock:
description: 'The oracle at one block: what it counted (`histogram`, `outputs`), where it looked (`first_bin`,
`scores`) and what it found (`bin`, `price`).
Bins are the oracle''s log scale of amounts in sats, 200 a decade: amount `sats` is in bin
`round(log10(sats) * 200)`, bin 0 at 1 sat to bin 2399 just under 10^12. Read as where $100
lands, a bin is a price: `10^(10 - bin / 200)` dollars, higher bins lower prices.'
type: object
properties:
height:
description: The block's height; live with the mempool, the next block's.
allOf:
- $ref: '#/components/schemas/Height'
hash:
description: 'The confirmed block it was read at: this block''s hash; live with the mempool, the tip''s
(block `height - 1`), the one the mempool is blended onto.'
allOf:
- $ref: '#/components/schemas/BlockHash'
mempool:
description: 'Whether it''s the live reading with the mempool blended in as the next block (`outputs` the
mempool''s), rather than a confirmed block''s.'
type: boolean
price:
description: 'The price it found, in dollars: `bin` as a price, to the cent.'
allOf:
- $ref: '#/components/schemas/Dollars'
bin:
description: 'The bin it picked, refined between bins by a parabola through its score and its neighbours''
when it''s their local maximum.'
type: number
format: double
first_bin:
description: 'The search window''s first candidate bin: 12 below the block before''s answer, rounded, 24
candidates in all.'
type: integer
format: uint16
minimum: 0
maximum: 65535
scores:
description: 'Each candidate''s score, from `first_bin` on, unitless: for each of the 19 round-dollar
amounts ($1, 2, 3, 5, 10, 15, 20, 25, 30, 50, 100, 150, 200, 300, 500, 1k, 2k, 5k, 10k),
the histogram''s count where that amount lands if $100 is at the candidate, over that
amount''s peak in the window, summed. The pick is the highest of the candidates with counts on
at least two amounts; without one, or with all zero (no payments in the window), the oracle
kept the block before''s answer.'
type: array
items:
type: number
format: double
histogram:
description: 'The smoothed histogram it scored, 2,400 bins: the block''s payments and the 11 blocks''
before it (live, the mempool''s as the next block''s), each block''s counts weighted
`(2/7) * (5/7)^age`, the newest at age 0.'
type: array
items:
type: number
format: double
minItems: 2400
maxItems: 2400
outputs:
description: The block's own outputs (live, the mempool's) as the oracle's filter judged them.
allOf:
- $ref: '#/components/schemas/OracleOutputs'
required:
- height
- hash
- mempool
- price
- bin
- first_bin
- scores
- histogram
- outputs
ErrorCode:
type: string
enum:
- not_found
- invalid_address
- invalid_network
- unsupported_type
- no_series
- series_unsupported_index
- weight_exceeded
- too_many_utxos
- limit_exceeded
- unknown_after_txid
- unknown_address
- unknown_txid
- unknown_pool
- out_of_range
- unindexable_date
- no_data
- series_not_found
- mempool_not_available
- state_updating
- internal_error
- bad_request
- overloaded
- timeout
- method_not_allowed
OracleOutputs:
description: 'A block''s outputs as the oracle''s filter judged them: each skipped one under the first rule
that skips it, in the filter''s order, and the payments it kept. They add up to the block''s
outputs.'
type: object
properties:
coinbase:
description: 'The coinbase''s: new coins, not payments.'
type: integer
format: uint32
minimum: 0
fan_out:
description: 'Those of transactions with more outputs than the fan-out cap (250; 100 before height
630,000): batch payouts.'
type: integer
format: uint32
minimum: 0
op_return:
description: 'Those of transactions carrying an OP_RETURN output: data, not payments.'
type: integer
format: uint32
minimum: 0
taproot:
description: 'Taproot outputs: mostly protocol traffic.'
type: integer
format: uint32
minimum: 0
dust:
description: Under 1,000 sats.
type: integer
format: uint32
minimum: 0
round_btc:
description: Round amounts in bitcoin (within 0.1% of 1, 2, 3, 5 or 6 times a power of ten sats).
type: integer
format: uint32
minimum: 0
payments:
description: 'The rest: the payments it counted.'
type: integer
format: uint32
minimum: 0
required:
- coinbase
- fan_out
- op_return
- taproot
- dust
- round_btc
- payments
BlockHash:
description: 'Double-SHA256 block-header hash, serialized in Bitcoin''s conventional
hexadecimal byte order.'
type: string
examples:
- 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
- 0000000000000000000320283a032748cef8227873ff4872689bf23f1cda83a5
pattern: ^[0-9a-f]{64}$
OracleBlockPayments:
description: One block's payments read as round dollars, over the oracle's search window for it.
type: object
properties:
height:
$ref: '#/components/schemas/Height'
first_bucket:
description: 'The first bucket''s index: the window''s first bin''s lower edge (half a bin under it) over
`step`.'
type: integer
format: uint32
minimum: 0
counts:
description: 'The readings in each bucket from `first_bucket` on: bucket `first_bucket + k` at index `k`.'
type: array
items:
type: integer
format: uint32
minimum: 0
required:
- height
- first_bucket
- counts
ErrorType:
description: 'Error category, following the HTTP status: `invalid_request` (4xx other than 404),
`not_found` (404), `unavailable` (503; `Retry-After` when transient), `timeout` (504), `internal`
(other 5xx).'
type: string
enum:
- invalid_request
- not_found
- unavailable
- timeout
- internal
ErrorBody:
description: The JSON body of every API error (`application/problem+json`).
type: object
properties:
error:
$ref: '#/components/schemas/ErrorDetail'
required:
- error