API overview
The Mesh Server exposes a JSON REST API under /api/v1 and a WebSocket stream at /ws for quotes, intents, pools and market data.
Base URL
$MESH_URL/api/v1
Locally the server listens on port 3001. See Networks & endpoints.
Conventions
- JSON in, JSON out. Send
Content-Type: application/jsonon writes. - Amounts are integer strings in base units (sats for BCH). Never floats.
- BCH is
0xin requests andBCHin responses; tokens are 64-hex category ids. - Times are unix seconds. Covenant times are chain time (MTP).
- Errors are
{ "error": "message" }with a meaningful HTTP status. See Errors.
Endpoints
| Group | Endpoints |
|---|---|
| Quotes | POST /quote |
| Intents | POST /intent/create · GET /intent/:id · GET /intent · GET /intent/active · GET /intent/all · POST /intent/:id/cancel · POST /intent/:id/refund · POST /intent/match |
| TWAP | POST /twap/quote · POST /twap/submit · GET /twap/active · GET /twap/address/:address · GET /twap/:orderId · POST /twap/:orderId/cancel |
| Pools | GET /positions · GET /positions/:ownerPkh · POST /positions · POST /positions/batch · GET /positions/utxo/:txid/:vout · GET /positions/:txid/fills · GET /positions/address/:address/fills · POST /positions/dock · POST /positions/dock-all |
| Market data | GET /orderbook · GET /orderbook/pairs · GET /tokens · GET /bcmr/:category · POST /bcmr/batch · GET /oracle/prices · GET /oracle/pairs · GET /oracle/payload |
| LP tools | POST /rebalance/quote |
| Cauldron | POST /cauldron/build-trade · POST /cauldron/record-swap |
| Admin | GET/POST /admin/* (requires x-admin-key) |
| Health | GET /health · GET /api/v1/stats |
Stream
ws(s)://<host>/ws # also /ws/v1/liquidity-stream
Intent lifecycle events are broadcast to every client; orderbook:<pair> and fills are subscription channels. See WebSocket stream.
Note: Legacy aliases For older frontends the server also mounts
/intent,/tokens,/bcmr,/cauldron,/adminand/router/quotewithout the/api/v1prefix. New integrations should use/api/v1.