Roundhouse X402 API
Paying for a Roundhouse resource over x402.
Paying for a Roundhouse resource over x402.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/roundhouseai-io:roundhouseai-io-x402-api"
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.
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: 3.2.0
info:
title: Roundhouse read X402 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: X402
description: Paying for a Roundhouse resource over x402.
paths:
/queries/{slug}/results:
get:
operationId: runSavedQuery
summary: Run a saved query — pay per call, or use an API key
description: 'Executes a published saved query and returns its rows. Two ways to pay for one URL: attach an API key and the run is metered in Query Units against your organization, or attach nothing and it answers `402` with standard x402 requirements — settle that and the rows come back, with no account and no key. Only queries whose author has enabled agent calls are payable; the rest need a key. Declared parameters are passed in the query string and are validated BEFORE any payment is taken, so a bad value costs a `400` rather than a settlement.'
tags:
- X402
responses:
'200':
description: Success.
content:
application/json:
schema:
type: object
properties:
query:
description: The slug and name of what ran.
parameters:
description: The values it ran at, after defaults were applied.
columns:
description: Column names, in order.
rows:
description: The result rows.
row_count:
description: How many rows came back.
row_cap:
description: The server's ceiling, so a full page is distinguishable from a truncated one.
truncated:
description: '`true` when the answer hit `row_cap`.'
paid_with:
description: '`x402`, `api_key` or `trial_key`.'
settlement:
description: The transaction hash, when the call was paid over x402.
'400':
description: A parameter value does not match its declared type, or the query itself failed.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: The API key is unknown, or the query is not published for x402 calls.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'402':
description: No payment attached (the normal first response), or the facilitator rejected it.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: No such query, or it is private and not yours.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
description: Rate limited.
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'
parameters:
- name: slug
in: path
required: true
description: The query's slug, from its page at `/queries/<slug>`.
schema:
type: string
security:
- {}
- bearerAuth: []
- apiKeyHeader: []
/test/x402:
get:
operationId: testX402
summary: x402 test drive — pay $0.01, get an API key
description: 'A real paywalled resource. Called without payment it answers `402` with standard x402 requirements, which is the cheapest way to see a live challenge. Pay it and it mints a 30-day trial API key (2 reads/minute, or 10/min when the paying wallet has registered identity) and returns `quick_start`: the exact `Authorization: Bearer ` header, a GET /v0/account request that succeeds with that key, what that 200 looks like (`authenticated: true`, `tier: "trial"`), a POST /v0/sql example (a trial key alone answers 402 — SQL is $0.005 per query, not included), and a docs link. It also advertises KYA and accepts a memo in `X-PAYMENT-MEMO`.'
tags:
- X402
responses:
'200':
description: Success.
content:
application/json:
schema:
type: object
properties:
paid:
description: '`true` once settled.'
api_key:
description: The key, returned exactly once — only its hash is stored.
tier:
description: The key's tier.
expires_at:
description: When the key stops working.
limits:
description: Per-minute query limits for this key and for anonymous callers.
payment:
description: Network, payer, payTo, asset, amount, transaction hash and facilitator.
quick_start:
description: 'A ready-to-run first call: `auth_header`, `first_call` (GET /v0/account, succeeds with this key), `sql` (POST /v0/sql shape; 402 with the trial key alone), and `docs`. Added alongside the existing fields.'
'402':
description: No payment attached (the normal first response), or the facilitator rejected it.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: '`key_already_issued` — that settlement already bought a key.'
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'
/topup:
get:
operationId: topupQueryUnits
summary: Top up Query Units over x402
description: 'Self-serve Query Unit purchase for organization API keys. Send your org key and no payment and the answer is a `402` pricing the requested `?usd=`; resend with `X-PAYMENT` and the settled USDC is credited to the key''s organization at 200,000 QU per $1. One settlement credits exactly once — a replayed payment answers `409`. Trial keys are refused: they hold no Query Unit balance. Card top-ups live in the dashboard at /dashboard/billing.'
tags:
- X402
responses:
'200':
description: Success.
content:
application/json:
schema:
type: object
properties:
paid:
description: '`true` once settled and credited.'
credited_qu:
description: Query Units credited by this settlement.
new_balance:
description: The organization's balance after the credit.
rate_qu_per_usd:
description: The published conversion rate.
payment:
description: Network, payer, payTo, asset, amount, transaction hash and facilitator.
'400':
description: '`key_not_org_scoped` — a trial key has no organization to credit.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: '`api_key_required` or `invalid_api_key`.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'402':
description: No payment attached (the normal first response), or the facilitator rejected it.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: '`topup_already_credited` — that settlement already credited Query Units.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: '`topup_credit_failed` — settled on-chain but not credited; quote the transaction hash to support.'
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'
parameters:
- name: usd
in: query
required: false
description: Amount in USD, up to two decimals. Min $1, max $1,000, default $10; anything unreadable falls back to the default rather than guessing upward.
schema:
type: string
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.