SQL query preflight

POST/gateway/v1/onchain/sql/preflight

curl -X POST https://api.orthogonal.com/v1/run \
-H 'Authorization: Bearer orth_live_••••' \
-H 'Content-Type: application/json' \
-d '{
"api": "surf",
"path": "/gateway/v1/onchain/sql/preflight",
"method": "POST",
"body": {
"max_rows": ,
"sql": ""
}
}'
{
"success": true,
"data": {
"data": { … },
"meta": { … },
"$schema": "https://api.asksurf.ai/schemas/DataObjectResponseOnchainSQLPreflight.json"
}
}
A real response, recorded when Orthogonal checked this endpoint.

The final charge depends on what comes back. It shows after Run.

up to$0.03924per call

Response-basedThe price is worked out from the usage reported in the response, never more than $0.03924 per call.

You aren't charged for failed calls. A wallet payment for a failed call is refunded.

About this endpoint

Preflight Blockchain SQL Query: Validate and estimate a read-only ClickHouse query before executing it. This endpoint runs EXPLAIN ESTIMATE and does not execute the submitted query. It returns: - Logical schema plus bounded physical source metadata - Partition, sorting, and primary-key expressions - Estimated parts, rows, marks, and bytes - The final server-bounded SQL and scan budgets - Machine-readable guardrail warnings with recommended actions Use GET /v1/onchain/schema?table=<name> for metadata-only discovery. Preflight accepts the same JSON shape and SQL safety rules as POST /v1/onchain/sql, but missing pruning filters are returned as structured rejection warnings rather than running the query. The planner rejects address columns wrapped in lower() and transfer-table predicates that combine from and to with OR. Normalize address literals before submission, compare stored lowercase columns directly, and split incoming/outgoing transfer predicates into projection-fri

Body parameters

Response types

More from Surf API

  1. KOL rankingGET/gateway/v1/smart-money/kol/ranking$0.01308 per callFixed
  2. Liquidation chartGET/gateway/v1/market/liquidation/chart$0.01308 per callFixed
  3. Blockchain SQL queryPOST/gateway/v1/onchain/sql$0.02616 per callFixed
  4. KOL call historyGET/gateway/v1/smart-money/kol/history$0.01308 per callFixed
  5. Order book depthGET/gateway/v1/exchange/depth$0.00654 per callFixed
  6. Latest company financialsGET/gateway/v1/equity/latest-financialsUp to $0.03924 per callResponse-based
  7. Web page fetchGET/gateway/v1/web/fetch$0.00654 per callFixed
  8. Matched market pairsGET/gateway/v1/prediction-market/matching/pairs$0.02616 per callFixed
  9. Polymarket wallet positionsGET/gateway/v1/prediction-market/polymarket/positions$0.02616 per callFixed
  10. Hyperliquid trader leaderboardGET/gateway/v1/hyperliquid/leaderboard$0.02616 per callFixed
  11. Perpetual contract snapshotGET/gateway/v1/exchange/perp$0.00654 per callFixed
  12. KOL activityGET/gateway/v1/smart-money/kol/activity$0.01308 per callFixed
All 145 Surf API endpoints