Technical Documentation

API Reference

The Open Mandi API provides RESTful endpoints for account management, wallet operations, trading, and transparency data. WebSocket feeds are available for real-time market data.

Base URL

https://api.openmandis.com/api/v1  (Coming Soon)

Authentication

Authenticated endpoints rely on an HTTP-only __session cookie that is set by the login endpoint and verified server-side on each request.

After a successful Google sign-in, the __session cookie is automatically sent by the browser on subsequent requests to authenticated routes. You do not need to send an Authorization header with a Bearer token for these endpoints.

For non-browser clients, you must preserve and include the __session cookie returned by the login endpoint in follow-up requests. Session cookies expire after 5 days.

Rate Limiting

Endpoint CategoryRate Limit
Public (market data)60 requests/minute
Authenticated (read)120 requests/minute
Authenticated (write)30 requests/minute

REST Endpoints

Authentication

MethodPathDescription
POST/auth/registerCreate a new account
POST/auth/loginAuthenticate and receive token
POST/auth/logoutInvalidate current session
GET/auth/sessionGet current session info

Wallet

MethodPathDescription
GET/walletGet balances (USDT and USDC)
GET/wallet/transactionsGet transaction history
POST/wallet/depositInitiate a deposit (max $5, balance < $1)
POST/wallet/withdrawInitiate a withdrawal (balance >= $10)

Stablecoin Exchange (USDT/USDC)

MethodPathDescription
GET/orderbook/usdt-usdcGet current order book
GET/exchange/tradesGet recent trades
POST/exchange/orderPlace a buy/sell order
DELETE/exchange/order/:idCancel an open order
GET/exchange/ordersGet user's open orders

Futures Trading

MethodPathDescription
GET/orderbook/:symbolGet order book (xau or xag)
POST/trade/:symbol/orderPlace a futures order
DELETE/trade/order/:idCancel a futures order
GET/positionsGet all open positions
POST/positions/:id/closeClose a position
GET/trade/historyGet trade history

Transparency (Public)

MethodPathDescription
GET/transparency/statsPlatform-wide statistics (no auth required)
GET/transparency/feesFee revenue breakdown
GET/transparency/volumeTrading volume by market and time period

WebSocket Feeds

WebSocket URL: wss://api.openmandis.com/ws  (Coming Soon)

Subscription channels:
  - orderbook:<symbol>     Real-time order book updates
  - trades:<symbol>        Real-time trade feed
  - ticker:<symbol>        Price ticker updates
  - positions              User position updates (authenticated)

Error Codes

CodeDescription
400Bad Request — invalid parameters
401Unauthorized — invalid or expired token
403Forbidden — insufficient permissions
404Not Found — resource does not exist
409Conflict — e.g., duplicate order, balance insufficient
422Unprocessable Entity — business rule violation (deposit limit, withdrawal threshold)
429Too Many Requests — rate limit exceeded
500Internal Server Error

Full request/response examples with payloads will be added as each endpoint is implemented.