Skip to content
TAO$188.21
BTC0.002927
MCap$2.22B
Vol$86.25M

API reference / Subnets

Quote a stake or unstake through a subnet's pool

GET/api/v2/subnets/{netuid}/quote
Status
Beta
Auth
API key or OAuth access token
Scope
data:read
Rate limit
plan

What staking amount_rao TAO (side=stake: TAO in, alpha out) or unstaking amount_rao alpha (side=unstake: alpha in, TAO out) costs through the subnet's pool now: the amount out, the pool fee, the spot price, the price realised and the curve's price impact. Computed by this API (not by the data source) with the chain's swap reimplemented exactly (the v423+ Balancer weighted pool, the fee taken from the amount going in, U64F64 truncation; root and other stable subnets move 1:1 with no fee) on the pool's raw inputs at data.state_height (/subnets/{netuid}?include=state's state.pool, read in one call). Checked equal, to the rao, to the runtime's own SwapRuntimeApi.sim_swap_*. A pool the model does not cover (constant_product, concentrated_liquidity), a subnet with staking disabled (subtoken_enabled false) or a swap the chain would refuse answers 200 with every amount null and unavailable_reason. Not checked: the account's balance, the chain's minimum stake and rate limits. Always the head, so tip-cached. Errors are application/problem+json: INVALID_NETUID, INVALID_SIDE, INVALID_AMOUNT, SUBNET_NOT_FOUND (404), UNKNOWN_PARAMETER, SOURCE_TIMEOUT (503), SOURCE_NOT_READY (503).

Beta: this route may change with one release's notice in the v2 changelog; additive changes need none (x-stability: beta).

Path parameters

netuidpath, required· integer · 0 to 65535

Subnet slot (0 = root).

Query parameters

sidequery· string

Required: stake (TAO in, alpha out) or unstake (alpha in, TAO out). Anything else is a 400 INVALID_SIDE.

amount_raoquery· string

Required: the amount going in, a decimal integer 1..18446744073709551615 in its asset's base unit: rao of TAO on a stake, alpha rao of this subnet on an unstake (the fee included). Anything else is a 400 INVALID_AMOUNT.

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 quote.

netuidinteger · unit id

Subnet slot.

sideenum

stake (TAO in, alpha out: add_stake) or unstake (alpha in, TAO out: remove_stake).

One of: stake, unstake
amount_in_tao_raostring · unit rao (÷1e9) · can be null

Stake: the TAO paid in (amount_rao, the fee included), rao. Null on the other side, and with unavailable_reason.

Format: whole number, as a string · on chain: u64
amount_in_alpha_raostring · unit alpha_rao (÷1e9) · can be null

Unstake: the alpha paid in (amount_rao, the fee included), alpha rao of this subnet. Null on the other side, and with unavailable_reason.

Format: whole number, as a string · on chain: u64
amount_out_alpha_raostring · unit alpha_rao (÷1e9) · can be null

Stake: the alpha received, alpha rao of this subnet. Null on the other side, and with unavailable_reason.

Format: whole number, as a string · on chain: u64
amount_out_tao_raostring · unit rao (÷1e9) · can be null

Unstake: the TAO received, rao. Null on the other side, and with unavailable_reason.

Format: whole number, as a string · on chain: u64
fee_tao_raostring · unit rao (÷1e9) · can be null

Stake: the pool fee, rao of TAO: floor(amount x fee_rate_u16 / 65535) (U64F64), taken from the TAO going in before the curve (0 on a stable subnet). Null on the other side, and with unavailable_reason.

Format: whole number, as a string · on chain: u64
fee_alpha_raostring · unit alpha_rao (÷1e9) · can be null

Unstake: the pool fee, alpha rao, taken from the alpha going in before the curve (the chain sells it after the user's swap, so it never moves the user's price; 0 on a stable subnet). Null on the other side, and with unavailable_reason.

Format: whole number, as a string · on chain: u64
spot_price_taostring · unit tao_per_alpha · 12 decimals · can be null

The pool's spot price before the swap, TAO per alpha, 12 decimals (half up): (w_alpha / w_tao) x TAO reserve / alpha reserve at state_height (1 on a stable subnet). Null with unavailable_reason.

Format: decimal number, as a string
effective_price_taostring · unit tao_per_alpha · 12 decimals · can be null

The price the swap realises, fee included, TAO per alpha, 12 decimals: TAO in / alpha out on a stake, TAO out / alpha in on an unstake. Null with unavailable_reason.

Format: decimal number, as a string
price_impact_ratiostring · unit ratio · 12 decimals · can be null

The curve's own move against spot, the fee excluded, a fraction of one, 12 decimals: 1 - alpha out x spot / net TAO in on a stake, 1 - TAO out / (net alpha in x spot) on an unstake (net = after the fee). 0 on a stable subnet. Null with unavailable_reason.

Format: decimal number, as a string
state_heightinteger · unit block · can be null

The block of the pool inputs the quote is computed from (state.pool.state_height).

mechanismstring · can be null

The pool's curve (state.pool.swap_mechanism). Known values: stable, constant_product, concentrated_liquidity, balancer. New values may be added; show an unknown value as is (or generically).

sourcestring

Always model: computed by this API from the raw chain inputs. New values may be added; show an unknown value as is (or generically).

unavailable_reasonstring · can be null

Why no amount is given; null when they are. One of mechanism_unknown, unsupported_mechanism, inputs_missing, subtoken_disabled (staking is off on this subnet: the chain refuses it) or swap_refused (the chain would refuse it: nothing out, or a net input over 1000 x the input reserve). Known values: no_state, mechanism_unknown, unsupported_mechanism, inputs_missing, no_reference_stake, subtoken_disabled, swap_refused. New values may be added; treat unknown values as unavailable.

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), slow public, max-age=300, stale-while-revalidate=600 (state that moves in minutes or days) or tip public, 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). Never immutable. no-store on 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-revalidate and stale-if-error; no-store with X-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, with X-BTAI-Stale-As-Of, Age (its seconds since then) and Warning: 110 - "Response is Stale", and Cache-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.

From the API's published specification, version 1.165.0.