{"openapi":"3.1.0","info":{"title":"HoodSniper agent API (Abstract, paper trading)","version":"1.2.1","description":"Read the market and place PAPER orders for your own account. No real money moves through this API. There is no HoodSniper platform fee right now. Network gas still applies. Terms: /terms  Risks: /risks  Privacy: /privacy. Nothing here is financial advice."},"servers":[{"url":"https://abs.hoodsniper.fun/api/agent/v1"}],"components":{"securitySchemes":{"key":{"type":"http","scheme":"bearer","description":"hsk_… key from More → 🤖 API / Agents"}},"schemas":{"Order":{"type":"object","required":["type"],"properties":{"type":{"enum":["buy","sell","limit","oco","exits","cancel"],"description":"oco = paper bracket on a position you hold: take-profit and stop-loss legs at prices, one cancels the other"},"token":{"type":"string","description":"token contract (buy, limit)"},"pair":{"type":"string","description":"position's pool address (sell, exits)"},"usd":{"type":"number","minimum":1,"description":"paper dollars to spend (buy, limit)"},"portion":{"type":"number","minimum":0.01,"maximum":1,"description":"share of the position to sell (sell; default all)"},"priceUsd":{"type":"number","description":"limit price, USD per token (limit). Fills when the price is at or below it."},"tpPriceUsd":{"type":"number","exclusiveMinimum":0,"description":"oco: take-profit leg, USD per token, above the current price (sells at or above it)"},"slPriceUsd":{"type":"number","exclusiveMinimum":0,"description":"oco: stop-loss leg, USD per token, below the current price (sells at or below it; a gap fills at the pool price of that tick)"},"ttlMin":{"type":"integer","minimum":5,"maximum":10080,"description":"how long a limit or OCO bracket waits (default 1440)"},"tpPct":{"type":"number","minimum":1,"maximum":10000,"description":"take profit, % above entry (limit, exits)"},"slPct":{"type":"number","minimum":1,"maximum":99,"description":"stop loss, % below entry (limit, exits)"},"trailPct":{"type":"number","minimum":1,"maximum":90,"description":"trailing stop, % below the peak (limit, exits)"},"ref":{"type":"string","description":"id of the waiting limit or OCO bracket to cancel (cancel)"}}},"Error":{"type":"object","required":["error","code","status"],"properties":{"error":{"type":"string","description":"a sentence for people; may change"},"code":{"enum":["AGENT_API_OFF","COOKIE_NOT_ACCEPTED","KEY_MISSING","KEY_UNKNOWN","ACCOUNT_UNAVAILABLE","SCOPE_REQUIRED","BAD_CANDLES","BAD_TOKEN","NO_ROUTE","BAD_POSITIONS","BAD_SIDE","BAD_SIZE","BAD_ORDER_TYPE","ORDER_REJECTED","BAD_IDEMPOTENCY_KEY","IDEMPOTENCY_CONFLICT","BAD_ORIGIN","NOT_FOUND","ORDER_NOT_FOUND","METHOD_NOT_ALLOWED","PAYLOAD_TOO_LARGE","RATE_LIMITED","INTERNAL"],"description":"stable: branch on this"},"status":{"type":"integer"},"docs":{"type":"string"}}}}},"paths":{"/me":{"get":{"summary":"Who this key is","description":"Key name and scopes, the account and the chain.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/markets":{"get":{"summary":"Live tokens","description":"The Pond: tokens trading now on this chain, deepest first. ?limit=1..200, ?maxAgeMin=. Each row has symbolFlags (invisible, mixedScript, lookalike, glyphs, major, majorTicker; empty when clean) and symbolWarning; flagged tokens are never left out.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200}},{"name":"maxAgeMin","in":"query","schema":{"type":"number","minimum":0},"description":"only pools younger than N minutes (new launches); unknown age is left out"}]}},"/radar":{"get":{"summary":"Radar","description":"New pools the bot sees on this chain, the launch funnel and the top reasons it skipped tokens (the Radar page). Read-only.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/portfolio":{"get":{"summary":"Paper portfolio","description":"Cash, equity, open positions with their exit rules, waiting limit orders and recent orders.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/analytics":{"get":{"summary":"PnL analytics","description":"Win rate, profit factor, expectancy, drawdown, streaks, equity curve, by strategy and by day.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/slice-plan":{"get":{"summary":"Slice planner (read-only)","description":"One shot vs N tranches over windowMin for a paper buy or exit of usd in token: impact from real pool quotes at each tranche size, impact saved, participation, timing risk (needs candles: POST them; the server does not fetch candles on this host), the recommended N and its schedule. 6 a minute per account.","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string"}},{"name":"usd","in":"query","schema":{"type":"number"}},{"name":"side","in":"query","schema":{"type":"string","enum":["buy","sell"]}},{"name":"windowMin","in":"query","schema":{"type":"number"}},{"name":"tranches","in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"slice plan"},"400":{"description":"BAD_TOKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Slice planner with candles","description":"JSON { token, usd?, side?, windowMin?, tranches?, candles?: GeckoTerminal ohlcv rows [t,o,h,l,c,v] (up to 1000) }. Body up to 64 KB.","responses":{"200":{"description":"slice plan"},"400":{"description":"BAD_SIZE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/xray":{"get":{"summary":"Trade X-ray (read-only)","description":"Your paper trades (last 30 closed + open) measured on real candles: MAE, MFE, kept, capture, left on the table; edge ratio and an exit-coach grid. The server does not fetch candles on this host: POST them to measure. 3 a minute per account.","parameters":[{"name":"paths","in":"query","schema":{"type":"string","enum":["1"]}}],"responses":{"200":{"description":"x-ray report"}}},"post":{"summary":"Trade X-ray with candles","description":"JSON { candles?: { \"0x…\": GeckoTerminal ohlcv rows covering the holds } (up to 8 tokens, 1000 rows each), paths?: true }. Body up to 64 KB.","responses":{"200":{"description":"x-ray report"},"400":{"description":"BAD_CANDLES","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stress":{"get":{"summary":"Book stress test (read-only)","description":"Your paper book replayed through every overlapping horizon window of real candles: VaR / CVaR, worst real window, cvarShare per position, correlations, shocks, and the exit bill from real sell quotes. The server does not fetch candles on this host: POST them to score market risk.","parameters":[{"name":"horizonMin","in":"query","schema":{"type":"number"}},{"name":"confidence","in":"query","schema":{"type":"number","enum":[90,95,99]}}],"responses":{"200":{"description":"stress report"}}},"post":{"summary":"Book stress test with candles or a what-if book","description":"JSON { positions?: [{token, usd}] (up to 8), candles?: { \"0x…\": rows }, horizonMin?, confidence?, equityUsd? }. Body up to 64 KB. 3 a minute per account.","responses":{"200":{"description":"stress report"},"400":{"description":"BAD_POSITIONS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/preflight":{"get":{"summary":"Pre-trade scope (read-only)","description":"GO / CAUTION / NO-GO scorecard for a paper buy of usd in token: HoodScore, entry/exit impact from real quotes at that size, costs vs the ATR stop, stop-out rate, regime, best bracket backtested with those costs, risk vs equity, concentration, cash; clearedSize. Without candles the stop/edge checks are unknown: POST them.","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string"}},{"name":"usd","in":"query","required":true,"schema":{"type":"number"}},{"name":"riskPct","in":"query","schema":{"type":"number"}}],"responses":{"200":{"description":"scorecard"},"400":{"description":"BAD_TOKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Pre-trade scope with your candles","description":"JSON { token, usd, candles?, riskPct?, stopPct? }. 4 a minute per account.","responses":{"200":{"description":"scorecard"},"400":{"description":"BAD_SIZE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/depth":{"get":{"summary":"Fill simulator (read-only)","description":"Real on-chain quotes of the best route (v2 router and v3 all fee tiers: the same route a paper fill uses) at $50 to $100k, buy and sell. Returns buy/sell.points [{usd, out, impactPct, venue}] with impact vs a $10 probe (pool fees are not impact), buy/sell.maxUsd for 1/2/5% impact (interpolated between quotes, or atLeast when the ladder never got there), roundTripProbePct, probe, ethUsd, ms. Cached 60 s; 6 a minute per account.","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"curve"},"400":{"description":"BAD_TOKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NO_ROUTE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/backtest":{"post":{"summary":"Bracket lab (pure maths)","description":"Send OHLC candles (16-1000; [{t,o,h,l,c}] or GeckoTerminal ohlcv_list rows; the body must stay under 64 KB, about 500 raw GeckoTerminal rows, or nginx answers 413) plus optional maxHoldCandles (default 24), costPct (round trip, default 0.6), slPcts (default 1/2/3/5/8 x ATR(14)%), rMultiples (default [1,1.5,2,3]), minTrades (default 20), curves (false = no equity curves). Every candle close is a test entry; TP on a high, SL on a low, both in one candle = SL, neither = exit at the close after maxHoldCandles. Returns cells[] (slPct, tpPct, r, trades, winRate, winRateLow90, breakevenWinRate, expectancyPct, expectancyR, profitFactor, tpHits, slHits, timeouts, avgHoldCandles, sequential, edge), best, verdict, buyAndHoldPct. Places nothing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["candles"]}}}},"responses":{"200":{"description":"grid"},"400":{"description":"BAD_CANDLES","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/plan":{"post":{"summary":"Volatility plan (pure maths)","description":"Send OHLC candles (16-400; [{t,o,h,l,c}] or GeckoTerminal ohlcv_list rows) plus optional livePriceUsd, entryPriceUsd, riskUsd, period (ATR, default 14), horizonCandles (default 12), maxStopOutRate (default 0.25), stop (force a stop id), series (return the last N candles with ATR). Returns atrUsd, atrPct, regime (calm/normal/hot vs the median ATR%), stops[] (id, label, priceUsd, distancePct, atrMultiple, stopOutRate, sizeUsd, targets[1R-3R]), suggested and live (toStopPct, rNow, toTargetsPct, status). Places nothing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["candles"]}}}},"responses":{"200":{"description":"plan"},"400":{"description":"BAD_CANDLES","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/journal":{"get":{"summary":"Trade journal","description":"Every closed paper trade, oldest first: closedAt, openedAt, holdMin, symbol, token, side (always long: buy then sell), sizeUsd, proceedsUsd, pnlUsd, pnlPct, cumPnlUsd, equityUsd (starting paper balance + realized P&L after that trade), drawdownUsd, strategy, entryReason, exitReason. Entry and exit prices are not recorded, so they are not included. ?format=csv returns it as a CSV file.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"format","in":"query","schema":{"type":"string","enum":["csv"]}}]}},"/public/markets":{"get":{"summary":"Live tokens, no key","description":"Read-only, no key needed. Same rows as /markets. 30 requests a minute per IP, cached 15 s. ?limit=1..200, ?maxAgeMin=","security":[],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":200}},{"name":"maxAgeMin","in":"query","schema":{"type":"number","minimum":0},"description":"only pools younger than N minutes (new launches); unknown age is left out"}],"responses":{"200":{"description":"OK"},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/trades":{"get":{"summary":"Closed trades","description":"Your closed paper trades, newest last. ?limit=1..500. ?format=csv returns all of them as a CSV file.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","maximum":500}},{"name":"format","in":"query","schema":{"enum":["json","csv"]}}]}},"/mcp":{"post":{"summary":"MCP endpoint (Streamable HTTP, JSON responses)","description":"One JSON-RPC 2.0 message per POST: initialize, tools/list, tools/call, ping. Same Bearer key, scopes and rate limit as the REST API. No SSE stream (GET returns 405), no sessions.","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"JSON-RPC response"},"202":{"description":"notification accepted"},"401":{"description":"key problems","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"BAD_ORIGIN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sandbox":{"post":{"summary":"Create a 24-hour sandbox account + key (no key needed)","description":"$1,000 paper, read + trade key, deleted after 24 h. 3 a day per IP. Not ranked.","security":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":30}}}}}},"responses":{"201":{"description":"{ key, keyId, scopes, account, paperUsd, expires }"},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"SANDBOX_FULL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"End your sandbox now (its key, paper book and events are deleted)","description":"Frees its place in the shared sandbox cap. Sandbox keys only.","security":[{"key":[]}],"responses":{"200":{"description":"{ ok, deleted }"},"400":{"description":"NOT_SANDBOX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"SCOPE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sandbox/reset":{"post":{"summary":"Reset a sandbox paper book to $1,000","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"400":{"description":"NOT_SANDBOX","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"SCOPE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events":{"get":{"summary":"Event feed","description":"order.accepted, order.filled, order.expired, order.cancelled, order.failed, trade.opened, trade.closed, alert.fired, ping. ?after=<seq>&limit=1..200","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"after","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":200}}]}},"/events/stream":{"get":{"summary":"Server-Sent Events stream of the event feed","description":"text/event-stream. data lines are {t, signature, payload}. Resumes from Last-Event-ID. 2 per account.","security":[{"key":[]}],"responses":{"200":{"description":"text/event-stream"},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"summary":"List webhooks","description":"Your webhooks with fails, lastOk and lastError.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Add a signed webhook (trade key)","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"enum":["order.accepted","trade.opened","trade.closed","alert.fired","ping"]}}}}}}},"responses":{"201":{"description":"{ hook, signingSecret? }"},"400":{"description":"BAD_WEBHOOK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}":{"delete":{"summary":"Delete a webhook","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"description":"NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/test":{"post":{"summary":"Send a signed ping to a webhook","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"queued"}}}},"/signing-secret":{"post":{"summary":"Create or rotate the signing secret (shown once)","security":[{"key":[]}],"responses":{"200":{"description":"{ signingSecret }"}}}},"/leaderboard":{"get":{"summary":"Your leaderboard listing","description":"listed, name, minTrades.","security":[{"key":[]}],"responses":{"200":{"description":"OK"},"401":{"description":"KEY_MISSING, KEY_UNKNOWN or COOKIE_NOT_ACCEPTED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"ACCOUNT_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: over 60 requests a minute (Retry-After header)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Opt in to / out of the public agent board (trade key)","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"listed":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK"},"400":{"description":"BAD_NAME or SANDBOX_NOT_RANKED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"NAME_TAKEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chains":{"get":{"summary":"Every HoodSniper chain's agent endpoints, no key","description":"Base URLs, MCP URLs and order types for all chains. Use one key per chain.","security":[],"responses":{"200":{"description":"OK"}}}},"/public/leaderboard":{"get":{"summary":"Public agent leaderboard, no key","description":"Paper results only, opt-in agents with 3+ closed trades.","security":[],"responses":{"200":{"description":"OK"},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders":{"get":{"summary":"Your last 50 paper orders with their status","description":"status: queued, waiting, filled, failed, expired, cancelled, rejected, done or ended. ?id= returns one order as { order }; ?status= filters.","security":[{"key":[]}],"parameters":[{"name":"id","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["queued","waiting","filled","failed","expired","cancelled","rejected","done","ended"]}}],"responses":{"200":{"description":"{ orders: [...] } or { order }"},"404":{"description":"ORDER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Place a paper order","description":"Needs a key with the trade scope. Orders are queued and the bot fills them within about a minute. Send an Idempotency-Key header so a retry never places a second order.","security":[{"key":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{8,64}$"},"description":"Same key + same body within 24 h returns the first answer (replayed: true); same key + different body returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"responses":{"200":{"description":"queued: { ok, id }"},"400":{"description":"BAD_ORDER_TYPE, ORDER_REJECTED or BAD_IDEMPOTENCY_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"SCOPE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENCY_CONFLICT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders/{id}":{"delete":{"summary":"Cancel a waiting paper order","description":"Cancels a waiting limit or OCO bracket (both legs). Queues the same paper cancel as the app's button; the bot removes it on its next tick. Needs the trade scope.","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{6,20}$"}}],"responses":{"200":{"description":"{ ok, id (the cancel order), cancels, kind }"},"403":{"description":"SCOPE_REQUIRED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"ORDER_NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}