Skip to main content

Call read-only function

Call a read-only public function on a given smart contract.

The smart contract and function are specified using the URL path. The arguments and the simulated tx-sender are supplied via the POST body in the following JSON format:

Path Parameters
contract_address string REQUIRED

Stacks address

Example: SP187Y7NRSG3T9Z9WTSWNEN3XRV1YSJWS81C7JKV7
contract_name string REQUIRED

Contract name

Example: imaginary-friends-zebras
function_name string REQUIRED

Function name

Example: get-token-uri
Query Parameters
tip string

The Stacks chain tip to query from

Request Body REQUIRED

map of arguments and the simulated tx-sender where sender is either a Contract identifier or a normal Stacks address, and arguments is an array of hex serialized Clarity values.

sender string REQUIRED

The simulated tx-sender

arguments string[] REQUIRED

An array of hex serialized Clarity values

Responses
200

Success

Schema OPTIONAL
okay boolean
result string OPTIONAL
cause string OPTIONAL
call_read_only_function
POST /v2/contracts/call-read/:contract_address/:contract_name/:function_name
contract_address — path
contract_name — path
function_name — path
tip — query
Body
Loading...
https://api.mainnet.hiro.so
curl -L -X POST 'https://api.mainnet.hiro.so/v2/contracts/call-read/:contract_address/:contract_name/:function_name' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'