Skip to content

Query On-Chain State with Polkadot REST API

Introduction

Polkadot REST API is a REST service that Parity maintains for Polkadot SDK-based blockchains. It provides an HTTP interface to query account balances, asset information, block data, and other on-chain state without requiring WebSocket connections or SDK integrations. It replaces the deprecated Substrate API Sidecar and serves the same endpoints under the /v1 prefix.

This guide demonstrates how to query on-chain storage with curl against a Polkadot REST API instance that you run yourself, connected to a local development node.

Prerequisites

  • curl or any HTTP client.
  • A local development node listening on ws://127.0.0.1:9944, for example the parachain template node described in Run the Node Locally.
  • For the asset queries, a runtime that includes the Assets pallet and at least one asset.

Run Polkadot REST API Locally

Install and start Polkadot REST API. For more installation and configuration options, see the Polkadot REST API page.

# Install the binary
cargo install --locked polkadot-rest-api@0.3.3

# Run with default settings (connects to ws://127.0.0.1:9944)
polkadot-rest-api

To connect to a node on a different endpoint, set the SAS_SUBSTRATE_URL environment variable:

SAS_SUBSTRATE_URL=INSERT_NODE_WS_URL polkadot-rest-api
docker run --rm -p 8080:8080 \
  -e SAS_SUBSTRATE_URL=INSERT_NODE_WS_URL \
  docker.io/paritytech/polkadot-rest-api:v0.3.3

Replace INSERT_NODE_WS_URL with a WebSocket endpoint of your node that is reachable from inside the container.

Once running, Polkadot REST API serves requests at http://127.0.0.1:8080, with all endpoints under the /v1 prefix. All examples on this page use that address. The sample responses are illustrative, and the values you see depend on your chain.

Query Account Balance

The /v1/accounts/{accountId}/balance-info endpoint returns an account's native token balance, including free, reserved, and frozen amounts.

Request

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/balance-info"

Response

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/balance-info"
{
  "at": {
    "hash": "0xb909e50be96fc0f939588c4a7730670f9ee53c67d95d516198530e5cfe189d6c",
    "height": "10646569"
  },
  "nonce": "0",
  "tokenSymbol": "UNIT",
  "free": "10000000000",
  "reserved": "0",
  "miscFrozen": "miscFrozen does not exist for this runtime",
  "feeFrozen": "feeFrozen does not exist for this runtime",
  "frozen": "0",
  "transferable": "10000000000",
  "locks": []
}

Response fields

Field Description
at.hash Block hash at which the query was executed
at.height Block number at which the query was executed
nonce Number of transactions sent from this account
tokenSymbol Native token symbol of the chain
free Balance available for transfers (in the smallest unit)
reserved Balance locked for on-chain activities
miscFrozen Legacy field. On runtimes that use frozen, contains a message stating that the field does not exist for this runtime
feeFrozen Legacy field. On runtimes that use frozen, contains a message stating that the field does not exist for this runtime
frozen Balance frozen and unavailable for transfers
transferable Actual balance available to transfer
locks Array of balance locks with their reasons

Query at a specific block

You can query the balance at a specific block height or hash using the at query parameter:

# Query at block height
curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/balance-info?at=INSERT_BLOCK_NUMBER"

# Query at block hash
curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/balance-info?at=INSERT_BLOCK_HASH"

Query Asset Balances

The /v1/accounts/{accountId}/asset-balances endpoint returns an account's balances for assets managed by the Assets pallet. By default, assets with a zero balance are left out of the response. To include them, add the showEmpty=true query parameter.

Request all asset balances

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/asset-balances"

Request a specific asset balance

To query a specific asset, provide the asset ID as a query parameter:

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/asset-balances?assets[]=INSERT_ASSET_ID"

Response

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/asset-balances?assets[]=INSERT_ASSET_ID"
{
  "at": {
    "hash": "0x826f74ae5f6fea33383075156231de5ca8e0ddb308b3f799c9bd64463ed8cb5b",
    "height": "10646570"
  },
  "assets": [
    {
      "assetId": "INSERT_ASSET_ID",
      "balance": "1000000",
      "isFrozen": false,
      "isSufficient": false
    }
  ]
}

Response fields

Field Description
at.hash Block hash at which the query was executed
at.height Block number at which the query was executed
assetId Unique identifier for the asset
balance Account's balance of this asset (in smallest unit)
isFrozen Whether the account's asset balance is frozen
isSufficient Whether this account's existence is being paid for by this asset balance (per-account flag, not the asset's global sufficiency setting)

Note

The isSufficient field in the asset balance response is a per-account flag. To check if an asset is configured as a sufficient asset (can pay for account existence), query the Asset Details endpoint and check the isSufficient field there.

Query multiple assets

You can query multiple assets in a single request:

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/asset-balances?assets[]=INSERT_ASSET_ID_1&assets[]=INSERT_ASSET_ID_2"

Query Asset Metadata

Use the pallet storage endpoint to query asset metadata like name, symbol, and decimals.

Request

curl -s "http://127.0.0.1:8080/v1/pallets/assets/storage/Metadata?keys[]=INSERT_ASSET_ID"

Response

curl -s "http://127.0.0.1:8080/v1/pallets/assets/storage/Metadata?keys[]=INSERT_ASSET_ID"
{
  "at": {
    "hash": "0xaf0628855a206da5e95e564b58b9a0bfc490cc8de047a0521252b631be77fac7",
    "height": "10646571"
  },
  "pallet": "assets",
  "palletIndex": "50",
  "storageItem": "metadata",
  "keys": ["INSERT_ASSET_ID"],
  "value": {
    "deposit": "2008200000",
    "name": "0x4578616d706c6520546f6b656e",
    "symbol": "0x455854",
    "decimals": "6",
    "isFrozen": false
  }
}

Response fields

Field Description
at.hash Block hash at which the query was executed
at.height Block number at which the query was executed
pallet Name of the pallet containing the storage item
palletIndex Numeric index of the pallet in the runtime
storageItem Name of the storage item being queried
keys Array of keys used to query the storage map
value.deposit Deposit held for storing this metadata
value.name Asset name (hex-encoded string)
value.symbol Asset symbol (hex-encoded string)
value.decimals Number of decimal places for display
value.isFrozen Whether the asset metadata is frozen

The name and symbol fields are returned as hex-encoded UTF-8 strings. In the sample response, 0x4578616d706c6520546f6b656e decodes to "Example Token" and 0x455854 decodes to "EXT."

Query Asset Details

Query the asset configuration, including owner, supply, and account count:

Request

curl -s "http://127.0.0.1:8080/v1/pallets/assets/storage/Asset?keys[]=INSERT_ASSET_ID"

Response

curl -s "http://127.0.0.1:8080/v1/pallets/assets/storage/Asset?keys[]=INSERT_ASSET_ID"
{
  "at": {
    "hash": "0xaf0628855a206da5e95e564b58b9a0bfc490cc8de047a0521252b631be77fac7",
    "height": "10646571"
  },
  "pallet": "assets",
  "palletIndex": "50",
  "storageItem": "asset",
  "keys": ["INSERT_ASSET_ID"],
  "value": {
    "owner": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "issuer": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "admin": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "freezer": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "supply": "77998622834557",
    "deposit": "1000000000000",
    "minBalance": "10000",
    "isSufficient": true,
    "accounts": "13572",
    "sufficients": "13465",
    "approvals": "18",
    "status": "Live"
  }
}

Response fields

Field Description
at.hash Block hash at which the query was executed
at.height Block number at which the query was executed
pallet Name of the pallet containing the storage item
palletIndex Numeric index of the pallet in the runtime
storageItem Name of the storage item being queried
keys Array of keys used to query the storage map
value.owner Account that owns the asset
value.issuer Account authorized to mint new tokens
value.admin Account with administrative privileges
value.freezer Account that can freeze balances
value.supply Total supply of the asset (in smallest unit)
value.minBalance Minimum balance required to hold this asset
value.isSufficient Whether this asset can pay for account existence (accounts holding only this asset don't need native tokens)
value.accounts Number of accounts holding this asset
value.sufficients Number of accounts whose existence is paid for by this asset
value.status Asset status (Live, Frozen, or Destroying)

Query Foreign Asset Balances

For cross-chain assets (foreign assets) on chains that support them, use the /v1/accounts/{accountId}/foreign-asset-balances endpoint:

curl -s "http://127.0.0.1:8080/v1/accounts/INSERT_ADDRESS/foreign-asset-balances"

Query Block Information

The /v1/blocks/{blockId} endpoint returns detailed block information, including extrinsics and events.

Request latest block

curl -s "http://127.0.0.1:8080/v1/blocks/head"

Request specific block

# By block number
curl -s "http://127.0.0.1:8080/v1/blocks/INSERT_BLOCK_NUMBER"

# By block hash
curl -s "http://127.0.0.1:8080/v1/blocks/INSERT_BLOCK_HASH"

Response

curl -s "http://127.0.0.1:8080/v1/blocks/10646572"
{
  "number": "10646572",
  "hash": "0x5abb54c72ffe3c342536f6e34a8558445ef23a460ae8a6fb366af6d9105c3950",
  "parentHash": "0xaf0628855a206da5e95e564b58b9a0bfc490cc8de047a0521252b631be77fac7",
  "stateRoot": "0x0be63683f15de9dff2d1553d4904ec3f446b244cfbf7aa69afa1b2faee824688",
  "extrinsicsRoot": "0xb4f58daf2791928cebcd1cdee3c51487127824dc0ba4e9b4b9b4be6af6c09b79",
  "authorId": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  "logs": [
    {
      "type": "PreRuntime",
      "index": "6",
      "value": ["0x61757261", "0x35fdc30800000000"]
    }
  ],
  "onInitialize": {
    "events": []
  },
  "extrinsics": [
    {
      "method": {
        "pallet": "timestamp",
        "method": "set"
      },
      "signature": null,
      "nonce": null,
      "args": {
        "now": "1733237652000"
      },
      "tip": null,
      "hash": "0x...",
      "info": {},
      "era": {
        "immortalEra": "0x00"
      },
      "events": [],
      "success": true,
      "paysFee": false
    }
  ],
  "onFinalize": {
    "events": []
  },
  "finalized": true
}

API Reference

For a complete list of endpoints and parameters, open http://127.0.0.1:8080/docs on your running instance, or see the published Polkadot REST API documentation.

Where to Go Next

Now that you understand how to query on-chain state with the REST API, explore these related topics:

  • Query with SDKs


    Use the Subxt Rust library for programmatic, type-safe access.

    Get Started

  • Runtime API Calls


    Learn how to execute runtime APIs for specialized queries.

    Get Started

  • Send Transactions


    Learn to construct and submit transactions.

    Get Started

Last update: November 17, 2026
| Created: November 17, 2026