For the complete documentation index, see llms.txt. This page is also available as Markdown.

Exchange REST

Base URL: https://exchange.nexus.xyz/api/exchange

All routes except /health, /openapi.json, and /auth/login require HMAC authentication (see Quickstart → Sign requests). The complete machine-readable schema, including request/response bodies and CCXT method mappings, is at /openapi.json.

Conventions:

  • All monetary values are decimal strings.

  • On single-order routes, market_id is required as a query parameter — the engine routes directly to the owning market.

  • Authenticated requests carry X-API-Key, X-Timestamp, X-Signature. The timestamp must be within ±30s of server time.

Authentication & keys

Method
Path
Auth
Description

POST

/auth/login

EIP-191 wallet signature → 24h session Bearer token

POST

/keys

Session

Create an HMAC API key (key_id + secret; secret shown once)

GET

/keys

Session

List your API keys

DELETE

/keys/{id}

Session

Revoke an API key

POST

/ws-tokens

HMAC

Mint a 60s single-use token for a WebSocket subscription

Account

Method
Path
Auth
Description

GET

/account

HMAC

Balance, equity, margin used, margin ratio

GET

/account/summary

HMAC

Portfolio aggregates plus the withdrawable balance

GET

/account/state

HMAC

Portfolio summary and all open positions from one coherent read

GET

/account/fees

HMAC

Effective maker/taker fee schedule for the account

POST

/leverage

HMAC

Set the account's standing leverage for one market

GET

/account/portfolio-history?window=&limit=

HMAC

Equity / cumulative PnL / cumulative volume time-series

GET

/positions

HMAC

Open positions with unrealized PnL and per-position risk detail

POST

/account/credit

HMAC

Faucet synthetic USDX (testnet; up to 500/day per key)

GET

/account/{address}/adl-history?limit=

HMAC

Auto-deleveraging events where the account was target or counterparty

The portfolio routes and the enriched position fields are documented in full — including the nullable-field convention, the funding_paid sign, and why /account/state should be preferred over two separate calls — in Portfolio & Account State.

Orders

Method
Path
Auth
Description

POST

/orders

HMAC

Place an order — any of the eight order types

POST

/orders/batch

HMAC

Place multiple orders (sequential; results preserve request order)

POST

/orders/preview

HMAC

Project margin, equity, fee and liquidation impact without submitting

GET

/orders

HMAC

List open orders

GET

/orders/history

HMAC

Terminal-status order history

GET

/orders/{id}?market_id=

HMAC

Get a single order

PATCH

/orders/{id}?market_id=

HMAC

Amend an order (atomic cancel-replace; returns a new order id)

DELETE

/orders/{id}?market_id=

HMAC

Cancel a single order

DELETE

/orders?market_id=

HMAC

Cancel all open orders in a market

Order body fields: market_id, side (Buy/Sell), order_type, quantity, time_in_force (GTC/IOC/FOK/PostOnly), price (limit-family types only), and optional reduce_only.

order_type takes one of eight values — Limit and Market, plus six conditional types (StopLimit, StopMarket, TakeProfitLimit, TakeProfitMarket, TrailingStop, TrailingLimit). Which of price, trigger_price, trailing_offset_bps and limit_offset_bps a request needs depends on the type: see Order Types for the trader's view and Order Types for the full per-type requirement matrix.

Market data

Method
Path
Description

GET

/markets

List all live markets and their status

GET

/markets/summary

Mark price, 24h volume, trade count, status per market

GET

/markets/{id}/ticker

Last / bid / ask / volume / change

GET

/markets/{id}/orderbook

Level 2 order book depth

GET

/markets/{id}/trades

Recent trades

GET

/markets/{id}/candles

OHLCV candles (1m / 5m / 1h)

GET

/markets/{id}/funding

Funding rate history

GET

/markets/{id}/mark-price

Current mark price

GET

/markets/{id}/status

Active/halted, reason, timestamp, ADL count

GET

/markets/{id}/adl-events?limit=

Per-market auto-deleveraging history

GET

/tickers

All tickers in one call

GET

/stats, /stats/history

Exchange-wide stats

Streaming

Real-time order book, trade, and account updates are delivered over WebSocket, not REST. See the WebSocket API Reference.

Status: testnet preview. Endpoint set tracks the versioned OpenAPI spec at nexus-xyz/nexus-exchange-api; consult /openapi.json for the authoritative, current schema.

Last updated