# Relaystation SQL Query Engine

> Relaystation SQL Query Engine is a paid API for AI agents from api.relaystation.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Executes full SQL queries against CSV, JSON, or Parquet files using a sandboxed read-only DuckDB engine, returning results as Parquet

## Facts

- Endpoint: POST https://api.relaystation.ai/v1/data/sql
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/relaystation-sql-query-engine-7d56c646
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_yr5w61B3VnnwzXEnLXEKq

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 relaystation-sql-query-engine-7d56c646 -d '<json body>'
```

Example prompt: Run this SQL query against my sales data CSV — SELECT region, SUM(revenue) as total FROM data GROUP BY region ORDER BY total DESC — and give me back the results.

## When to prefer this

Choose this endpoint when you need to run arbitrary SQL analytics on flat files (CSV, JSON, Parquet) without spinning up a database. Ideal for agents doing ad-hoc data exploration, filtering, or aggregation on files available by URL. Prefer it over hosted database solutions when the data is file-based, the query is one-off, and cost-per-MB pricing is more economical than a persistent connection.

## Known failure modes

- Invalid SQL syntax returns a parse or execution error
- File URL unreachable or unsupported format returns an ingestion error
- Query exceeds memory or size limits returns a resource error
- Write operations (INSERT, UPDATE, DROP) rejected — read-only sandbox
- Malformed Parquet or corrupt CSV returns a file parsing error

## How this service works

$0.0005/MB. Query any CSV/JSON/parquet file with full SQL — sandboxed read-only DuckDB, parquet in and out. A serverless query engine for a fraction of a cent. 1¢ x402 min; remainder auto-credits — relaystation.ai/penny

## Output

Returns query results as a Parquet file (or structured tabular data), reflecting the rows and columns produced by the SQL statement executed against the input file. Pricing is $0.0005/MB of data processed, with a 1¢ minimum charge and any remainder auto-credited.

## 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",
     "properties": {
      "to": {
       "enum": [
        "csv",
        "json",
        "parquet"
       ],
       "type": "string",
       "description": "csv/json return inline text; parquet is binary (storage-ref output envelope)."
      },
      "sql": {
       "type": "string",
       "minLength": 1,
       "description": "The DuckDB SQL; your file is the table named `input`."
      },
      "file": {
       "type": "object",
       "description": "cputools input-source: { inline: <base64 ≤ 4 MiB> } or { inputKey: <scratch key from /v1/cputools/upload-url, ≤ 50 MB> }."
      },
      "from": {
       "enum": [
        "csv",
        "json",
        "ndjson",
        "parquet"
       ],
       "type": "string"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/relaystation-sql-query-engine-7d56c646/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.relaystation.ai](https://www.zero.xyz/host/api.relaystation.ai/llms.txt)
