HTTP API
The DEX HTTP API provides a programmatic REST interface that allows integrators to list the currently-available markets and currencies, prepare orders for transmission, and receive real-time updates about all orders placed on Somnia.
See also the WebSocket API for truly real-time communication with the DEX.
Note that, unlike some DEX services, the HTTP API is not sufficient to place an order - the client is expected to be able to connect to the Somnia network and transmit their order themselves. See the POST /v0/markets/{symbol}/orders method for more information.
Base URLs
Every REST endpoint is served under the /v0 path prefix. Pick the row for your target environment and prepend the base URL to the operation paths shown throughout these docs (e.g. GET /v0/markets becomes https://api.dreamdex.io/v0/markets).
| Environment | Chain ID | REST base URL | WebSocket public feed |
|---|---|---|---|
| Mainnet (Somnia) | 5031 | https://api.dreamdex.io/v0 | wss://api.dreamdex.io/v0/ws/public |
| Testnet (Somnia Shannon) | 50312 | https://stg.api.dreamdex.io/v0 | wss://stg.api.dreamdex.io/v0/ws/public |
The
/v0segment is required on both environments. Omitting it (e.g.https://stg.api.dreamdex.io/markets) returns a 404.
The examples in these docs use the mainnet base URL. To target testnet, substitute the staging base URL above (and the testnet contract addresses). The Quick Start parameterises this as a $BASE_URL shell variable so a single set of commands works against either environment.
For the live markets and currency codes accepted by {symbol} path parameters, see Markets and currency codes.