Skip to content

Parameterized queries

The SQL API supports paramaterized SQL queries. This allows you to define parameters in the SQL directly to iterate over ranges and results. Parameters are wrapped in double brackets within the SQL and passed in the parameters mapping in the json request body. Your parameter name must match the key. For example:

SQL Query
SELECT * FROM ethereum.nfts WHERE contract_address = '{{contract_address}}' LIMIT 10;

curl --request POST \
     --data '{"sql": "SELECT * FROM ethereum.nfts WHERE contract_address = '\''{{contract_address}}'\'' LIMIT 10;", "parameters": {"contract_address": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D"}}' \
     --url 'https://api.transpose.io/sql' \
     --header 'Content-Type: application/json' \
     --header 'x-api-key: FxKTp6MHpWQDaos8SRnSetdIZiUYLliS' \