Find something... ⌘K

API reference / About the API

Authentication

How to send your Maxy API key, which key to use where, and what the API answers when a key is missing or wrong. Read it before you write your first call, and again before you put a key in a web page.

Send the key

Every call takes your key in a header, in either of two forms. Both reach the same check.

curl Copy
curl -s -H "x-maxy-key: $MAXY_API_KEY" "$BASE/key" curl -s -H "Authorization: Bearer $MAXY_API_KEY" "$BASE/key"
json Copy
{ "key": "mxk_test_sJAL2u…", "kind": "secret", "scopes": ["read", "quote", "place", "orders", "webhooks", "account"], "origins": [], "orderCapUsd": 100, "sandbox": true }

A key never goes in a URL. A query value that is a secret key answers 400 invalid_input and nothing is done, because a URL lands in logs and browser history. A browser opening a stream sends a ticket instead: see Quote routes.

Keys

Maxy issues every key and keeps only a hash of it, so it is shown once. Each is a prefix and 32 letters and digits.

PrefixKindWhere it runs
mxk_live_Secret, liveYour server
mxk_test_Secret, test: the sandboxYour server, your laptop
mxk_pk_live_Publishable, liveYour web page, on its origins
mxk_pk_test_Publishable, testYour web page, on its origins

The key alone picks the environment. The base URL and the routes are the same; a test key's answers carry "sandbox": true and the header X-Maxy-Sandbox: true.

Secret and publishable keys

A secret key can do everything your integration needs. A publishable key reads, quotes and places the user's own signed order, so a page can run a whole buy, and nothing more. Each order still needs the user's wallet to sign it.

ScopeWhat it coversSecretPublishable
readChains, tokens, pairs, address checks, limits, an order's statusyesyes
quotePrices, quotes, batches, price streamsyesyes
placePOST /orders, /orders/submit, an order's signature, steps and cancelyesyes
ordersGET /orders, POST /orders/watch, GET /orders/{id}/eventsyesno
webhooksEvery webhook routeyesno
accountKeys, usage, statements, cap requestsyesno

GET /key and GET /limits list a key's scopes. A publishable key outside its scopes answers 403 scope_denied. The SDK refuses to start in a browser page with a secret key.

Allowed origins

A publishable key is bound to the browser origins Maxy issued it for, such as https://app.example.com. The browser sends the page's origin with each call, and a call from any other origin answers 403 origin_not_allowed. So does a call from a server, which sends no origin: from a server, use the secret key.

An origin check stops another site from using your key in a browser. It cannot stop a server that claims to be your site, so a publishable key is worth no more than its rate limit. Change the origins with POST /keys/{prefix}/origins: see Key security.

Routes without a key

These answer with no key, because they hold no data of yours or must work before you have a key. The list is the OpenAPI document's own (security: []):

RouteWhat it is
GET /Every route, and the command that gets a test key
POST /sandbox/keysA test key and a test publishable key, with no sign-up
GET /checkout/verifyHosted checkout: is this signed URL what the partner signed
POST /feedbackDocs feedback
POST /security-reportsReport a security issue
GET /system/statusEvery component now, open incidents, upcoming maintenance
GET /system/historyEach component per day
GET /system/incidentsIncidents with their notes and postmortems
GET /system/maintenanceThe maintenance calendar
GET /system/verifiedThe last end-to-end run through every failure branch on the sandbox
GET /system/feed.xmlIncidents as RSS
POST /system/subscribeStatus notices by webhook or email
GET /system/confirmConfirm an email subscription
GET /system/unsubscribeStop status notices
GET /openapi.jsonThis API as OpenAPI 3.1
GET /pingLiveness only: answers at once and reads nothing
GET /configWhat a router's intake asks for, in one answer
GET /healthThe solver, Bitcoin and each chain's verifier, with a degraded flag

Sending a key to these is allowed; it is checked and counted.

When the key is wrong

You sentHTTPcode
No key401auth_required
A malformed or cut-off key, or one Maxy did not issue401invalid_api_key
A revoked key403key_revoked
A publishable key outside its scopes403scope_denied
A publishable key from another origin, or from a server403origin_not_allowed
A secret key in a URL400invalid_input
curl Copy
curl -s "$BASE/key"
json Copy
{ "error": { "code": "auth_required", "message": "GET /key takes your Maxy API key in the x-maxy-key header (or Authorization: Bearer mxk_live_…). Every route does, apart from /health, the status page and getting a test key, which needs no sign-up: curl -X POST https://openapi.maxy.co/v1/sandbox/keys", "retryable": false, "docs": "https://maxy.co/docs/error-codes#auth_required" }, "requestId": "…" }

None of these is retryable: fix the key, then call again. Every code is on Error codes. The samples use BASE and MAXY_API_KEY from Get a price. To keep keys safe, rotate them and revoke a leaked one, read Key security.