Find something... ⌘K

API reference / About the API

OpenAPI document

The Maxy HTTP API describes itself as OpenAPI 3.1 at GET /openapi.json. Use it to generate a typed client in your language, or to check your own code against each answer's shape. It needs no key.

Get it

curl Copy
curl -s "$BASE/openapi.json" -o maxy-openapi.json jq '{openapi, title: .info.title, version: .info.version, paths: (.paths | length), webhooks: (.webhooks | keys)}' maxy-openapi.json
json Copy
{ "openapi": "3.1.0", "title": "Maxy API", "version": "1.8.0", "paths": 61, "webhooks": ["order.payment_replaced","order.updated"] }

The document is served from the API itself, so it always matches the routes that answer. It holds:

PartWhat is in it
pathsEvery route (65 operations): an operationId and tags on each, every parameter and body described, and its own answers, errors included. Each error answer lists its codes in x-error-codes
tagsThe route groups: Prices and quotes, Orders, Chains and tokens, Webhooks, Keys and account, Sandbox, System and Checkout and feedback
components.schemasThe shared shapes, referenced from the paths by $ref: ErrorCode, TypedData, Asset, Error, Chain, Token, Pair, AddressCheck, Health, Limits, Key, Price, Quote, Signing, Status, OrderRow and OrderEvent. ErrorCode lists every error code
components.securitySchemesapiKey, the x-maxy-key header, and streamTicket, the ticket query value the two streams take from a browser
webhooksorder.payment_replaced and order.updated: the signed events Maxy posts to your endpoint
serversThe base URL
infoThe title, version (1.8.0) and the licence (MIT)

GET / lists the same routes in a shorter form, each with whether it takes a key.

Versions

The version sits in the base URL, https://openapi.maxy.co/v1, and routes under it carry none: $BASE/price, $BASE/orders/{id}. The API is generally available (v1). info.version is the document's own version, 1.8.0: its major is the API's (1, the /v1 in the URL), its minor goes up when the document gains a route, field, parameter, enum value or error code, and its patch when only text or examples change. Any change to the document raises it, so a client generated from one version matches every answer of that version. The API only gains fields and routes, so ignore any field you do not know. Since general availability, a breaking change comes as /v2, announced to every key holder at least 90 days ahead; releases before it are pre-GA (Stability), and every change is in the changelog.

Headers on every answer

HeaderWhat it says
x-request-idThe id of this call, also requestId in an error body. Send your own, 8 to 64 letters, digits, ., _ or -, and the answer keeps it
Server-Timingtotal;dur=<ms>: how long Maxy took
RateLimit-Limit, RateLimit-Remaining, RateLimit-ResetYour limit a minute, what is left, and seconds until the window has room
Retry-AfterOn a 429: seconds to wait
X-Maxy-Sandboxtrue on every answer to a test key
Idempotent-Replayedtrue when an Idempotency-Key you sent before answered again: see Order routes

A browser can read all of them: the API lists them in Access-Control-Expose-Headers.

curl Copy
curl -s -D - -o /dev/null -H "x-maxy-key: $MAXY_API_KEY" -H "x-request-id: order-1042.try-1" "$BASE/key" \ | grep -iE '^(x-request-id|server-timing|ratelimit|x-maxy-sandbox)'
text Copy
ratelimit-limit: 120 ratelimit-remaining: 117 ratelimit-reset: 60 server-timing: total;dur=47 x-maxy-sandbox: true x-request-id: order-1042.try-1

Log x-request-id with every call, and quote it when you write to Maxy.

Generate a client

Any OpenAPI 3.1 generator reads the document. Two that run as shown, with a test key in MAXY_API_KEY:

TypeScript, with openapi-typescript and openapi-fetch (both MIT). The generator needs TypeScript 5.

curlTypeScript
Copy
npm install openapi-fetch && npm install -D openapi-typescript typescript@5 npx openapi-typescript "$BASE/openapi.json" -o maxy-api.d.ts

Python, with openapi-python-client (MIT). --meta none writes the module alone, next to your code. Each tag is a module and each operationId a function in it. The generator skips one route, GET /system/feed.xml, whose answer is XML; every other route is generated.

curlPython
Copy
pip install openapi-python-client httpx attrs python-dateutil openapi-python-client generate --url "$BASE/openapi.json" --meta none --output-path maxy_api_client

A generated client gives you types and nothing else. The TypeScript SDK also checks what the wallet signs, retries safely and runs whole orders: use it where it fits. Every route, grouped, starts at API routes.