{"openapi":"3.1.0","info":{"title":"ParamX API","version":"1","description":"Plain JSON. Big integers are decimal strings; prices and amounts are decimal strings in USDC and shares; times are epoch milliseconds."},"servers":[{"url":"https://api.paramx.xyz/v1"}],"paths":{"/exchange":{"get":{"summary":"Exchange addresses and constants","responses":{"200":{"description":"Exchange info"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/instruments":{"get":{"summary":"Instruments (underlyings)","responses":{"200":{"description":"{instruments: [...]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/instruments/{id}/sessions":{"get":{"summary":"Open market sessions, as [start_ms, end_ms] (at most 14 days)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"from","in":"query","schema":{"type":"integer"}},{"name":"to","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"{instrument_id, from, to, always_open, sessions}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/instruments/{id}/price":{"get":{"summary":"The underlying's last trade","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"{instrument_id, price, size, side, trade_id, ts}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/contracts/{contract_id}":{"get":{"summary":"One tile: its fields, grid, status, tradability and outcome","parameters":[{"name":"contract_id","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^\\d{1,78}$","description":"Contract (tile) id, a u256 as a decimal string"}}],"responses":{"200":{"description":"{contract_id, underlying_id, start, end, min_strike, max_strike, grid, status, tradable, reason, outcome}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/markets":{"get":{"summary":"Tradable tiles with resting orders, with best bid and ask","parameters":[{"name":"instrument_id","in":"query","schema":{"type":"integer"}},{"name":"grid","in":"query","schema":{"type":"string","enum":["1m","5m","1h","1d"]}}],"responses":{"200":{"description":"{markets: [...]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/books/{contract_id}":{"get":{"summary":"Order book as price levels, best first","parameters":[{"name":"contract_id","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^\\d{1,78}$","description":"Contract (tile) id, a u256 as a decimal string"}}],"responses":{"200":{"description":"{contract_id, bids: [[price, amount]], asks, ts}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/accounts/{address}":{"get":{"summary":"Registered trading key and cash","parameters":[{"name":"address","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"}}],"responses":{"200":{"description":"{address, trading_pubkey (hex) | null, cash | null}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/accounts/{address}/orders":{"get":{"summary":"Resting orders","parameters":[{"name":"address","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"}}],"responses":{"200":{"description":"{orders: [...]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/accounts/{address}/positions":{"get":{"summary":"Positions","parameters":[{"name":"address","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"}}],"responses":{"200":{"description":"{positions: [...]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/accounts/{address}/balance-history":{"get":{"summary":"The account's value and cash over time, with its deposits and withdrawals","parameters":[{"name":"address","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"}},{"name":"from","in":"query","schema":{"type":"integer","minimum":0},"description":"Unix ms (default 7 days ago)"},{"name":"to","in":"query","schema":{"type":"integer","minimum":0},"description":"Unix ms (default now)"},{"name":"points","in":"query","schema":{"type":"integer","minimum":2,"maximum":1000}}],"responses":{"200":{"description":"{points: [{ts, cash, value}], markers: [{ts, type: deposit | withdraw, amount}]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/accounts/{address}/fills":{"get":{"summary":"The account's fills, newest first","parameters":[{"name":"address","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"}},{"name":"since","in":"query","schema":{"type":"integer","minimum":0},"description":"Unix ms, inclusive"},{"name":"until","in":"query","schema":{"type":"integer","minimum":0},"description":"Unix ms, exclusive"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"{fills: [{trade_id, intent_id, client_order_id, contract_id, side, price, amount, total_price, tx_digest, ts}]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/accounts/{address}/history":{"get":{"summary":"Per-contract trading history, newest first","parameters":[{"name":"address","in":"path","required":true,"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"{entries: [...], next_offset}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/orders":{"post":{"summary":"Place a signed order","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"side":{"type":"string","enum":["buy","sell"]},"type":{"type":"string","enum":["limit","market"],"description":"limit: the rest of the order rests on the book"},"user_address":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"},"contract_id":{"type":"string","pattern":"^\\d{1,78}$","description":"Contract (tile) id, a u256 as a decimal string"},"total_price":{"anyOf":[{"type":"string","pattern":"^\\d+(\\.\\d{1,6})?$"},{"type":"null"}],"description":"USDC. Buy: the most the order spends. Sell: the least it takes in (null for a market sell)"},"total_amount":{"anyOf":[{"type":"string","pattern":"^\\d+(\\.\\d{1,6})?$"},{"type":"null"}],"description":"Shares. Required for sells and limit buys"},"exchange_object_id":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"The exchange, from GET /v1/exchange"},"expiry":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"description":"Epoch ms"},"nonce":{"type":"string","pattern":"^\\d{1,78}$","description":"Random u64, as a decimal string"},"signature":{"type":"string","pattern":"^[A-Za-z0-9+/]{86}==$","description":"Raw Ed25519 signature by the trading key, base64"},"time_in_force":{"default":"gtc","description":"Limit orders. gtc: the rest rests until expiry. ioc: the rest is dropped. post_only: refused (WOULD_CROSS) if it would match","type":"string","enum":["gtc","ioc","post_only"]},"client_order_id":{"default":null,"description":"Your own id for the order, unique per account; not signed","anyOf":[{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},{"type":"null"}]}},"required":["side","type","user_address","contract_id","total_price","total_amount","exchange_object_id","expiry","nonce","signature"]}}}},"responses":{"200":{"description":"{intent_id, order_id | null, status: filled | partially_filled | resting, filled_amount, resting_amount}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/orders/cancel":{"post":{"summary":"Cancel a resting order","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"user_address":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"},"intent_id":{"description":"From the order's POST /v1/orders response","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"client_order_id":{"description":"Instead of intent_id","type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"},"signature":{"type":"string","pattern":"^[A-Za-z0-9+/]{86}==$","description":"Trading key's signature over the order's CancelOrderIntent"}},"required":["user_address","signature"]}}}},"responses":{"200":{"description":"{intent_id, order_id, status: cancelled}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/orders/batch":{"post":{"summary":"Place up to 20 signed orders, in order; each has its own result","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"orders":{"minItems":1,"type":"array","items":{}}},"required":["orders"]}}}},"responses":{"200":{"description":"{results: [{ok: true, ...order} | {ok: false, error}]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/orders/cancel-all":{"post":{"summary":"Take all (or one contract's) resting orders off the book (book-only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"user_address":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"},"nonce":{"type":"string","pattern":"^\\d{1,78}$","description":"Random u64, as a decimal string"},"expiry":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"description":"Epoch ms, at most 60 s away"},"signature":{"type":"string","pattern":"^[A-Za-z0-9+/]{86}==$","description":"Trading key's signature over the bulk-cancel message (signing.md)"},"contract_id":{"default":null,"description":"Only this contract's orders; null for all","anyOf":[{"type":"string","pattern":"^\\d{1,78}$","description":"Contract (tile) id, a u256 as a decimal string"},{"type":"null"}]}},"required":["user_address","nonce","expiry","signature"]}}}},"responses":{"200":{"description":"{cancelled: [{intent_id, order_id, client_order_id}]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/orders/cancel-batch":{"post":{"summary":"Take up to 200 resting orders off the book (book-only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"user_address":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"},"nonce":{"type":"string","pattern":"^\\d{1,78}$","description":"Random u64, as a decimal string"},"expiry":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"description":"Epoch ms, at most 60 s away"},"signature":{"type":"string","pattern":"^[A-Za-z0-9+/]{86}==$","description":"Trading key's signature over the bulk-cancel message (signing.md)"},"intent_ids":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"client_order_ids":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,64}$"}}},"required":["user_address","nonce","expiry","signature"]}}}},"responses":{"200":{"description":"{cancelled: [{intent_id, order_id, client_order_id}]}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/withdrawals":{"post":{"summary":"Withdraw cash to the account's Sui address","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"user_address":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$","description":"Sui address, 0x + 64 hex digits"},"amount":{"type":"string","pattern":"^\\d+(\\.\\d{1,6})?$","description":"USDC"},"signature":{"type":"string","pattern":"^[A-Za-z0-9+/]{86}==$","description":"Trading key's signature over the withdraw message"}},"required":["user_address","amount","signature"]}}}},"responses":{"200":{"description":"{cash}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/trading-keys":{"post":{"summary":"Submit a signed new_trading_key_transfer (gas sponsored)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"signed_transaction_b64":{"type":"string","description":"BCS TransactionData, base64"},"user_signature":{"type":"string","description":"The wallet key's Sui signature, base64"}},"required":["signed_transaction_b64","user_signature"]}}}},"responses":{"200":{"description":"{accepted: true}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}},"/deposits":{"post":{"summary":"Submit a signed new_deposit_transfer (gas sponsored)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"signed_transaction_b64":{"type":"string","description":"BCS TransactionData, base64"},"user_signature":{"type":"string","description":"The wallet key's Sui signature, base64"}},"required":["signed_transaction_b64","user_signature"]}}}},"responses":{"200":{"description":"{accepted: true}"},"default":{"description":"An error: {\"error\": {\"code\": \"...\", \"message\": \"...\"}}"}}}}}}