Skip to main content

/v1/scripts REST API Endpoint

Execute a read-only Cadence script against the execution state at a specified block height or ID. If a block height or ID is not specified, the script will be executed against the latest sealed block height.

Updated on
Oct 4, 2023

/v1/scripts REST API Endpoint

Parameters

block_id
string
The ID of the block to execute the script against. For a specific block height, use block_height instead
block_height
string
The block height for which the script is to be run. The string final and sealed are also supported. This parameter is incompatible with block_id
script
string
The Base64 encoded content of the Cadence script
arguments
array
A list of arguments each encoded as Base64 passed in the JSON-Cadence interchange format

Returns

value
string
The result of the executed Cadence script
Request
1
SCRIPT=$(echo 'pub fun main(greeting: String): String { return greeting }' | base64)
2
GREETING=$(echo '{"type":"String","value":"Hello world"}' | base64)
3
4
curl --location https://docs-demo.flow-mainnet.quiknode.pro/v1/scripts \
5
-H 'Content-Type: application/json' \
6
-d "{\"script\": \"${SCRIPT}\",\"arguments\":[\"${GREETING}\"]}"
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free