Skip to main content

Base URL

https://api.pmx.trade
All CLOB REST endpoints are prefixed with /v2/clob. WebSocket connections use /v2/ws/.

Quick Reference

REST API

16 endpoints for markets, orders, fills, positions, and account management. All responses are JSON.

WebSocket

Two realtime channels — public market data and user events.

Deposit-Based Trading

Deposit USDC into an on-chain smart wallet. Orders are signed messages — no gas to place or cancel. Withdraw anytime.

On-Chain Settlement

Matched trades settle atomically on Solana. Every fill has a verifiable transaction.

Identity & Authentication

The API is public — there are no session tokens or JWTs. User identity is established through:
  • Ed25519 signed order messages — proves ownership when placing orders (verified on-chain during settlement)
  • Ed25519 signed cancel messages — proves ownership when cancelling orders (format: PMX Cancel:<orderId>)
  • pubkey query/body parameter — used for read endpoints (balances, orders, fills) — no signature needed since this data is public on-chain

Rate Limits

Request TypeLimit
Read requests (GET, HEAD)600 requests/minute per IP
Write requests (POST, PUT, DELETE)300 requests/minute per IP
If you hit the rate limit, you’ll receive a 429 response with a Retry-After header.

REST Endpoints

Markets

MethodEndpointDescription
GET/v2/clob/marketsList all markets with prices
GET/v2/clob/markets/{marketId}Get market details
GET/v2/clob/markets/{marketId}/orderbookGet orderbook depth
GET/v2/clob/markets/{marketId}/tradesGet recent trades

Orders

MethodEndpointIdentityDescription
POST/v2/clob/ordersSigned orderPlace an order
GET/v2/clob/orders?pubkey=Pubkey paramList your orders
GET/v2/clob/orders/{orderId}PublicGet order details
POST/v2/clob/orders/{orderId}/cancelSigned cancelCancel an order

Account

MethodEndpointIdentityDescription
GET/v2/clob/account/setup?pubkey=Pubkey paramCheck account readiness
POST/v2/clob/account/depositPubkey bodyDeposit USDC to smart wallet
POST/v2/clob/account/withdrawPubkey bodyWithdraw USDC from smart wallet
GET/v2/clob/account/balances?pubkey=Pubkey paramGet balances
POST/v2/clob/account/redeemPubkey bodyRedeem winning tokens

Fills

MethodEndpointIdentityDescription
GET/v2/clob/fills?pubkey=Pubkey paramList your fills
GET/v2/clob/fills/{fillId}PublicGet fill details

Positions & P&L

MethodEndpointIdentityDescription
GET/v2/clob/positions?pubkey=Pubkey paramList positions with P&L
GET/v2/clob/positions/summary?pubkey=Pubkey paramPortfolio P&L summary

WebSocket Channels

ChannelURLDescription
Marketwss://api.pmx.trade/v2/ws/marketOrderbook, prices, trades
Userwss://api.pmx.trade/v2/ws/userOrder, fill, balance events
The user channel identifies you via pubkey in the subscribe message. See the WebSocket overview for connection details, heartbeat, and limits.

Error Format

All error responses follow a consistent structure:
{
  "error": "ERROR_CODE",
  "message": "Human-readable description"
}

Error Codes

CodeHTTP StatusMeaning
VALIDATION_ERROR400Invalid request parameters
INVALID_INPUT400Bad order ID format, invalid filter, etc.
INVALID_SIGNATURE403Ed25519 signature verification failed
INVALID_PRICE400Price not in 1–9999 bps range
INVALID_QUANTITY400Quantity below minimum (1,000,000)
INSUFFICIENT_BALANCE400Not enough USDC/tokens for order
INSUFFICIENT_WITHDRAWABLE400Withdraw amount exceeds available (non-committed) smart wallet balance
ORDER_NOT_FOUND404Order ID not found
ORDER_EXPIRED400Order expiry timestamp has passed
ORDER_SETTLING409Cannot cancel while settlement in progress
ORDER_ALREADY_CANCELLED409Order was already cancelled
ORDER_ALREADY_FILLED409Order is fully filled
NONCE_ALREADY_USED409Nonce replay detected
MARKET_NOT_FOUND404Market ID not found
MARKET_NOT_ACTIVE400Market is paused or resolved
MARKET_NOT_RESOLVED400Trying to redeem from non-resolved market
MAX_OPEN_ORDERS429Too many open orders (100/market, 500 global)
FOK_NOT_FILLABLE400Fill-or-Kill order cannot be fully filled
FILL_NOT_FOUND404Fill ID not found
SERVER_CONFIG500Server misconfiguration
RATE_LIMITED429IP rate limit exceeded
INTERNAL_ERROR500Unexpected server error

Pricing & Units

Prices are expressed in basis points (bps) — 10,000 bps = $1.00. Token and USDC amounts use raw units with 6 decimal places.
ValuebpsRaw Units
$0.55 per token5500
50 tokens"50000000"
$27.50 USDC"27500000"
See Pricing & Units for detailed conversion formulas and how to compute midpoint, spread, and committed amounts.

Pagination

Endpoints that return lists (orders, fills) use cursor-based pagination:
ParameterDefaultMaxDescription
limit50200Number of items per page
cursorOpaque cursor from nextCursor in previous response
The response includes nextCursor: null when there are no more results.