Roundhouse SQL API

Read-only SQL for questions the fixed endpoints do not answer.

GitHub OpenAPI

Operations 1

POST /sql Read-only SQL over the public dataset #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/roundhouseai-io:roundhouseai-io-sql-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

roundhouseai-io-sql-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Roundhouse read SQL API
  version: '0'
  summary: The x402 settlement index and agent identity record, as JSON.
  description: 'Public, read-only, and free to start — no key required. Roundhouse indexes x402

    settlements and ERC-8004 identities into one queryable record.


    Two conventions worth knowing before you build against it:


    - **An empty array is an answer; a failure is not.** A refused query returns 503

    `upstream_unavailable` naming the resource, never 200 with an empty list. On a

    settlement index "no rows" would read as "nothing ever happened".

    - **Aggregates are per-entity.** Every figure is one wallet''s or one pair''s own. Site-wide

    totals are deliberately confined to the /stats page and are not served here.


    Cursor-paginated lists carry `next_before`; pass it back as `?before=`. The leaderboard is

    the exception and pages by `?offset=`.


    Every endpoint here is also a Model Context Protocol tool at `POST /v0/mcp`, gated by the

    same API key. See https://roundhouseai.io/docs/api/mcp.'
  license:
    name: Roundhouse terms
    url: https://roundhouseai.io/terms
  contact:
    name: Roundhouse
    url: https://roundhouseai.io/docs/api
servers:
- url: https://api.roundhouseai.io/v0
  description: Canonical base URL. The API worker on its own host, isolated from the dashboard.
- url: https://roundhouseai.io/api/v0
  description: The same API through the dashboard origin. Same responses, one more hop; needs no CORS from a browser on that origin.
tags:
- name: sql
  description: Read-only SQL for questions the fixed endpoints do not answer.
paths:
  /sql:
    post:
      operationId: runSql
      summary: Read-only SQL over the public dataset
      description: 'One `SELECT` (or `WITH`) over the public data-layer tables. Enforced in the database, not the worker: a read-only transaction as a role that can see only those tables, a statement timeout set by the TIER, and a hard 300-row cap. No semicolons, no comments, no multi-statement.


        Priced by the time it takes: one Query Unit per started 5 seconds, floor of 1 — so a query that answers quickly costs 1, which is what every query cost before this was metered. `tier` buys the ceiling (`standard` 15s, `extended` 60s and a paid plan); the tier maximum is HELD when the call starts and the unused part released the moment the duration is known, so `usage.units_charged` on the response is the settled figure. Call `get_account` for the tier table, or send `explain_only` to be quoted without running or paying for anything.'
      tags:
      - sql
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  rows:
                    description: Result rows.
                  row_count:
                    description: Number of rows returned.
                  duration_ms:
                    description: Server-side execution time. This is what the call is priced on.
                  authenticated:
                    description: Whether a key was accepted.
                  tier:
                    description: 'The CREDENTIAL: `anonymous`, `trial`, or an organization tier.'
                  sql_tier:
                    description: 'The QUERY: which ceiling this run was given and priced at. A separate field from `tier`, which has always meant the credential.'
                  quote:
                    description: 'What the query was quoted at before it ran: the tier''s ceiling and price bounds, plus the planner''s own `planner_cost` and `plan_rows`. The planner figures are ADVISORY — arbitrary units, uncalibrated against this schema — and never charge anything; settlement is from measured duration, which needs no calibration to be right.'
                  usage:
                    description: 'What this call cost and what is left. `units_charged` is SETTLED, not the hold: the tier maximum is taken up front and the unused part released once the duration is known.'
        '400':
          description: '`invalid_query` failed the sandbox checks, `invalid_json` malformed body, `invalid_parameter` an unknown `tier` or a bad `max_qu`, `over_max_qu` the tier could cost more than the caller allowed (nothing held, nothing ran), or `query_failed` ran and errored. A `query_failed` still carries `usage`: a query that ran consumed time, and it is settled by duration like a successful one — a syntax error costs the 1 QU floor, a statement timeout costs the whole tier it bought.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: '`invalid_api_key` — not found, revoked, or expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: '`insufficient_balance` — the organization cannot cover the tier MAXIMUM, which is what the affordability check is against. Carries `units_required`, `units_available`, `organisation` and an org-scoped `top_up_url`, and deliberately carries NO x402 `accepts`: a customer who has run out must be told to top up, never quietly charged their wallet instead. `payment_required` is the keyless x402 challenge, which does carry `accepts`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: '`tier_not_in_plan` — the organization may run SQL at `standard` and pay for it from its balance, but the tier it asked for needs a paid plan. Nothing was charged.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '`rate_limited` — per organization and per tier, since a long query holds a connection for as long as it runs.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '`upstream_unavailable` — the underlying query was refused. An empty array is a real answer; this is not one.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      requestBody:
        required: true
        description: '`sql` is the statement. `limit` caps rows and is itself clamped to 300. `tier` picks the ceiling (default `standard`; an unknown name is a 400, never a silent default). `max_qu` refuses the call before anything is held if the tier could cost more than that. `explain_only` returns the quote and charges nothing.'
        content:
          application/json:
            schema:
              type: object
            example:
              sql: select wallet, inbound_usd, inbound_count from mv_entity_rollups order by inbound_usd desc limit 10
              limit: 100
      security:
      - {}
      - bearerAuth: []
      - apiKeyHeader: []
components:
  schemas:
    Error:
      type: object
      description: Errors never echo the query or PostgREST's `details`/`hint`, both of which would leak the statement and its filter values.
      properties:
        error:
          type: string
          description: Stable machine-readable code.
        detail:
          type: string
          description: Human-readable explanation. May be absent.
      required:
      - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An `rh_live_…` key as a bearer token. Optional — raises rate limits.
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: The same key, as a header. Equivalent to the bearer form.