# Ironflow Custom SQL Query over Hyperliquid Data

> Ironflow Custom SQL Query over Hyperliquid Data is a paid API for AI agents from api.ironflow.sh, paid per call via x402, $0.01/call, status unknown (last checked 2026-11-19).

Executes arbitrary read-only SELECT SQL against Ironflow's full Hyperliquid dataset (fills, trades, liquidations, funding payments, candles, open interest, wallets) for the past year, returning up to 10,000 rows.

## Facts

- Endpoint: POST https://api.ironflow.sh/x402/v1/query?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/ironflow-custom-sql-query-over-hyperliquid-data-f4eb4134
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_peIv2yk0IjsgQyVJl6Gtg

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability ironflow-custom-sql-query-over-hyperliquid-data-f4eb4134 -d '<json body>'
```

Example prompt: Run a SQL query on Ironflow's Hyperliquid tables to give me the top 10 wallets by total realized PnL on ETH-USD perp fills over the last 30 days — join the fills and trades tables and return up to 500 rows.

## When to prefer this

Use this endpoint when no single Ironflow pre-built endpoint answers the question — specifically when you need custom aggregations, multi-table joins, wallet cohort analysis, backtest dataset construction, or any analytical query that spans multiple data types (fills + liquidations + funding). It subsumes all other Ironflow endpoints at higher cost and latency but with full SQL flexibility. Prefer dedicated endpoints for simple single-metric lookups.

## Known failure modes

- INVALID_PARAMETER: malformed SQL, referencing non-existent hl.* table, or missing 'sql' field
- HISTORY_OUT_OF_RANGE: query references data older than one year
- QUERY_WINDOW_EXCEEDED: query exceeds 30-second execution limit or 10,000 row cap
- RATE_LIMIT_EXCEEDED: too many queries in a short window
- INTERNAL_ERROR: ClickHouse or Ironflow infrastructure failure
- Payment failure: x402 payment of $0.01 USDC not completed before query executes

## How this service works

Read-only ClickHouse SQL over Ironflow's Hyperliquid tables: every fill, trade, liquidation, funding payment, candle, open interest reading and wallet of the last year (hl.* tables; GET /v1/query/schema lists them for free). Use it when no single endpoint answers the question: custom aggregations, joins, wallet cohorts or backtest datasets. Up to 30 s and 10,000 rows a query.

## Output

Returns a JSON object with a 'columns' array of column name strings and a 'rows' array of arrays (each inner array is one result row in column order). On error, returns an 'error' object with a machine-readable code (e.g. INVALID_PARAMETER, HISTORY_OUT_OF_RANGE, QUERY_WINDOW_EXCEEDED, RATE_LIMIT_EXCEEDED, INTERNAL_ERROR), a human-readable message explaining what went wrong and how to fix it, and optionally an 'upgrade' object indicating how to lift the limit.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "sql"
     ],
     "properties": {
      "sql": {
       "type": "string",
       "description": "One SELECT over hl.* tables"
      },
      "max_rows": {
       "type": "integer",
       "description": "Most rows to return, up to 10000"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "rows": {
       "type": "array",
       "items": {
        "type": "array"
       },
       "description": "Rows, each an array in column order"
      },
      "error": {
       "type": "object",
       "properties": {
        "code": {
         "type": "string",
         "description": "Machine-readable code: INVALID_PARAMETER, HISTORY_OUT_OF_RANGE, QUERY_WINDOW_EXCEEDED, RATE_LIMIT_EXCEEDED, NOT_FOUND, INTERNAL_ERROR"
        },
        "message": {
         "type": "string",
         "description": "What went wrong and how to fix the request"
        },
        "upgrade": {
         "type": "object",
         "properties": {},
         "description": "On a limit error: the plan or paid call that lifts it"
        }
       },
       "description": "Present instead of the data on a 4xx or 5xx answer."
      },
      "columns": {
       "type": "array",
       "items": {
        "type": "string",
        "description": "Column"
       },
       "description": "Column names"
      }
     },
     "description": "Query result"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/ironflow-custom-sql-query-over-hyperliquid-data-f4eb4134/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.ironflow.sh](https://www.zero.xyz/host/api.ironflow.sh/llms.txt)
