Skip to Content
ReferenceBackend API

Backend API

The backend is an Express app serving five routers under /api, plus a live Swagger UI.

Health checkGET /health{ "status": "ok" }
Interactive docsGET /docs (Swagger UI)

The Swagger UI at /docs is generated from the live OpenAPI spec and is the authoritative reference for request and response schemas. This page lists the surface; go there for field-level detail.

Errors are returned as { "error": "<message>" } with status 400.

/api/dark-engine

The order book and matching engine.

MethodPathPurpose
POST/ordersSubmit an order’s private details for matching
GET/ordersList resting orders
GET/matchesList matches
GET/matches/:idFetch one match
GET/matches/:id/proof-inputsPublic and private inputs for the match_orders proof
POST/matches/:id/proofSubmit a generated proof for settlement

POST /orders is what the Swap page calls after the on-chain placeOrder() confirms. The order is already placed and authorized by then — this only makes it findable for matching, which is why a failure here is reported separately rather than as an order failure.

/api/pricing

Live rates sourced from Flare’s FTSOv2.

MethodPathPurpose
GET/All supported asset prices
GET/:fromAsset/:toAssetRate for one pair

The matcher uses these to size fills, so the realized rate for a filled portion is the fair rate by construction.

/api/compliance

Sanction screening. See Compliance for the trust model.

MethodPathPurpose
POST/screenSubmit an address for screening
GET/:addressRead the current screen result

A clear result must be on file in ComplianceRegistry before that address can receive a withdraw.

/api/relayer

MethodPathPurpose
POST/relaySubmit a transaction for relaying

Relaying lets a proof be submitted by an address other than the one it benefits, so exiting the pool doesn’t require the destination address to hold gas. withdraw’s recipient is a public circuit input, so a relayer cannot redirect the payout.

/api/auth

MethodPathPurpose
POST/passkey/challengeIssue a WebAuthn challenge
POST/passkey/verifyVerify a passkey assertion

What the backend never holds

It has no custody and no authority over funds. Every state change to the vault requires a valid zero-knowledge proof verified on-chain. The backend keeps an order book, computes fill proposals, and relays — none of which the contracts take on trust.