Skip to content

Bittensor API endpoints

Bittensor network data as JSON: subnets and their prices, validators and their yields, accounts and portfolios, trades, blocks, extrinsics and events. It is the API taoswap.org runs on, open to anyone building a dashboard, a bot, a wallet, a tax report or research on Bittensor.

Quickstart

The base URL is https://api.taoswap.org. There is no key, no account and no sign-up: send a plain GET. This guide and every live operation also come as plain text at https://api.taoswap.org/llms.txt, for an AI agent or a reader without JavaScript. One call to /v2/subnets/ returns every subnet: read lists whole rather than looping over netuids.

curl "https://api.taoswap.org/subnet-price-history/?netuid=64&resolution=D&limit=2"
{
  "netuid": 64,
  "resolution": "D",
  "count": 2,
  "results": [
    {"time": 1792627200, "open": 0.067109159, "high": 0.068240326, "low": 0.067109083, "close": 0.067867348, "volume": 6549.837576187999},
    {"time": 1792713600, "open": 0.067867348, "high": 0.068061833, "low": 0.067867272, "close": 0.068039508, "volume": 398.21830664600003}
  ]
}

Two daily candles of subnet 64’s alpha price in TAO per alpha, each starting at a UNIX time in seconds, with the TAO swapped in the subnet’s pool that day. The reference gives every operation its parameters, its rate limit and its response, with an example on the most used ones.

Units

Amounts use three units, and each amount field’s description names its own:

  • rao, the chain’s base unit: 1 TAO is 10⁹ rao. As a rule an integer amount is in rao, even under a _tao name such as total_tao on /accounts/.
  • TAO: a floating-point amount of TAO, such as a market cap, is in whole TAO.
  • alpha, each subnet’s own token: whole alpha as a floating-point number, or alpha rao (10⁻⁹ alpha) as an integer such as alpha_rao.

Prices are in TAO per alpha, and _usd fields in US dollars. A few exact figures come as decimal strings, such as the stakes on /validators/, the USD values on the portfolio routes and burn_tao on /subnets/{netuid}/registrations/.

Time

Datetimes are ISO 8601 in UTC, with fractional seconds only when they are not zero, and end in Z or +00:00 depending on the route: parse the offset rather than match a suffix. Dates are UTC days, YYYY-MM-DD, and candles use UNIX seconds. Date bounds are inclusive, except date_to on /trades/ and /trades/summary/, which ends the window at 00:00 UTC that day. A block lands about every 12 seconds.

Pagination

Lists page in one of five ways, and each operation says which:

  • page and page_size, page counting from 1, with a pagination object beside results that carries has_next and, on most lists, the totals. Its fields vary a little from route to route, as each documents. A page deeper than 10,000 rows answers 400.
  • before, the cursor /trades/ hands out as pagination.next_before, reads on past that depth.
  • after, the cursor handed out as next_cursor, does the same for the delegators of /v2/subnets/{netuid}/ and /v2/validators/{hotkey}/ and for a fund’s swaps and deposits under /v1/beta-baskets/.
  • limit and offset on /account-transactions/, which pages two lists at once and carries no totals: a list shorter than limit is the last page.
  • limit alone keeps the most recent rows of a series, such as /price-history/ and /subnet-price-history/.

The other lists answer whole: /subnets/, /validators/, /identities/, /metagraph/{netuid}/, and the daily histories, which days or a date range bound.

Errors

Every error the API itself returns is JSON, in one envelope:

{"error": true, "code": "VALIDATION_ERROR", "message": "netuid is required", "detail": null}
Status code Meaning
400 VALIDATION_ERROR A parameter is missing or malformed, or the page is too deep. detail may name the fields.
404 RESOURCE_NOT_FOUND No such route or object. Cached for 15 seconds: a new block is indexed within a minute.
405 METHOD_NOT_ALLOWED The route exists, but not for this HTTP method.
410 ENDPOINT_REMOVED The route was retired. detail.replacement names its successor, when it has one.
429 RATE_LIMITED Over the operation’s rate limit. Retry after the Retry-After header’s seconds.
500 INTERNAL_ERROR A server fault.
503 QUERY_TIMEOUT The query ran past its time budget. Narrow the filters or the window.

Other client errors carry the framework’s code in capitals, such as PARSE_ERROR, and the testnet faucet lists its own codes on its operation. The proxy in front of the API answers its own 429 in this envelope too, and 502 or 504 as HTML when the API is unreachable.

Browsers and CORS

A web page on any origin can call the GET operations from the browser: their answers, errors and redirects included, carry Access-Control-Allow-Origin: *, and a script reads their Retry-After, Deprecation, Sunset and Link headers. Send no credentials, as fetch does by default: no operation reads a cookie, and a browser refuses a * answer to a request made with credentials: "include". Send no custom header on a GET either, Content-Type: application/json included: the browser then sends a preflight first for each distinct URL, and each one counts against the proxy’s 10 requests a second. Each visitor’s browser spends the limits of its own address.

Rate limits

Limits are per IP address, and no key raises them. Each operation states its own, and this table groups them:

Scope Limit Applies to
anon 600/minute Every route without a tighter scope, the metagraph, network stats and TAO price among them.
subnet_price 2000/minute The subnet candles, /subnet-price-history/, which charts call in bursts.
explore 300/minute Subnets, validators, blocks, events, extrinsics, trades, gamma, accounts, identities, search, beta baskets, multisigs, the network metrics, the history before Finney, and the portfolio balance, ledger, PnL, root dividends and transactions.
og 30/minute The Open Graph share images under /og/.
faucet 3/minute The testnet faucet claim, POST /testnet-faucet/; its reads count against anon.

Over a limit, the API answers 429 with a Retry-After header in seconds. The proxy in front of it also caps each address at 10 requests a second, and an address it refuses 300 times within 10 minutes is blocked for 5 minutes, then for twice as long after fewer refusals at each repeat, up to 1 hour, so back off at the first 429. Both layers in full.

Versions

Every bare path of the reference is version 1, and /v1/ aliases it: /subnets/ and /v1/subnets/ are the same route, listed here under the bare path. Newer resources exist under /v1/ only, such as /v1/account-ledger/ and /v1/beta-baskets/. /v2/ carries a newer shape of subnets, validators and extrinsics, described on each operation: prefer it where it exists. New fields appear without notice, so ignore the keys you do not know; a value found wrong is fixed in place, and a shape change gets a new version.

Deprecations

A route on its way out answers as before for at least 7 days with Deprecation, Sunset and Link headers, marked deprecated in the reference with its date, then answers 410. A stable operation, and each of its fields, leaves only after at least 180 days: the schema marks it x-stability: stable, the reference and /llms.txt say Stable, and a /v1/ alias shares the stability of its bare route. Build a package or a recipe meant to last on those. The deprecations page lists what is on its way out with the removal dates and an Atom feed.

Support

Questions, and every deprecation as it is announced: the Kusanagi Discord.

Deprecations