Blockchain Structured Query
curl --request POST \
--url https://api.asksurf.ai/gateway/v1/onchain/query \
--header 'Content-Type: application/json' \
--data '
{
"source": "agent.my_table",
"fields": [
"transaction_hash",
"from_address",
"value"
],
"filters": [
{
"field": "block_number",
"op": "eq",
"value": "<unknown>"
}
],
"limit": 20,
"offset": 0,
"sort": [
{
"field": "gas",
"order": "desc"
}
]
}
'import requests
url = "https://api.asksurf.ai/gateway/v1/onchain/query"
payload = {
"source": "agent.my_table",
"fields": ["transaction_hash", "from_address", "value"],
"filters": [
{
"field": "block_number",
"op": "eq",
"value": "<unknown>"
}
],
"limit": 20,
"offset": 0,
"sort": [
{
"field": "gas",
"order": "desc"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
source: 'agent.my_table',
fields: ['transaction_hash', 'from_address', 'value'],
filters: [{field: 'block_number', op: 'eq', value: '<unknown>'}],
limit: 20,
offset: 0,
sort: [{field: 'gas', order: 'desc'}]
})
};
fetch('https://api.asksurf.ai/gateway/v1/onchain/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{}
],
"meta": {
"cached": true,
"credits_used": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"$schema": "https://example.com/schemas/DataResponseOnchainRow.json"
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"$schema": "https://example.com/schemas/DataAPIError.json"
}Onchain
Structured Query
POST
/
gateway
/
v1
/
onchain
/
query
Blockchain Structured Query
curl --request POST \
--url https://api.asksurf.ai/gateway/v1/onchain/query \
--header 'Content-Type: application/json' \
--data '
{
"source": "agent.my_table",
"fields": [
"transaction_hash",
"from_address",
"value"
],
"filters": [
{
"field": "block_number",
"op": "eq",
"value": "<unknown>"
}
],
"limit": 20,
"offset": 0,
"sort": [
{
"field": "gas",
"order": "desc"
}
]
}
'import requests
url = "https://api.asksurf.ai/gateway/v1/onchain/query"
payload = {
"source": "agent.my_table",
"fields": ["transaction_hash", "from_address", "value"],
"filters": [
{
"field": "block_number",
"op": "eq",
"value": "<unknown>"
}
],
"limit": 20,
"offset": 0,
"sort": [
{
"field": "gas",
"order": "desc"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
source: 'agent.my_table',
fields: ['transaction_hash', 'from_address', 'value'],
filters: [{field: 'block_number', op: 'eq', value: '<unknown>'}],
limit: 20,
offset: 0,
sort: [{field: 'gas', order: 'desc'}]
})
};
fetch('https://api.asksurf.ai/gateway/v1/onchain/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{}
],
"meta": {
"cached": true,
"credits_used": 123,
"limit": 123,
"offset": 123,
"total": 123
},
"$schema": "https://example.com/schemas/DataResponseOnchainRow.json"
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"$schema": "https://example.com/schemas/DataAPIError.json"
}Body
application/json