# QuickNode SQL REST Query

> QuickNode SQL REST Query is a paid API for AI agents from x402.quicknode.com, paid per call via x402, $10/call, status unknown (last checked 2026-09-15).

Executes a SQL query against QuickNode's SQL API via a paid SIWX-authenticated REST pass-through, debiting credits from a pre-funded balance

## Facts

- Endpoint: POST https://x402.quicknode.com/sql/rest/v1/query
- Price: $10/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402, compute
- Canonical page: https://www.zero.xyz/c/quicknode-sql-rest-query-f3662da9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_eJxG8HCl5Ex1eHBM4j2oc

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 quicknode-sql-rest-query-f3662da9 -d '<json body>'
```

Example prompt: Run this SQL query against QuickNode's SQL API and return the results: SELECT block_number, transaction_hash, value FROM ethereum.transactions WHERE from_address = '0xABC123' ORDER BY block_number DESC LIMIT 10

## When to prefer this

Choose this endpoint when you need to run structured SQL queries against QuickNode's blockchain data via a pay-as-you-go credit model authenticated with SIWX. Ideal for on-chain analytics, blockchain data extraction, and querying indexed blockchain datasets without managing your own infrastructure. Prefer this over raw RPC endpoints when you need relational/SQL-style access to blockchain data.

## Known failure modes

- Insufficient drawdown balance — query rejected if SIWX-authenticated account lacks sufficient pre-funded SQL credits
- Authentication failure — missing or invalid SIWX credentials result in 401/403
- Malformed SQL query — syntax errors return a 400 with error details
- Query timeout — complex or expensive queries may time out
- Per-request PAYMENT-SIGNATURE not accepted — using wrong auth method results in rejection
- Rate limiting — excessive requests may be throttled

## How this service works

Paid REST pass-through to `https://api.quicknode.com/sql/rest/v1/query`. Variable cost: the upstream response body's `credits` field is debited 1:1 from the caller's SIWX-authenticated drawdown balance (one SQL credit = one drawdown credit). Per-request `PAYMENT-SIGNATURE` is NOT accepted — callers must authenticate via SIWX and pre-fund credits.

## Output

Returns a JSON object containing the query result rows and a 'credits' field indicating how many SQL credits were consumed (debited 1:1 from the caller's pre-funded drawdown balance).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "description": "Pass the SQL query and any parameters as JSON; consult QuickNode SQL docs for the body shape (`{ \"query\": \"...\", \"params\": {...} }`).",
 "additionalProperties": true
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "credits": {
   "type": "number",
   "description": "SQL credits consumed by this query (debited 1:1 from drawdown balance)."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/quicknode-sql-rest-query-f3662da9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.quicknode.com](https://www.zero.xyz/host/x402.quicknode.com/llms.txt)
