accounts - Stacks

Returns an account's STX balance, locked (stacked) balance, unlock height, and next nonce. Balances are hex-encoded microSTX. A principal is a standard address or a contract principal (address.contract-name).

Endpoint

httpGET /v2/accounts/{principal}

Path Parameters

ParameterTypeDescription
principalstringA standard or contract principal

Query Parameters

ParameterTypeDescription
proofnumberSet to 0 to omit the MARF Merkle proofs from the response

Example

bashexport STACKS_RPC=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/

curl "${STACKS_RPC}v2/accounts/SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7?proof=0"

Response

json{
    "balance": "0x00000000000000000000000005f5e100",
    "locked": "0x00000000000000000000000000000000",
    "unlock_height": 0,
    "nonce": 15,
    "balance_proof": "",
    "nonce_proof": ""
}

Response Fields

FieldTypeDescription
balancestringTotal STX balance in microSTX (hex)
lockedstringStacked (locked) balance in microSTX (hex)
unlock_heightnumberBurn height at which locked STX unlock
noncenumberThe account's next transaction nonce
balance_proofstringMARF proof for the balance (empty when proof=0)
nonce_proofstringMARF proof for the nonce (empty when proof=0)

Use Cases

  • Balance display: Decode the hex microSTX balance (1 STX = 1,000,000 microSTX)
  • Nonce management: Read the next nonce before building a transaction

Error Handling

ErrorMessageDescription
400 / Bad requestBad requestA path, query, or body parameter was invalid or the transaction was rejected
404 / Not foundNot foundThe account, contract, map entry, variable, or constant does not exist
403 / RBAC: access deniedAccess deniedThe GetBlock access token is missing or incorrect