Free, no signup, no key

Bitcoin Halving API

Give it a block height, get its halving era, block subsidy, and blocks until the next halving — as JSON. No API key, no account, no rate-limit tracking, no live node behind it. Just the same arithmetic from Chapter 5, served over HTTP.

Try it

GET https://why21million.com/api/halving/850000

Returns:

{ "height": 850000, "era": 5, "rewardBtc": 3.125, "blocksIntoEra": 10000, "blocksUntilNextHalving": 200000, "nextHalvingBlock": 1050000, "source": "https://why21million.com/book/halving-schedule/" }

Swap 850000 for any non-negative block height. An invalid or missing height returns a 400 with a short JSON error instead of a crash.

Fields

FieldMeaning
heightThe block height you requested, echoed back.
era1-indexed halving era that height belongs to.
rewardBtcBlock subsidy in BTC during that era — 0 once issuance ends (era > 33, around the year 2140).
blocksIntoEraHow many blocks into the era this height is (0-indexed).
blocksUntilNextHalvingBlocks remaining until the next halving, counted from this height.
nextHalvingBlockThe block height where the next halving occurs.

What this is not

This isn't a blockchain explorer or a live node — it doesn't know the current block height, and it never phones out to check. It's pure arithmetic against the protocol's fixed schedule, the same schedule Chapter 1 and Chapter 5 work through by hand. If you need the current tip height, pair this with any block explorer's API and feed the result in here.

Details for integrators

  • CORS: Access-Control-Allow-Origin: * — call it directly from a browser, no proxy needed.
  • Caching: responses are cacheable for 24 hours (Cache-Control: public, max-age=86400) — the answer for a given height never changes, so cache it aggressively on your end too.
  • No rate limits enforced as of this writing, but be reasonable — this runs on Cloudflare Pages Functions, not a dedicated backend.
  • Uptime: best-effort, no SLA. It's a free static-adjacent endpoint on a hobby project, not a paid service.
Prefer to run the arithmetic yourself instead of calling out over the network? The same logic is a small, tested, MIT-licensed JS library: halving-math on GitHub.