Scope#
Authentication#
Sign in with your wallet on the site. The server sets an httpOnly session cookie that lasts 14 days. Requests without it get 401. A write from another origin gets 403. Errors come back as { "error": "…" }.
Endpoints#
| Endpoint | Purpose | Limit |
|---|---|---|
GET /api/status | Your account: equity, margin, positions, resting orders, caps, mark info and the stop state. | Session |
POST /api/paper | A paper action: open, close, flip, flatten, cancel-pending, set-triggers, reset. | 60 per minute per account |
GET /api/paper/stream | Server-sent events carrying your own paper account. | 12 opens per minute, 2 at once |
Place an order#
{
"market": "BTC",
"side": "buy",
"sizeUsd": 50,
"leverage": 2,
"type": "limit",
"limit": 98000,
"reduceOnly": false,
"takeProfitPct": 3,
"stopLossPct": 1.5
}type is one of market, limit, post-only, ioc or fok. The response says whether the order filled, rested or was refused, with the result of each of the fourteen checks.
Move a stop or target#
{ "action": "set-triggers", "market": "BTC", "stopPrice": 96500, "targetPrice": null }The event stream#
One account event every three seconds, for up to five minutes, then the stream closes and the client reconnects. A frame contains only your own data.
{
"t": 1764700000000,
"killed": false,
"tradingHalted": false,
"paper": { "equityUsd": 10012.4, "account": { "marginUsedUsd": 25, "feesUsd": 0.22 },
"markInfo": { "BTC": { "mark": 98100, "clamped": false, "stale": false, "usable": true } },
"positions": [ /* margin, liquidation, stop, target per position */ ] },
"pending": [ /* resting orders */ ]
}Opening the stream also runs the clock for your book, so stops, targets, funding and liquidations stay current while you watch.