Magma DEX

Developer & Integration Documentation

The technical package for third-party integrators. Every page here is derived from the Magma DEX backend as implemented — capabilities that do not exist are marked as not implemented rather than described aspirationally.

REST base URL
https://api.magmadex.trade
WebSocket
wss://api.magmadex.trade/ws
Auth scheme
Bearer JWT (EIP-712 sign-in)
OpenAPI
v0.2.0 · 66 paths · 109 KB

Start heredocs/integration/README.md

Magma DEX — Integration Documentation

Technical package for third-party integrators, covering the currently available Magma DEX API surface: authentication, spot markets, trading, balances, deposits and withdrawals, WebSocket streaming and error handling.

Every page here is written against the backend as implemented. Where a capability does not exist it is stated as not implemented rather than described aspirationally.

Scope

Magma is a spot exchange. All 32 listed markets are spot. Perpetual futures, leverage, margin and funding are not current functionality; /v1/perps/account/{address} is retained for compatibility and reports empty for every address.

What this API does not have, so you do not go looking for it:

Not availableUse instead
API-key authenticationEIP-712 wallet signature → JWT (authentication.md)
Swap / quote / route endpointsPOST /v1/orders against the order book
Liquidity pools, LP tokens, LP positionsMagma is a CLOB. Magma Earn is a separate pooled market-making product
Webhooks / callbacksThe WebSocket stream (events-and-websocket.md)
A published SDK packageCall the REST API directly, or generate a client from the OpenAPI document
First-party 24 h traded volumeDerive from /v1/trades/{market} — see the volume note in endpoint-inventory.md

Contents

DocumentCovers
endpoint-inventory.mdEvery route, its method, auth requirement and rate limit, split into Public / Authenticated / Admin
authentication.mdEIP-712 challenge → JWT → refresh rotation; admin authorization; token lifetimes
wallet-and-settlement-flows.mdWallet connect, network selection, deposit, withdrawal, balances, trade execution, on-chain settlement
events-and-websocket.mdThe WebSocket protocol and its message types
errors.mdStatus codes, error bodies, verbatim error strings and the recommended client action for each
environments.mdProduction environment details — base URLs, supported chains, configuration
MULTX_MAGMADEX_INTEGRATION.mdUsing Magma DEX alongside an external bridge provider (MultX): architecture boundary, required APIs, the deposit-to-trade flow
../openapi.yamlOpenAPI 3.1 specification

Trading model

Magma DEX is a central limit order book (CLOB). Trading is POST /v1/orders against a resting order book, with price protection via a maxSlippageBps cap on market orders. See MULTX_MAGMADEX_INTEGRATION.md § Architecture boundary for how this fits with an external bridge/funding provider.

Two documents, two purposes

Both are current. They are generated differently and are authoritative for different things — use them together.

Generated SwaggerThis package + openapi.yaml
Wherehttps://api.magmadex.trade/docs (UI), /docs/json (raw)https://magmadex.trade/docs, /docs/openapi.yaml
Produced by@fastify/swagger, from the live route schemasHand-maintained in this repository
Authoritative forRequest/response JSON shapes — emitted from the very objects Fastify validates againstAuth semantics, rate limits, error strings, and the public/authenticated/admin split

Note the two different /docs paths: on the API domain it is Swagger UI; on the web app domain it is this package. See environments.md for the full URL table, including a caution about the separate docs.magmadex.trade site.

To generate a client, download /docs/openapi.yaml or pull /docs/json from the running API.