- APIs
- Stacks Blockchain API
- Variable
Get data variable
RPC node
Get contract data variable
GET
Parameters
Path Parameters
principal
REQUIRED
string Stacks address (28-41 characters) or a Contract identifier in format `{address}.{contract_name}`
(e.g. `SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0.get-info`).
Contract names have a maximum length of 40 characters for new contracts. Legacy contracts may have names up to 128 characters.
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
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
- `{block_id}`: Use specific block ID (64 hex characters)
Status code | Description |
---|---|
200 | The data variable value |
400 | Bad request |
404 | Not 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
{"$ref": "./components/examples/clarity-data.example.json"}