Orders and cancellation
Each order is bound to an owner EIP-712 signature over ownerWallet, marketId, marketConfigVersion, outcome, side, orderType, postOnly, priceBaseUnit, sharesBaseUnit, nonce, and expirationMs. A managed-owner signed-in session may submit one order with signature: ""; the server signs only when its derived owner wallet matches the authenticated Trading Account. All other requests require a valid owner signature.
Enums: outcome UP=0, DOWN=1; side BUY=0, SELL=1; order type GTC=0, GTD=1, FOK=2, FAK=3. All uint fields are decimal strings.
| POST | /api/trading/orders | /api/trading/orders/batch | BTC 3m single/batch orders; L2 plus owner EIP-712 |
| GET/DELETE | /api/trading/orders* | BTC 3m reads and single/batch/market/all cancellation |
| POST | /api/orders/manual | ADI Sports IOC / Polymarket Crypto FAK; L2 plus Provider-native signature |
| POST | /api/positions/close | Polymarket Crypto close; L2 plus owner-signed SELL FAK and idempotency key |
| GET | /api/orders/{id} | Read an owned ADI/Polymarket order; immediate-only v1 has no cancel API |
| PUT | /api/provider-credentials/polymarket | Owner-L1 Polymarket CLOB Credential registration or rotation |
Code example
POST /api/trading/ordersIdempotency-Key: bot-order-0001{"ownerWallet":"0x...","marketId":"BTC-3M-...","marketConfigVersion":"1", "outcome":0,"side":0,"orderType":0,"postOnly":true, "priceBaseUnit":"5100","sharesBaseUnit":"1000000", "nonce":"18446744073709551617","expirationMs":"0","signature":"0x..."}Code example
POST /api/orders/manualIdempotency-Key: bot-order-0002{"marketId":"sports-market-id","side":"YES","price":0.52,"sizeUsdc":5, "authorization":{"protocol":"ADI_SIGNED_V1","payload":{ "userWallet":"0x...","marketId":"adi-market-id","side":"buy","outcome":"0", "price":"0.52","quantity":"9.615385","nonce":"...","expiry":0, "maker":"0x...","signature":"0x...","clientOrderId":"bot-order-0002", "type":"market","timeInForce":"ioc"}}}# Crypto uses the same endpoint. rawBody is the exact owner-signed# Polymarket order JSON sent unchanged to the Provider.{"marketId":"crypto-market-id","side":"YES","price":0.52,"sizeUsdc":5, "authorization":{"protocol":"POLYMARKET_CLOB_V1", "payload":{"rawBody":"{...exact Polymarket FAK order JSON...}"}}}Code example
import { Chain, ClobClient, OrderType, Side, SignatureTypeV2, orderToJsonV2} from "@polymarket/clob-client-v2";// GET /api/trading/account returns polymarketFunderWallet and polymarketOrderConfig.const clob = new ClobClient({ host: "https://clob.polymarket.com", chain: Chain.POLYGON, signer: ownerSigner, creds: { key: polymarketApiKey, secret: polymarketApiSecret, passphrase: polymarketApiPassphrase }, signatureType: SignatureTypeV2.POLY_1271, // Current SDK deposit-wallet type 3. funderAddress: polymarketFunderWallet, useServerTime: true});const signedOrder = await clob.createMarketOrder( { tokenID, side: Side.BUY, amount: 5, price: 0.52, builderCode: polymarketOrderConfig.builderCode }, { tickSize: "0.01", negRisk: false });// owner is the registered API key UUID. For type 3, signer and maker are the funder wallet;// ownerSigner creates the wrapped POLY_1271 signature through the official client.const rawBody = JSON.stringify( orderToJsonV2(signedOrder, polymarketApiKey, OrderType.FAK, false, false));const requestBody = JSON.stringify({ marketId: resoCryptoMarketId, side: "YES", price: 0.52, sizeUsdc: 5, authorization: { protocol: "POLYMARKET_CLOB_V1", payload: { rawBody } }});// Sign requestBody with Reso L2, then POST requestBody unchanged to /api/orders/manual.Code example
// Read the owned shares, current best bid, tick size, and negRisk first.const signedSell = await clob.createMarketOrder( { tokenID, side: Side.SELL, amount: shares, price: bestBid, builderCode: polymarketOrderConfig.builderCode }, { tickSize, negRisk });const closeRawBody = JSON.stringify( orderToJsonV2(signedSell, polymarketApiKey, OrderType.FAK, false, false));const closeBody = JSON.stringify({ marketId: resoCryptoMarketId, side: "YES", shares, referencePrice: bestBid, authorization: { protocol: "POLYMARKET_CLOB_V1", payload: { rawBody: closeRawBody } }});// Persist one Idempotency-Key and closeBody before sending. Sign closeBody with// Reso L2, then POST the exact bytes to /api/positions/close. Retry an unknown// result only with that same key and body.A new ADI or Polymarket submission returns HTTP 202 and a Reso order id. Poll that id until terminal. A Crypto position close is a separately owner-signed SELL FAK through /api/positions/close; it is not cancellation. Provider ids and secrets are intentionally not returned.
Code example
# POST /api/orders/manual returns 202 for a newly accepted Provider order.{"replayed":false,"order":{"id":"...","state":"ACCEPTED","riskReasons":[]}}# Poll the returned Reso order id; do not use a Provider id.GET /api/orders/{id}# ADI IOC and Polymarket FAK are immediate orders and have no Reso cancel endpoint.# If the POST result is unknown, query first, then retry only identical bytes and Idempotency-Key.Single orders and inventory split/merge accept Session or L2 auth. Batch orders, cancellation, and heartbeat require L2. A batch supports at most 15 independently owner-signed items; managed Session signing never applies to batches.