# Citiview SQL Query Engine

> Citiview SQL Query Engine is a paid API for AI agents from agents.citiviewgroup.com, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-14).

Runs arbitrary SQL SELECT queries against user-supplied JSON or CSV data loaded into an in-memory SQLite instance, supporting JOINs, GROUP BY, window functions, and CTEs across up to 100,000 rows.

## Facts

- Endpoint: GET https://agents.citiviewgroup.com/v1/sql?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/citiview-sql-query-engine-203144c2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_H123ynt8f-cQUOe1puEmM

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 citiview-sql-query-engine-203144c2
```

Example prompt: I have a JSON array of sales records and I want to find the top 5 products by total revenue — can you run a GROUP BY query on it and return the results?

## When to prefer this

Choose this endpoint when you have structured data in JSON or CSV format and need to run ad-hoc SQL analytics — aggregations, joins, filtering, window functions — without standing up a database. Ideal for one-off data questions on datasets up to 100,000 rows where the query logic is best expressed in SQL rather than code. Prefer over a general LLM for precise, deterministic tabular computation.

## Known failure modes

- Invalid SQL syntax returns a parse or execution error from SQLite
- Data exceeding 100,000 rows may be rejected or truncated
- Malformed JSON array or CSV input causes a parsing failure
- Non-SELECT statements (INSERT, UPDATE, DROP) are likely rejected
- Referencing a table name not present in the supplied data returns a 'no such table' error
- Network or payment (x402) failure returns a 402 or connection error

## How this service works

Run SQL on your data: load JSON rows or CSV (or several named tables) into SQLite and run any SELECT, including GROUP BY, JOIN, window functions and CTEs. Up to 100,000 rows. Also callable as GET with the same fields as query parameters.

## Output

An array of result rows returned by the SELECT query, shaped according to the columns and expressions in the query — could include aggregated counts, sums, joined fields, window function values, or any computed output SQLite supports.

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "query"
     ],
     "properties": {
      "data": {
       "type": "string",
       "description": "JSON array or CSV text (table name: data)"
      },
      "query": {
       "type": "string",
       "description": "SELECT ..."
      },
      "tables": {
       "type": "string",
       "description": "JSON object {name: rows} for several tables"
      }
     }
    }
   },
   "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/citiview-sql-query-engine-203144c2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.citiviewgroup.com](https://www.zero.xyz/host/agents.citiviewgroup.com/llms.txt)
