Get data variable

Get contract data variable

GET

Parameters

Path Parameters

principal
REQUIRED
string Standard Stacks address (standard principal, not contract principal). Must be 28-41 characters long using Stacks c32check format.
contract_name
REQUIRED
string Contract name. Must start with a letter and can contain letters, numbers, hyphens, and underscores. Maximum length is 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
var_name
REQUIRED
string Variable name (must be a valid Clarity name)

Query Parameters

proof
integer Controls MARF proof inclusion in response. Set to 1 (default) to include proof, 0 to exclude. Invalid values default to 0 (no proof).
tip
string Stacks chain tip to query from. Options: - (empty/omitted): Use latest anchored tip (canonical confirmed state) - `latest`: Use latest known tip including unconfirmed microblocks. If no unconfirmed state is available, falls back to the confirmed canonical tip. If the unconfirmed state check fails with an error, returns 404. - `{block_id}`: Use specific block ID (64 lowercase hex characters) **Note:** If `tip` is present but contains an invalid or malformed value (i.e., not `latest` and not a valid 64-character hex block ID), the node silently falls back to the latest anchored tip (same as omitting `tip`).
Status codeDescription
200The data variable value
400Bad request
404Not found
cURL
curl -L \
"https://api.hiro.so/v2/data_var/{principal}/{contract_name}/{var_name}?proof={proof}&tip={tip}" \
-H 'Accept: application/json'
Response
{
"data": "0x1234567890abcdef",
"proof": "0x1234567890abcdef"
}

How is this guide?