Call it
curl https://api.peume.com/v1/call/asynchronous-blockchain-sql-job \
-H "Authorization: Bearer $PEUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"sql": "your sql"
}
}'const res = await fetch("https://api.peume.com/v1/call/asynchronous-blockchain-sql-job", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PEUME_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": {
"sql": "your sql"
}
}),
});
const { output, cost_usd } = await res.json();import os, requests
res = requests.post(
"https://api.peume.com/v1/call/asynchronous-blockchain-sql-job",
headers={"Authorization": f"Bearer {os.environ['PEUME_API_KEY']}"},
json={
"input": {
"sql": "your sql"
}
},
)
print(res.json()["output"])Answer: {"id": "run_…", "status": "completed", "cost_usd": …, "output": {…}}. Long jobs answer 202 with a run id to read later. From an AI agent, connect the MCP server and ask for this by name: asynchronous-blockchain-sql-job.
Parameters
sqlRequiredstringRead-only ClickHouse SELECT/WITH query to execute as a durable background job. Same shape and rules as /onchain/sql. Rules (server-enforced or query-killing): SELECT/WITH only (read-only); table references must be database-qualified as agent.<table>; ALWAYS filter on block_date or block_number (partition key — without it the query times out); compare address columns directly against lowercase literals (wrapping the column in lower is rejected); never filter on symbol columns (unindexed full scan, and symbol matches surface scam clones — resolve a ticker to a contract address with /search/tok
max_rowsintegerMaximum result rows to retain. Example: 5000. Defaults to 1000 (server-side), capped at 10000.
