{"openapi":"3.1.0","info":{"title":"Parabolic Trading API","version":"1.0.0","summary":"Trade live sports win-probability markets programmatically.","description":"Prices are PROBABILITIES, not dollars. A price of 0.9375 means the market puts that side at\n93.75%. A contract settles at 1.00 if the side wins and 0.00 if it loses, so buying at 0.9375\nrisks 93.75 cents to make 6.25.\n\nTwo credential modes. A live key (`pbk_...`) trades the real account. A test key\n(`pbk_test_...`) is routed to an isolated sandbox with a fresh $100,000 balance that prices\nagainst the same live oracle but never touches real money. The mode is part of the key\nstring so a leaked credential's blast radius is legible at a glance.\n\nThere is no withdrawal scope and there will not be one: moving money out always requires an\ninteractive session, so a fully compromised key can lose money through bad trades but cannot\ntake money off the platform.","contact":{"name":"Parabolic","url":"https://docs.parabolic.gg/docs/api"}},"servers":[{"url":"https://perpdictions-backend-production.up.railway.app/api/v1","description":"Production"}],"tags":[{"name":"Discovery","description":"Unauthenticated metadata."},{"name":"Account","description":"Your balance, positions, orders and fills."},{"name":"Market data","description":"Markets, prices and order books."},{"name":"Trading","description":"Placing and cancelling orders."},{"name":"Sandbox","description":"Test-mode only."},{"name":"Keys","description":"Key management. Session-authenticated, never key-authenticated."}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"pbk","description":"Authorization: Bearer pbk_<keyId>_<secret>"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Alternative to Authorization, for clients that strip it."}},"schemas":{"Error":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}},"Fill":{"type":"object","properties":{"px":{"type":"number","description":"Fill price as a probability, 0.001–0.999."},"size":{"type":"number","description":"Contracts filled."},"takerFee":{"type":"number","description":"Fee charged on this fill, in dollars."}}},"OrderResult":{"type":"object","properties":{"status":{"type":"string","enum":["filled","partialFill","resting","rejected"]},"reason":{"type":"string","description":"Present when status is 'rejected'.","nullable":true},"oid":{"type":"integer","description":"Present when status is 'resting' — use it to cancel."},"maxLeverage":{"type":"number","description":"Present on a leverageRejected rejection: the cap that applies right now."},"fills":{"type":"array","items":{"type":"object","properties":{"px":{"type":"number","description":"Fill price as a probability, 0.001–0.999."},"size":{"type":"number","description":"Contracts filled."},"takerFee":{"type":"number","description":"Fee charged on this fill, in dollars."}}}},"deduped":{"type":"boolean","description":"True when this is a replay of an earlier clientOrderId."},"sandbox":{"type":"boolean","description":"True when served by a test key."}}},"Position":{"type":"object","properties":{"gameId":{"type":"string"},"side":{"type":"string","enum":["home","away"]},"size":{"type":"number"},"entryPx":{"type":"number"},"markPx":{"type":"number"},"margin":{"type":"number"},"leverage":{"type":"number"},"unrealizedPnl":{"type":"number"},"liquidationPx":{"type":"number"}}},"Market":{"type":"object","properties":{"gameId":{"type":"string"},"league":{"type":"string","example":"mlb"},"name":{"type":"string"},"home":{"type":"object","additionalProperties":true},"away":{"type":"object","additionalProperties":true},"status":{"type":"string","enum":["live","scheduled","final","halftime","postponed"]},"startTime":{"type":"string","format":"date-time"},"tradeable":{"type":"boolean","description":"Branch on THIS, not on status — a scheduled market inside the pregame window is tradeable, and a live one can be halted."},"indexPrice":{"type":"number","nullable":true},"markPrice":{"type":"number","nullable":true},"settled":{"type":"boolean"}}}}},"security":[{"BearerAuth":[]}],"paths":{"/":{"get":{"tags":["Discovery"],"summary":"Describe the API","security":[],"operationId":"getIndex","responses":{"200":{"description":"Version, auth, modes, endpoints and limits.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/time":{"get":{"tags":["Discovery"],"summary":"Server clock","security":[],"operationId":"getTime","description":"Check against your own clock before computing staleness windows.","responses":{"200":{"description":"Server time.","content":{"application/json":{"schema":{"type":"object","properties":{"serverTime":{"type":"integer"},"iso":{"type":"string","format":"date-time"}}}}}}}}},"/openapi.json":{"get":{"tags":["Discovery"],"summary":"This document","security":[],"operationId":"getOpenapi","responses":{"200":{"description":"The OpenAPI 3.1 spec.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/account":{"get":{"tags":["Account"],"summary":"Balance and equity","operationId":"getAccount","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"description":"The account is whichever one the key belongs to — there is no user parameter anywhere in v1.","responses":{"200":{"description":"Account state.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/positions":{"get":{"tags":["Account"],"summary":"Open positions","operationId":"getPositions","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"responses":{"200":{"description":"Open positions.","content":{"application/json":{"schema":{"type":"object","properties":{"positions":{"type":"array","items":{"type":"object","properties":{"gameId":{"type":"string"},"side":{"type":"string","enum":["home","away"]},"size":{"type":"number"},"entryPx":{"type":"number"},"markPx":{"type":"number"},"margin":{"type":"number"},"leverage":{"type":"number"},"unrealizedPnl":{"type":"number"},"liquidationPx":{"type":"number"}}}},"count":{"type":"integer"}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/orders":{"get":{"tags":["Account"],"summary":"Resting orders","operationId":"getOrders","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"responses":{"200":{"description":"Resting limit orders.","content":{"application/json":{"schema":{"type":"object","properties":{"orders":{"type":"array","items":{"type":"object","additionalProperties":true}},"count":{"type":"integer"}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}},"post":{"tags":["Trading"],"summary":"Place an order","operationId":"placeOrder","security":[{"ApiKeyAuth":[]},{"BearerAuth":["trade"]}],"description":"Leverage is capped per market and per side, and the cap TIGHTENS as a game gets later and\nmore lopsided — read `maxLeverage` off a `leverageRejected` response rather than assuming\n10x is available.\n\nA risk rejection returns HTTP 200 with `status: 'rejected'` and a `reason`: the request was\nwell-formed, the engine declined it. Malformed input returns 4xx.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["gameId","side","size"],"properties":{"gameId":{"type":"string","description":"From /markets."},"side":{"type":"string","enum":["home","away"]},"size":{"type":"number","minimum":1,"maximum":100000,"description":"Contracts. Ignored when budget is set."},"budget":{"type":"number","description":"Spend this much in total instead: size is derived so margin PLUS fee fits inside it."},"type":{"type":"string","enum":["market","limit"],"default":"market"},"price":{"type":"number","minimum":0.001,"maximum":0.999,"description":"Required for limit orders."},"leverage":{"type":"number","minimum":1,"maximum":10,"default":1},"tif":{"type":"string","enum":["GTC","ALO"],"description":"Limit orders only; market orders are always IOC."},"reduceOnly":{"type":"boolean","description":"Only shrinks an existing position; never opens one."},"tp":{"type":"number","nullable":true,"description":"Take-profit, in the position's own side scale."},"sl":{"type":"number","nullable":true,"description":"Stop-loss, in the position's own side scale."},"clientOrderId":{"oneOf":[{"type":"string","maxLength":64},{"type":"number"}],"description":"Your id for this order. A retry with the same id replays the original response — for 10 minutes if the order EXECUTED (filled/resting), and for 15 seconds if it was rejected (long enough to absorb a network retry, short enough that a deterministic id is not locked out after the rejection's cause clears). Vary it when you change the order."}}}}}},"responses":{"200":{"description":"Filled, resting, or rejected for a risk reason.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["filled","partialFill","resting","rejected"]},"reason":{"type":"string","description":"Present when status is 'rejected'.","nullable":true},"oid":{"type":"integer","description":"Present when status is 'resting' — use it to cancel."},"maxLeverage":{"type":"number","description":"Present on a leverageRejected rejection: the cap that applies right now."},"fills":{"type":"array","items":{"type":"object","properties":{"px":{"type":"number","description":"Fill price as a probability, 0.001–0.999."},"size":{"type":"number","description":"Contracts filled."},"takerFee":{"type":"number","description":"Fee charged on this fill, in dollars."}}}},"deduped":{"type":"boolean","description":"True when this is a replay of an earlier clientOrderId."},"sandbox":{"type":"boolean","description":"True when served by a test key."}}}}}},"400":{"description":"Malformed input, or an event market (not tradeable via the API).","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"404":{"description":"No such market.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"409":{"description":"Market not open for trading.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"503":{"description":"Order engine contended — safe to retry with the same clientOrderId.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/orders/{oid}":{"delete":{"tags":["Trading"],"summary":"Cancel a resting order","operationId":"cancelOrder","security":[{"ApiKeyAuth":[]},{"BearerAuth":["trade"]}],"parameters":[{"name":"oid","in":"path","required":true,"schema":{"type":"integer"},"description":"From the resting order's response."}],"responses":{"200":{"description":"Cancelled; locked margin released.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"oid":{"type":"integer"}}}}}},"400":{"description":"oid is not a number.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"404":{"description":"No such open order OF YOURS — identical to one that never existed, so ids cannot be probed.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/fills":{"get":{"tags":["Account"],"summary":"Closed-trade history","operationId":"getFills","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":500}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Closed trades, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"trades":{"type":"array","items":{"type":"object","additionalProperties":true}},"total":{"type":"integer"}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/markets":{"get":{"tags":["Market data"],"summary":"Tradeable markets","operationId":"getMarkets","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"responses":{"200":{"description":"Live and scheduled markets.","content":{"application/json":{"schema":{"type":"object","properties":{"markets":{"type":"array","items":{"type":"object","properties":{"gameId":{"type":"string"},"league":{"type":"string","example":"mlb"},"name":{"type":"string"},"home":{"type":"object","additionalProperties":true},"away":{"type":"object","additionalProperties":true},"status":{"type":"string","enum":["live","scheduled","final","halftime","postponed"]},"startTime":{"type":"string","format":"date-time"},"tradeable":{"type":"boolean","description":"Branch on THIS, not on status — a scheduled market inside the pregame window is tradeable, and a live one can be halted."},"indexPrice":{"type":"number","nullable":true},"markPrice":{"type":"number","nullable":true},"settled":{"type":"boolean"}}}},"count":{"type":"integer"}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/markets/{gameId}":{"get":{"tags":["Market data"],"summary":"One market in full","operationId":"getMarket","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"description":"Includes the order book and the complete oracle state with its per-source breakdown — the index price is auditable on purpose.","parameters":[{"name":"gameId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Market, oracle state and book depth.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Valid key without the required scope. The message names the scopes the key does hold.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"404":{"description":"No such market.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/sandbox/reset":{"post":{"tags":["Sandbox"],"summary":"Reset the sandbox account","operationId":"resetSandbox","security":[{"ApiKeyAuth":[]},{"BearerAuth":["read"]}],"description":"Test keys only. Restores a clean account at the starting balance. Refused on a live key — there is no reset for a real account.","responses":{"200":{"description":"Reset complete.","content":{"application/json":{"schema":{"type":"object","properties":{"reset":{"type":"boolean"},"balance":{"type":"number"},"sandbox":{"type":"boolean"}}}}}},"400":{"description":"Called with a live key.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"401":{"description":"Missing, malformed, revoked or wrong-mode credential. All four are deliberately indistinguishable so key ids cannot be enumerated.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"429":{"description":"Rate limit exceeded. Respect the Retry-After header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/keys":{"get":{"tags":["Keys"],"summary":"List your keys","operationId":"listKeys","security":[],"description":"SESSION-authenticated, not key-authenticated. Secrets are never returned.","parameters":[{"name":"userId","in":"query","required":true,"schema":{"type":"string"}},{"name":"token","in":"query","required":true,"schema":{"type":"string"},"description":"Session token."}],"responses":{"200":{"description":"Key metadata.","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","additionalProperties":true}},"count":{"type":"integer"}}}}}},"401":{"description":"No or invalid session.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}},"post":{"tags":["Keys"],"summary":"Mint a key","operationId":"createKey","security":[],"description":"SESSION-authenticated — an API key can never mint another key, or a read-only key would be a privilege-escalation primitive. Credentials must be in the BODY: a URL carrying a session token can leak through logs or Referer. The plaintext key is returned ONCE and is never recoverable.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId","token"],"properties":{"userId":{"type":"string"},"token":{"type":"string","description":"Session token."},"label":{"type":"string","maxLength":64},"scopes":{"type":"array","items":{"type":"string","enum":["read","trade"]},"default":["read"]},"mode":{"type":"string","enum":["live","test"],"default":"live"}}}}}},"responses":{"201":{"description":"Key created. `key` appears here and nowhere else, ever.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"keyId":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"mode":{"type":"string"},"warning":{"type":"string"}}}}}},"400":{"description":"Invalid scope or mode, or the per-account key limit was reached.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"401":{"description":"No or invalid session.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"403":{"description":"Guest account — a full account is required.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}},"/keys/{keyId}":{"delete":{"tags":["Keys"],"summary":"Revoke a key","operationId":"revokeKey","security":[],"description":"Immediate. The row is retained for audit. A key that is not yours reports 404.","parameters":[{"name":"keyId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId","token"],"properties":{"userId":{"type":"string"},"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean"},"keyId":{"type":"string"}}}}}},"401":{"description":"No or invalid session.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}},"404":{"description":"No such key of yours.","content":{"application/json":{"schema":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable message. Wording may change; do not parse."},"code":{"type":"string","description":"Stable machine-readable code. Branch on this."}}}}}}}}}}}