API reference / Runtimes and storage
Where to download one runtime's code
https://api.bittensor.ai/api/v2/runtimes/{spec_version}/code- Status
- Beta
- Auth
- API key or OAuth access token
- Scope
data:read- Rate limit
plan
Where to download one runtime's code: the runtime's :code storage at its first block (first_height in GET /api/v2/runtimes), read from an archive node, checked (its blake2_256 computed by this API, the wasm's embedded spec_name node-subtensor and spec_version equal to this spec) and published once as a static file. This answer is the link, never the bytes: download_url is public, immutable storage (served application/octet-stream as an attachment, cacheable for a year; no API key, not The file is the on-chain runtime code, identical to the wasm-builder's .compact.compressed.wasm; its blake2_256 is code_hash. compressed says it is Substrate's 8-byte prefix then zstd; bytes and decompressed_bytes give both sizes. A runtime is published by a background job within about an hour of its first block being final. Every published runtime is also listed in runtimes/index.json next to the files. Settled once published (the file never changes). Errors are application/problem+json: INVALID_SPEC_VERSION, RUNTIME_CODE_NOT_PUBLISHED (404: no such spec, or not published yet; never cached), UNKNOWN_PARAMETER, SOURCE_NOT_READY (503: this deployment does not serve published runtime code yet).
Beta: this route may change with one release's notice in the v2 changelog; additive changes need none (x-stability: beta).
Path parameters
- spec_versionpath, required· integer · 0 to 2147483647
The runtime's spec_version (e.g.
470).
Query parameters
- includequery· string
Reserved for opt-in sections. This route defines none yet; the parameter is declared so that adding one later is additive for generated clients. Any value is a 400
INVALID_INCLUDE.
Response
data is an object with these fields. Amounts are integer strings in their base unit, and null means unknown, never zero (see Units and formats). meta.at names the block the answer was read at.
The file and where to download it.
- spec_versioninteger · unit id
The runtime's spec_version.
- code_hashstring
blake2_256 of the file's bytes (the chain's code hash), 0x + 64 lower-case hex. Computed from the bytes read at
block_hash; the file's own blake2_256 is this value.- Format: 32-byte hex: 0x and 64 hex digits
- bytesinteger · unit count
Size of the file in bytes (the on-chain code).
- decompressed_bytesinteger · unit count
Size of the wasm module inside it, after decompression (
byteswhen notcompressed).- compressedboolean
True when the file is in Substrate's compressed form, as on chain: the 8-byte prefix 0x52bc537646db8e05, then zstd (strip the prefix and zstd-decompress it for the wasm module). The file is the on-chain runtime code, identical to the wasm-builder's
.compact.compressed.wasm; its blake2_256 iscode_hash.- first_heightinteger · unit block
The first block this spec executed (
GET /api/v2/runtimes).- block_hashstring
The block at
first_height, whose:codestorage the file is, 0x + 64 lower-case hex.- Format: 32-byte hex: 0x and 64 hex digits
- download_urlstring
Public, immutable URL of the file, named
node-subtensor-{spec_version}-{hash16}.compact.compressed.wasmlike the wasm-builder's output (servedapplication/octet-streamas an attachment, cacheable for a year). Static storage: no API key, not- published_atstring (date-time)
When the file was published, RFC 3339 UTC.
- Format: date and time, ISO 8601 in UTC
Response headers
10 headers: ETag, Cache-Control, CDN-Cache-Control, X-BTAI-Stale, X-BTAI-Stale-As-Of, RateLimit-Policy, RateLimit, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
- ETag
Strong validator of this answer. Send it back as
If-None-Match: an unchanged answer is a 304 Not Modified without a body. A settled answer's validator leaves the chain head out, so it stays valid as the head moves.- Cache-Control
One of three classes: settled
public, max-age=3600, stale-while-revalidate=86400(pinned to a block that cannot move), slowpublic, max-age=300, stale-while-revalidate=600(state that moves in minutes or days) or tippublic, max-age=6, stale-while-revalidate=12(follows the chain head); the label routes are cached until the next nightly copy (public, max-age=<seconds>, stale-while-revalidate=60). Neverimmutable.no-storeon an earlier answer served because the data source failed (X-BTAI-Stale).- CDN-Cache-Control
The same class for shared caches (RFC 9213; browsers ignore it): settled 24 h, slow 300 s, tip 6 s, each with
stale-while-revalidateandstale-if-error;no-storewithX-BTAI-Stale.- X-BTAI-Stale
Present only when the data source failed to answer (it timed out or was unavailable) and an earlier answer to the same request is served instead of a 503 (stale if error, RFC 5861). Then
if-error, withX-BTAI-Stale-As-Of,Age(its seconds since then) andWarning: 110 - "Response is Stale", andCache-Control: no-store: the answer is never kept as fresh, and a later request reads again. Prices and quotes are never served this way.- X-BTAI-Stale-As-Of
With
X-BTAI-Stale: when the earlier answer served was produced, an RFC 3339 UTC time (2026-10-21T12:00:00Z).- RateLimit-Policy
The tier's request quota of the current window (IETF draft), e.g.
"tier";q=600.- RateLimit
Requests left in the current window and the seconds until it resets (IETF draft), e.g.
"tier";r=597;t=42.- X-RateLimit-Limit
The tier's request quota of the current window.
- X-RateLimit-Remaining
Requests left in the current window.
- X-RateLimit-Reset
When the current window resets, Unix seconds.
Status codes
200 · 304 · 400 · 401 · 402 · 403 · 404 · 429 · 500 · 502 · 503
304 Not Modified: the If-None-Match validator still matches; no body.
Error codes
The codes this endpoint can return. Each links to what it means and what to do.
- AMBIGUOUS_CREDENTIALS
- BILLING_UNAVAILABLE
- BUDGET_EXCEEDED
- CONCURRENCY_LIMIT
- INSUFFICIENT_PERMISSIONS
- INTERNAL_ERROR
- INVALID_INCLUDE
- INVALID_SPEC_VERSION
- PAYMENT_REQUIRED
- PLAN_REQUIRED
- RATE_LIMITED
- RUNTIME_CODE_NOT_PUBLISHED
- SERVICE_UNAVAILABLE
- SOURCE_BUSY
- SOURCE_NOT_READY
- UNAUTHORIZED
- UNKNOWN_PARAMETER
- VALIDATION_ERROR
From the API's published specification, version 1.165.0.