{"openapi":"3.1.0","info":{"title":"Broker Platform API","description":"This API accepts two Bearer-JWT credentials, both sent as the `Authorization: Bearer <token>` header; each operation is authorized against the one it names.\n\n**Personal API token** — minted from the backoffice (user menu → Tokens). It authorizes a system user's own automation over the *user* operations: Get Instruments, Get Trading Terms, and the market-data WebSocket. Every request is authorized against the intersection of the token's permissions and its owner's current permissions, so revoking a user immediately narrows every token they issued.\n\n**Broker client-credentials JWT** — obtained from the OAuth2 `client_credentials` grant at `POST /api/v1/oauth/token` with a Broker API credential. It is REQUIRED for the *broker* operations: the bulk query surface, account / position / transaction writes, user creation (`users:write`), trading-terms writes, and webhook management (`webhooks:manage`). These operations are served by the Broker Platform host (e.g. `platform-api.sirix.ai`), not the backoffice host, and they reject personal tokens. Where a 403 response names a specific scope, that is the scope the operation requires.\n\n**Live market data** is served over a WebSocket at `GET /api/v1/ws`, which is not describable in OpenAPI and so is not listed below. Authenticate the upgrade with the same `Authorization: Bearer` header (note that browsers cannot set headers on a WebSocket — this is a machine API). Send `{\"type\":\"subscribe_ticks\"}` to receive a `ticks_ack` manifest followed by a snapshot and then a live stream of raw, markup-free ticks for every instrument the workspace's instrument packs make available.\n\nA live, interactive playground for this WebSocket — connect, subscribe, and watch real frames arrive — is served at `/api/docs/ws`.\n\n**Change discovery.** `POST /api/v1/replication/changes` (`replication:read`) streams every insert, update and delete in your firm — accounts and their contact details, trading accounts, funds, positions, pending orders, balance actions and closed positions, plus the global trading-terms and instrument catalog — in commit order, behind one opaque cursor. It exists because the bulk query surface sorts on creation time and so cannot discover an amendment or a deletion at all. Send `{\"cursor\": null}` first: that positions you at the present WITHOUT returning rows, which is the position to capture before an initial load. Then page with the `next_cursor` you are handed. Rows carry the LIVE payload and the LIVE revision, so a replay is harmless; a record deleted since the change was recorded arrives as `op: delete` with no payload. Changes are held back for about two seconds before being served, so `high_water_id` ahead of your position is normal. A `410 cursor_expired` means your position is older than the retained change history — take a fresh snapshot rather than retrying. A bind that polls continuously should be provisioned with an explicit per-token rate override.\n\n**Initial load.** `POST /api/v1/replication/snapshot` (`replication:read`) pages every live record of ONE of those kinds for your firm, ascending by `(tenant, record_id)`, behind an opaque cursor. Send `{\"kind\": \"forex\"}` to start and page with the `next_cursor` you are handed. **Only a missing `next_cursor` means the scan is finished** — a page can come back empty and still carry a cursor, which means the server stopped walking accounts for this request and you should ask again. Payloads are projected and field-security-masked exactly as on the change feed, and `revision` is the live revision, so a snapshot row and a change row for the same record are directly comparable. Capture a change-feed position (`{\"cursor\": null}`) BEFORE you start a load, then replay from it afterwards. An optional `tenants` list (at most 1000 account ids) narrows the scan — it is intersected with your firm, so an id that is not yours is simply absent — which is how you repair one account without re-reading the firm.\n\n**Drift audit.** `POST /api/v1/replication/digest` (`replication:read`) returns, per account, the `count`, the `sum(revision)` and `bit_xor(hashtext(record_id::text || ':' || revision::text))` over one kind, plus a whole-firm rollup. Compare the rollup first and bisect per account only when it differs. The figures are order-independent and read no payload at all, so field-security masking can never cause a false mismatch — reproduce the same expression against your own copy. An account that is in your firm but holds no records of the kind is reported with zeros; an account that is NOT in your firm is absent from the list entirely, which is how you detect a replica row that no longer belongs to you. Firms above 20 000 accounts must digest in explicit `tenants` batches.\n\n**Daily history.** `GET /api/v1/replication/daily-history` (`replication:read`) pages your firm's end-of-day account rows — balance, equity, margin, the day's flows and both the net and the gross money legs — keyed on `updated_at`, the instant each row was last written. It is keyed on that rather than on the trading day because an operator can recompute one account at any time, which restates every day in that account's history; a consumer polling a window of recent DAYS would never see a January day restated in March. Call it with no parameters to load everything, then page with the `next_cursor` you are handed; `since` (RFC3339, inclusive) starts a fresh walk instead, and passing both is refused. **When `next_cursor` is absent you are caught up, and `settled_at` on that last page — not the last row's `updated_at` — is the `since` for your next pass.** Rows changed within the last few seconds are held back, which is what `settled_at` reports; that is deliberate, because a row is stamped when its transaction STARTS and a recompute commits some time later. Money is a decimal string on every column. The four gross flow columns are `null` on rows written before they existed, meaning \"this day was stored net-only\" — which is not the same as zero. No field-security masking applies to this route: the table holds money and identifiers, no personal data.\n\n**Nightly run gate.** `GET /api/v1/replication/daily-history/runs?day=` (`replication:read`) reports which nightly snapshot runs have COMPLETED for that trading date on the trading systems your firm uses. Gate a daily pull on it rather than on a clock, or you will read a day while it is still being written. A trading system with no completed run is simply absent from `runs` — that absence is the closed gate. `account_count` inside a run is the marker's own figure and counts every firm on that trading system, so where a server is shared it is larger than your share; reconcile your replica against `firm_row_count` on the response, which is your firm's own row count for that day and is also what catches a day that was deleted and not re-inserted.\n\n**One account's history.** `GET /api/v1/accounts/{id}/timeline` returns the account's two-sided story newest-first — what the client did (logged in, asked for money, uploaded a document, had a stop-loss fire) interleaved with what the brand did (called, e-mailed, approved the money, changed the owner). It needs `accounts:read`; the two money phases (`money_requested` / `money_approved`) additionally need `transactions:read`, and workflow runs are never served here. Read `allowed_types` on the response to learn which sources your credential may see — a `types=` selection is intersected with that set silently rather than refused — and `masked_fields` to learn what the firm's field-security policy withheld (your credential's `unmask_fields` allow-list is what re-admits a field).\n\n```\ncurl -H \"Authorization: Bearer $TOKEN\" \\\\\n\"https://platform-api.sirix.ai/api/v1/accounts/1234/timeline\\\n?types=login,money_approved&page_size=50\"\n```\n\nPage with the opaque `next_cursor` (never by offset: two phases of one record can share a timestamp). `GET .../timeline/days?tz=Asia/Jerusalem` returns the same window as per-day counts per side, for a date scrubber.\n\n**The trader AI Connector (MCP)** is served at `POST /api/v1/mcp`, and — for clients that cannot set a header — at `POST /api/v1/mcp/t/{token}`. Like the WebSocket it is not describable in OpenAPI and so is not listed below: it speaks JSON-RPC 2.0 over a single POST (Model Context Protocol, revision `2025-06-18`), where the whole contract lives in the body's `method` rather than in the path. Authenticate with an `ai_` token, which a trader mints for ONE of their trading accounts from the AI Connector section of the WebTrader settings; every tool is pinned to that account. Call `tools/list` for the self-describing tool contract.","license":{"name":"Proprietary","identifier":"Proprietary"},"version":"1.21.0"},"paths":{"/api/v1/accounts":{"post":{"tags":["platform-accounts"],"operationId":"create_account","parameters":[{"name":"Idempotency-Key","in":"header","description":"REQUIRED. Scoped to (credential, client_reference_id); a retry replays the sealed response.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateAccountRequest"}}},"required":true},"responses":{"200":{"description":"Replay re-redacted under the current policy and credential grant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiAccount"}}}},"201":{"description":"Account created. Policy fields are encrypted before persistence; masked fields without a grant and all encrypted fields are withheld from the echo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiAccount"}}}},"400":{"description":"Missing or over-long Idempotency-Key"},"401":{"description":"Authentication required"},"403":{"description":"Scope not granted, outside the credential's brand clamp, or explicit Status hidden by field security"},"409":{"description":"The identity is already claimed at this brand (duplicate)"},"422":{"description":"Validation failed"},"503":{"description":"Field-security rules cannot be resolved or required field protection is unavailable; no account created"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/bulk":{"post":{"tags":["platform-accounts"],"operationId":"bulk_create_accounts","parameters":[{"name":"Idempotency-Key","in":"header","description":"REQUIRED. Scoped to (credential, sentinel+row-set hash): a retry of the SAME batch replays the whole sealed response; the same key with different rows is a different claim and executes.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiBulkCreateAccountsRequest"}}},"required":true},"responses":{"200":{"description":"Batch processed; only per-row ids/status are published. Encryption or policy failures refuse the affected row (503), never persist plaintext","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiBulkResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"Scope not granted, or outside the credential's brand clamp"},"413":{"description":"More than 1000 rows"},"422":{"description":"Empty batch, or a row without a client_reference_id"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/status/query":{"post":{"tags":["read"],"summary":"`POST /api/v1/accounts/status/query`","operationId":"status_query","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStatusRequest"}}},"required":true},"responses":{"200":{"description":"One page of account statuses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStatusResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"Scope does not permit this read"},"413":{"description":"Scope resolves to too many accounts to serve"},"503":{"description":"Live P&L unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}":{"patch":{"tags":["platform-accounts"],"operationId":"patch_account","parameters":[{"name":"id","in":"path","description":"Account id","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","description":"REQUIRED strong ETag from a prior response. A stale value is a 412; an invisible id is a 404 (checked first).","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"REQUIRED. A retry with the same key REPLAYS the response the original request sealed, so the revision (and therefore the ETag) is the one that write produced — a replay never re-applies the patch. The BODY is re-redacted before it is returned, against the credential's CURRENT unmask allowlist and the workspace's CURRENT policies, with encrypted fields withheld: revoking a grant, or masking a field, takes effect on the very next replay rather than waiting for the claim to be swept.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPatchAccountRequest"}}},"required":true},"responses":{"200":{"description":"Patched. Patching `first_name` or `last_name` normally rebuilds the display `name`. The rebuild is SUPPRESSED — `name` keeps its stored value while the parts are still written — when a name part is `encrypted` (a derived cleartext name would republish it, or splice its envelope into the display name), or when a part is masked and this credential holds no unmask for it (the rebuild would compose a value the caller may not read). A credential that may read every covered part gets the ordinary rebuild. Field-Security-masked fields the credential may not read are absent from the echo, and an `encrypted` field is never echoed at all. A supplied empty or whitespace-only Status string clears Status; null or omitted Status preserves it. An already-empty Status echo does not create a revision.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiAccount"}}}},"401":{"description":"Authentication required"},"403":{"description":"forbidden: missing accounts:write, or a Field-Security-masked field was submitted by a credential that may not read it"},"404":{"description":"No such account for this credential"},"409":{"description":"account_read_only: the stored account is Blocked or Closed and the body supplies any patchable field (first_name, last_name, country, language or status), including null. Status is Lead Status, so status-only and mixed patches are also refused; unknown keys keep their existing behavior. No account write occurs. This state refusal is unsealed and same-key retries recheck it; a previously sealed success still replays even if the account is now blocked"},"412":{"description":"The account changed since the supplied ETag. Internal writes that change nothing this API returns (e.g. funnel tracking) do not count, so the ETag a create or read returned stays usable across them"},"422":{"description":"The body is not a JSON object, is an empty patch, changes nothing, carries the Field-Security unchanged sentinel, or the If-Match is malformed. Also `validation_failed` with `errors[].field` when a changed first_name, last_name or country breaks the account content rules (a blank is not judged)"},"503":{"description":"Write contention — retry. Otherwise, required field protection is unavailable or the workspace's field-security rules cannot be resolved. Retrying alone does not resolve these conditions: contact your administrator to restore field protection or repair the workspace hierarchy, respectively. Requests remain refused until the affected configuration is repaired. Distinguish them by the `code`: `write_contention` is the retry-safe one."}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/timeline":{"get":{"tags":["platform-accounts"],"operationId":"get_timeline","parameters":[{"name":"id","in":"path","description":"Account id","required":true,"schema":{"type":"string"}},{"name":"types","in":"query","description":"Comma-separated source slugs. Absent/blank ⇒ every permitted source.","required":false,"schema":{"type":["string","null"]}},{"name":"from_ms","in":"query","description":"Window start, epoch ms (inclusive).","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"to_ms","in":"query","description":"Window end, epoch ms (inclusive).","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"cursor","in":"query","description":"Opaque keyset cursor echoed from the prior page's `next_cursor`.","required":false,"schema":{"type":["string","null"]}},{"name":"page_size","in":"query","description":"Page size. Defaults to 50, clamped to 1..=200.","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"closes","in":"query","description":"`triggered` (default) — only take-profit / stop-loss / stop-out closes;\n`all` — every close, including the ones an operator or partner performed.","required":false,"schema":{"type":["string","null"]}},{"name":"since_revision","in":"query","description":"**Delta fetch.** The ACCOUNT tenant revision the caller has already\napplied — typically the last one the account WebSocket pushed. Narrows\nevery account-tenanted arm to `revision > since_revision`, so a socket\nwake costs one small page instead of re-reading the head of the timeline.\n\nAdditive and independent of `cursor`: with neither, the first page is the\nhead as before. The firm-tenanted `automation` arm is NOT narrowed —\nrevisions are per-tenant sequences, so an account watermark says nothing\nabout a firm revision; those rows are served in full and the caller\nmerges them by `(source, record_id)`, exactly as it must anyway.","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"One account's two-sided timeline, newest first","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTimelinePage"}}}},"400":{"description":"Malformed cursor"},"401":{"description":"Authentication required"},"403":{"description":"`accounts:read` not granted, or not admitted by the firm ceiling"},"404":{"description":"No such account for this credential (also the answer for a delegated trader token)"},"422":{"description":"Invalid `closes` filter, or a window too wide to serve"},"503":{"description":"This firm's Field-Security policies could not be resolved, so the response cannot be masked correctly and is refused rather than served"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/timeline/days":{"get":{"tags":["platform-accounts"],"operationId":"get_timeline_days","parameters":[{"name":"id","in":"path","description":"Account id","required":true,"schema":{"type":"string"}},{"name":"types","in":"query","description":"Comma-separated source slugs. Absent/blank ⇒ every permitted source.","required":false,"schema":{"type":["string","null"]}},{"name":"from_ms","in":"query","description":"Window start, epoch ms (inclusive). Defaults to 365 days ago.","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"to_ms","in":"query","description":"Window end, epoch ms (inclusive).","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"tz","in":"query","description":"IANA zone the buckets are cut in — `Asia/Jerusalem`, `UTC`, …","required":true,"schema":{"type":"string"}},{"name":"closes","in":"query","description":"`triggered` (default) includes only take-profit, stop-loss and stop-out closes; `all` includes every close, including operator and partner closes.","required":false,"schema":{"type":["string","null"]}},{"name":"granularity","in":"query","description":"`day` (default) or `month`.","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Per-day (or per-month) two-sided counts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTimelineDaysPage"}}}},"401":{"description":"Authentication required"},"403":{"description":"`accounts:read` not granted, or not admitted by the firm ceiling"},"404":{"description":"No such account for this credential (also the answer for a delegated trader token)"},"422":{"description":"Invalid time zone, granularity or `closes` filter, or a window too wide to serve"},"503":{"description":"This firm's Field-Security policies could not be resolved, so the response cannot be masked correctly and is refused rather than served"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/trading-accounts":{"post":{"tags":["platform-accounts"],"operationId":"create_trading_account","parameters":[{"name":"id","in":"path","description":"Parent account id","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"REQUIRED. Scoped to this credential and parent account. An ambiguous prior create returns a sealed 409; retries with that key replay the refusal. Check POST /api/v1/accounts/status/query for the child using a read-scoped credential (accounts:read or replication:read), then retry with a NEW Idempotency-Key.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateTradingAccountRequest"}}},"required":true},"responses":{"201":{"description":"Trading account provisioned; an external login may be pending","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradingAccount"}}}},"400":{"description":"Idempotency-Key required"},"401":{"description":"Authentication required"},"403":{"description":"accounts:write required"},"404":{"description":"Account not in reach"},"409":{"description":"Key reused with another request, another attempt holds the lease, or a prior create has an unknown outcome. The unknown-outcome refusal is sealed and same-key retries replay it: check POST /api/v1/accounts/status/query for the child using a read-scoped credential (accounts:read or replication:read), then retry with a NEW Idempotency-Key. Or account_read_only: the current account is Blocked or Closed; a refused create is sealed: after unblock, retry with a NEW Idempotency-Key. No child is provisioned on this refusal. A previously sealed success still replays after a later block."},"422":{"description":"Trading configuration or currency invalid"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/trading-accounts/{ta_id}/closed-positions":{"get":{"tags":["Trading reads"],"description":"Closed slices ordered by (close_time,id) descending; [from,to) uses close_time in epoch milliseconds. Empty history returns rows: []. IDs and decimal quantities are strings. Field-security withheld values are null. Keyset limit defaults to 100, maximum 500.","operationId":"closed_positions","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"ta_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","description":"Inclusive epoch milliseconds (close_time for positions; received_at for orders).","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"to","in":"query","description":"Exclusive epoch milliseconds.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Default 100, maximum 500.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"state","in":"query","description":"Orders only: Rejected, Placed, Confirmed.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiClosedPositionPage"}}}},"400":{"description":"Invalid range/cursor"},"401":{"description":"Authentication required"},"403":{"description":"positions:read required"},"404":{"description":"Account or trading account not visible"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/trading-accounts/{ta_id}/orders":{"get":{"tags":["Trading reads"],"description":"All trade_request outcomes including Rejected and its reason. Date range [from,to) filters received_at epoch milliseconds. Record-id keyset order descending. Execution bid/ask/timestamp are null when no snapshot was stored. quote_bid/ask_at_execution are the raw feed quote; quote_bid/ask_marked_at_execution are the marked quote (raw plus the trading-terms markup) a market fill is priced against. An operator price override or the order's limit or trigger level takes precedence over the quote. On a close order, side is the side of the position being closed. position_to_close is the stored close target; resulting position identifiers are unavailable for opening orders. Feed source and client send time are included when stored and permitted.","operationId":"orders","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"ta_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","description":"Inclusive epoch milliseconds (close_time for positions; received_at for orders).","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"to","in":"query","description":"Exclusive epoch milliseconds.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Default 100, maximum 500.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"state","in":"query","description":"Orders only: Rejected, Placed, Confirmed.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOrderPage"}}}},"400":{"description":"Invalid range/state/cursor"},"401":{"description":"Authentication required"},"403":{"description":"orders:read required"},"404":{"description":"Account or trading account not visible"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/trading-accounts/{ta_id}/pending-orders":{"get":{"tags":["Trading reads"],"description":"Returns all pending orders for the authorized trading account (no paging). Empty state is []. IDs and decimal quantities are strings. Field-security withheld values are null.","operationId":"pending_orders","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"ta_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiPendingOrderRead"}}}}},"401":{"description":"Authentication required"},"403":{"description":"positions:read required"},"404":{"description":"Account or trading account not visible"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/trading-accounts/{ta_id}/reconciliation":{"get":{"tags":["Trading reads"],"operationId":"reconciliation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"ta_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"balance","in":"query","required":true,"schema":{"type":"string"}},{"name":"credit","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReconciliation"}}}},"400":{"description":"balance or credit is not a decimal, or the delta overflows"},"401":{"description":"Authentication required"},"403":{"description":"transactions:read required, or money is masked or encrypted"},"404":{"description":"Account or trading account not visible"}},"security":[{"bearerAuth":[]}]}},"/api/v1/accounts/{id}/trading-accounts/{ta_id}/statistics":{"get":{"tags":["Trading reads"],"description":"Same source figures as the trading terminal. Deposits and return_pct are null unless transactions:read is granted by the credential and firm ceiling, and neither monetary_transaction amount nor usd_value is masked. period= selects the terminal period. Deposits match the trading platform brokers reconcile against, including a Prop challenge account's starting balance; WebTrader Insights leaves that starting balance out of its Deposits, so the two differ on Prop challenge accounts. Every other figure is identical to WebTrader; IDs and decimal quantities use precision-preserving strings. Without period, also exposes all-time by_symbol allocation. from/to is [from,to) on position close time. That form has kind=range and returns analytics, range, currency, digits, quality and live, with no statistics rows and no by_symbol. A master gets every live figure null. A summary keeps live equity and margin only. The range is 403 when closed_position profit, swap or commission is masked. from or to together with period is 400 range_and_period. from after to is 400 invalid_range. Deposits and return_pct are absent on a range. Best trade per symbol and engine-qualified profitable_days stay deferred.","operationId":"statistics","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"ta_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"period","in":"query","description":"Stored terminal period: 1w,1m,3m,6m,1y,all,today,this_week. Omit for every stored period.","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","description":"Inclusive epoch milliseconds on position close time. With `to`, this is a range, not a period.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"to","in":"query","description":"Exclusive epoch milliseconds on position close time.","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStatisticsBody"}}}},"400":{"description":"Invalid period, range_and_period, or from after to"},"401":{"description":"Authentication required"},"403":{"description":"positions:read required"},"404":{"description":"Account or trading account not visible"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/catalog":{"get":{"tags":["instances"],"operationId":"get_catalog","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"instance:admin required"},"503":{"description":"Inventory unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/releases":{"get":{"tags":["instances"],"operationId":"get_releases","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleasesResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"instance:admin required"},"503":{"description":"Store unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/releases/{family}":{"put":{"tags":["instances"],"operationId":"set_release","parameters":[{"name":"family","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetRelease"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstanceRelease"}}}},"401":{"description":"Authentication required"},"403":{"description":"Allowlisted instance:release required"},"422":{"description":"Invalid family/image"},"503":{"description":"Release store unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/self":{"get":{"tags":["instances"],"operationId":"listing","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstanceSelfResponse"}}}},"401":{"description":"Inactive, revoked or disabled instance"},"403":{"description":"Not a risk instance:self credential"},"503":{"description":"Store or inventory unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/self/firms/{firm_id}/certificate":{"post":{"tags":["instances"],"operationId":"certificate","parameters":[{"name":"firm_id","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SealedCertificate"}}}},"401":{"description":"Inactive, revoked or disabled instance"},"403":{"description":"Not a risk instance:self credential"},"404":{"description":"No such firm on this instance"},"409":{"description":"delivery_key_unregistered, firm_disabled, thumbprint_changed or certificate_unavailable (in `reason`)"},"422":{"description":"Invalid firm id or body"},"503":{"description":"KMS or store unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/status":{"post":{"tags":["instances"],"operationId":"transition","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transition"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransitionAccepted"}}}},"401":{"description":"Active edge-bound instance required"},"403":{"description":"Required service scope missing"},"422":{"description":"Invalid body/session/detail"},"503":{"description":"Status store or beat key unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/{key}/controller":{"post":{"tags":["instances"],"operationId":"controller","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControllerReport"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstanceStatus"}}}},"204":{"description":"Removal cleanup complete"},"401":{"description":"Authentication required"},"403":{"description":"Required service scope missing"},"404":{"description":"Instance not found"},"409":{"description":"Source still exists"},"422":{"description":"Invalid key or request body"},"503":{"description":"Inventory or cleanup unavailable; retry"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instances/{key}/credential":{"post":{"tags":["instances"],"operationId":"handover_instance_credential","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"The body may be omitted; when present, it must be an empty object.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmptyRequest"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialPair"}}}},"204":{"description":"Sealed credential delivery completed"},"401":{"description":"Authentication required"},"403":{"description":"instance:admin required"},"404":{"description":"Instance not found"},"409":{"description":"Source stopped/blocked/unmanaged"},"422":{"description":"Invalid key or request body"},"503":{"description":"Inventory or delivery unavailable; retry"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instruments":{"get":{"tags":["user-api"],"operationId":"list_instruments","responses":{"200":{"description":"Every instrument the workspace's assigned packs make tradable, ordered by symbol","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiInstrument"}}}}},"401":{"description":"Missing, malformed, unknown, disabled or expired token"},"403":{"description":"The token carries neither instrument-read entitlement within its owner's ceilings"}},"security":[{"bearerAuth":[]}]}},"/api/v1/instruments/{instrument_id}/bars":{"get":{"tags":["Instruments"],"description":"Uses the trading terminal’s chart source and bid-price markup. Prices and volume are decimal strings; ts is UTC epoch milliseconds. Max ranges: 1m 7d; 2m 6d; 3m 10d; 5m 30d; 10m 34d; 15m 90d; 30m 180d; 1h 365d; 2h 730d; 3h 625d; 4h 1460d; daily/weekly/monthly 3650d. The terminal engine also caps every request at 5000 bars. Use from/to or rolling window (1h,24h,7d,30d), exclusively. Bounds are UTC RFC3339; [from,to).","operationId":"bars","parameters":[{"name":"instrument_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"trading_terms_id","in":"query","description":"Required; the stored term must belong to the caller's firm.","required":true,"schema":{"type":"string"}},{"name":"timeframe","in":"query","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","description":"RFC3339 UTC, inclusive. Use either from/to or window.","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"RFC3339 UTC, exclusive.","required":false,"schema":{"type":"string"}},{"name":"window","in":"query","description":"Rolling window ending now: 1h, 24h, 7d, or 30d.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiBarRead"}}}}},"400":{"description":"Invalid or excessive range"},"401":{"description":"Authentication required"},"403":{"description":"instruments:read required"},"404":{"description":"Trading term or instrument not visible"}},"security":[{"bearerAuth":[]}]}},"/api/v1/oauth/token":{"post":{"tags":["user-api"],"operationId":"token","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/TokenRequestForm"}}},"required":true},"responses":{"200":{"description":"A minted bearer token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"invalid_request / unsupported_grant_type / invalid_scope / invalid_grant"},"401":{"description":"invalid_client — unknown/bad/revoked/IP-blocked (uniform, non-enumerating)"},"429":{"description":"rate_limited — token-mint fixed window exceeded"},"503":{"description":"service_unavailable — a temporary server-side failure, not a verdict on the credential; retry later"}}}},"/api/v1/positions/close":{"post":{"tags":["platform-positions"],"operationId":"close_position","parameters":[{"name":"Idempotency-Key","in":"header","description":"REQUIRED.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiClosePositionRequest"}}},"required":true},"responses":{"200":{"description":"The close reached a terminal state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradeRequest"}}}},"202":{"description":"Delayed execution: the latest snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradeRequest"}}}},"401":{"description":"Authentication required"},"403":{"description":"Scope not granted, or a read-only delegated credential"},"404":{"description":"No such account / trading account / position"},"422":{"description":"Validation failed"}},"security":[{"bearerAuth":[]}]}},"/api/v1/positions/open":{"post":{"tags":["platform-positions"],"operationId":"open_position","parameters":[{"name":"Idempotency-Key","in":"header","description":"REQUIRED. Scoped to (credential, trading_account_id): a retry re-runs against the SAME TradeRequest id, so the margin fold can never double-apply.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOpenPositionRequest"}}},"required":true},"responses":{"200":{"description":"The order reached a terminal state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradeRequest"}}}},"202":{"description":"Delayed execution: the latest snapshot; poll for the outcome","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradeRequest"}}}},"401":{"description":"Authentication required"},"403":{"description":"Scope not granted, read-only credential, or trader verification required"},"404":{"description":"No such account / trading account for this credential"},"409":{"description":"Another request with this Idempotency-Key is in flight"},"422":{"description":"Validation failed"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-challenges/{id}/breaches":{"get":{"tags":["platform-prop"],"description":"Requires prop-challenges:read (broker credentials only). account_id is a required CRM account locator. items: zero or one retained canonical MaxDailyLoss/MaxTotalLoss latch (thresholds and historical action unavailable). breaches: the append-only breach history — every fail reason and daily-profit freeze, oldest decision first, each with the enforcement actions that landed (lock; cancel_orders / close_positions per pass with its count); figures only for equity rails; a lock already in force is not taken again and has no row. history_complete is true only when breaches is the whole history (recorded since the challenge's creation, not imported, nothing missing or unreadable); false does not prove a missing breach. A Fail committed where no evidence is written in its own transaction (the chargeback cascade, an older build) is recorded at its completion, without figures and without a lock row. Figures and optional quotes are persisted at detection, never refreshed; quotes may be absent and do not identify a single causal price. Rule versions are historical. current_challenge is current state, not the action taken at the breach. DB/unreadable progress errors are problems, never empty success.","operationId":"get_breaches","parameters":[{"name":"id","in":"path","description":"Challenge id within the named CRM account","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"CRM account owning the challenge. A challenge id alone is not a safe locator.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropBreaches"}}}},"401":{"description":"Authentication required"},"403":{"description":"Missing scope or delegated trader"},"404":{"description":"Invalid locator, unentitled or invisible account/challenge"},"500":{"description":"Evidence store or progress unreadable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-discounts/validate":{"post":{"tags":["platform-prop"],"operationId":"validate_discount","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropDiscountValidateRequest"}}},"required":true},"responses":{"200":{"description":"`{valid, status}` — whether the code applies to this exact choice. A code that does not apply is an answer (`valid: false` and its `status`), never an error. Reserves nothing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropDiscountValidateResponse"}}}},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:read`"},"404":{"description":"`not_found` — no such account for this credential, or prop is not enabled"},"409":{"description":"`invalid_state` — the account must complete verification first; `detail` is the code: `verification_required_to_pay`, `verification_required_for_amount`"},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"422":{"description":"`validation_failed` — the choice itself is wrong; `detail` is the code: `unknown_field`, `invalid_body`, `plan_not_found`, `size_not_found`, `addon_not_offered`, `addon_duplicate`, `quote_code_not_applicable`, …"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-plans":{"get":{"tags":["platform-prop"],"operationId":"list_plans","parameters":[{"name":"country","in":"query","description":"Two-letter country code of the buyer. A plan sold only elsewhere is not listed; absent = every active plan.","required":false,"schema":{"type":"string"}},{"name":"currency","in":"query","description":"The plan currency (`USD`, …). Absent = every currency.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The plans this firm sells right now, with sizes, phases, rules and the add-ons each sells. Money and rates are decimal strings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropPlansResponse"}}}},"400":{"description":"`malformed_query`: a query parameter is repeated or badly encoded"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:read`"},"404":{"description":"`not_found` — prop is not enabled for this credential's firm"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-purchases":{"post":{"tags":["platform-prop"],"operationId":"create_purchase","parameters":[{"name":"Idempotency-Key","in":"header","description":"REQUIRED — a canonical lowercase UUID. It is also the purchase's own idempotency key: the same key answers the same purchase.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropPurchaseRequest"}}},"required":true},"responses":{"201":{"description":"`{purchase, payment_required}`. `payment_required: true` ⇒ `pending` until the `POST /api/v1/transactions` deposit naming it (`prop_purchase_id`) is approved; `false` ⇒ already `settled` with its `challenge_id` (a free plan, or a total of zero).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropPurchaseResponse"}}}},"400":{"description":"`idempotency_key_required` — missing, or not a canonical lowercase UUID"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:write`, or it is a delegated trader token"},"404":{"description":"`not_found` — no such account for this credential, or prop is not enabled"},"409":{"description":"`invalid_state` — the state forbids it; `detail` is the code: `purchase_plan_changed`, `purchase_pending_limit_reached`, `free_trial_concurrent_cap`, `free_trial_lifetime_cap`, `purchase_account_currency_unresolved`, `purchase_kyc_required`, `purchase_profile_incomplete`, `contact_field_platform_owned`, `purchase_real_account_required`, `purchase_deposit_not_qualified`, `purchase_us_resident_blocked`, `purchase_reverse_solicitation_blocked`, `purchase_support_required`, `verification_required_to_pay`, `verification_required_for_amount`. Or `idempotency_in_flight` — an attempt with this key is still running; or `idempotency_conflict` — this key was already used with a different body. **A refusal of state that can change is NOT stored under the key** (`purchase_plan_changed`, `purchase_pending_limit_reached`, `free_trial_concurrent_cap`, `purchase_kyc_required`, `purchase_profile_incomplete`, `contact_field_platform_owned`, `purchase_real_account_required`, `verification_required_to_pay`, `verification_required_for_amount`, `purchase_deposit_not_qualified` — the broker's deposit limits moved): nothing was written, so retry the SAME request with the SAME Idempotency-Key once the state moved. After `purchase_plan_changed`, re-read the plan (`GET /api/v1/prop-plans`) and resend with the new `revision` as `expected_plan_revision` (a precondition, not part of the request's identity) under the same key. Every other refusal is final for its key and the same Idempotency-Key replays it verbatim; changing the request needs a new key"},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"422":{"description":"`validation_failed` — the request is wrong; `detail` is the code: any quote refusal, `discount_<status>`, `purchase_free_trial_no_expiry`. Two discount refusals count slots that free up (a held slot of a capped code is released after its ~15 minute hold, a pending purchase fails or expires) and are **NOT stored under the key** either: `discount_try_exceeded` and `discount_per_account_limit_exceeded` — retry the SAME request with the SAME Idempotency-Key later, or drop the code (a new request, a new key). Every other 422 is final for its key"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-purchases/{id}":{"get":{"tags":["platform-prop"],"operationId":"get_purchase","parameters":[{"name":"id","in":"path","description":"The purchase","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"REQUIRED — the account that bought it","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"`{purchase, payment_required}` — the purchase as created, with its current status and the `challenge_id` once it exists. Reading settles nothing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropPurchaseResponse"}}}},"400":{"description":"`malformed_query` (a query parameter is repeated or badly encoded) or `malformed_path`"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:read`"},"404":{"description":"`not_found` — no such account or purchase for this credential"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-purchases/{id}/retry":{"get":{"tags":["platform-prop"],"operationId":"get_retry_offer","parameters":[{"name":"id","in":"path","description":"The ORIGINAL purchase whose challenge failed","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"REQUIRED — the account that bought it","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The retry offer, computed on the platform. `available: false` carries its `unavailable_reason` (or the `pending_purchase_id` of a retry already waiting for payment). An open offer names in `purchase_blocked_by` the purchase gate that would refuse buying it (and, for `purchase_pending_limit_reached`, the open checkout it binds in `purchase_blocked_purchase_id`), so `prop-challenges:read` exposes that account's purchase-gate state (KYC, verification, deposit limits…) — only for an account this credential can reach.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropRetryOffer"}}}},"400":{"description":"`malformed_query` (a query parameter is repeated or badly encoded) or `malformed_path`"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:read`"},"404":{"description":"`not_found` — no such account or purchase for this credential"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]},"post":{"tags":["platform-prop"],"operationId":"buy_retry","parameters":[{"name":"id","in":"path","description":"The ORIGINAL purchase whose challenge failed","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"REQUIRED — the account that bought it","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"REQUIRED — a canonical lowercase UUID.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropRetryRequest"}}},"required":true},"responses":{"201":{"description":"`{purchase, payment_required}` — the retry purchase (`mode: retry`, `retry_of` = the purchase retried, always the lineage's newest failed purchase; priced from the lineage's original), at the original size and add-ons. Paid like any purchase.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropPurchaseResponse"}}}},"400":{"description":"`idempotency_key_required` — missing, or not a canonical lowercase UUID"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:write`, or it is a delegated trader token"},"404":{"description":"`not_found` — no such account or original purchase for this credential"},"409":{"description":"`invalid_state` — the retry is not open now; `detail` is the code: `retry_not_offered`, `purchase_retry_not_settled`, `purchase_retry_challenge_not_failed`, `purchase_retry_expired`, `purchase_retry_limit_reached`, `purchase_retry_plan_unavailable`, `purchase_retry_not_priceable`, `purchase_retry_in_progress`, `purchase_retry_in_flight` (pay the retry already waiting), `retry_already_paid` (an earlier retry of this purchase was paid; never re-opened), `retry_payment_pending` (an earlier retry of this purchase still has a payment that is not final), `purchase_retry_superseded` (only the lineage's newest failed purchase can be retried), or any purchase state refusal. Or `idempotency_in_flight`; or `idempotency_conflict` — this key was already used with a different request. **A refusal of state that can change is NOT stored under the key** (`purchase_retry_in_flight`, `purchase_retry_in_progress`, `purchase_retry_not_settled`, `purchase_retry_challenge_not_failed`, `retry_payment_pending`, `purchase_pending_limit_reached`, and the purchase state refusals the create names): nothing was written, so retry with the SAME Idempotency-Key once the state moved. Every other refusal (`retry_not_offered`, `purchase_retry_expired`, `purchase_retry_limit_reached`, `retry_already_paid`, `purchase_retry_superseded`, …) is final for its key and the same Idempotency-Key replays it verbatim"},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"422":{"description":"`validation_failed` — `unknown_field` / `invalid_body` (the body must be `{}`)"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/prop-quotes":{"post":{"tags":["platform-prop"],"operationId":"create_quote","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropQuoteRequest"}}},"required":true},"responses":{"200":{"description":"The price this account would pay for this choice, line by line; `total` includes the discount. A code that does not apply never fails the quote: `discount` carries it with `applied: false` and its `status`, and `total` stays the subtotal. Reserves nothing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPropQuote"}}}},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"`forbidden` — the credential lacks `prop-challenges:read`"},"404":{"description":"`not_found` — no such account for this credential, or prop is not enabled"},"409":{"description":"`invalid_state` — the account must complete verification first; `detail` is the code: `verification_required_to_pay`, `verification_required_for_amount`"},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"422":{"description":"`validation_failed` — `detail` is the code: `unknown_field`, `invalid_body`, `plan_not_found`, `size_not_found`, `addon_not_offered`, `addon_duplicate`, `quote_code_not_applicable`, `plan_target_not_available` or `plan_currency_unknown`"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/account-status":{"post":{"tags":["replication"],"summary":"Read live account balances for replication.\nAccount IDs are restricted to the firms and brands accessible to the calling credential.","operationId":"account_status","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStatusRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiStatusResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"Enabled bind credential required"},"503":{"description":"Live P&L unavailable"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/bind":{"get":{"tags":["replication"],"operationId":"own_bind","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiOwnReplicationBind"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not an enabled bind credential"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/bind/status":{"post":{"tags":["replication"],"operationId":"own_status","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationBindStatusReport"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationBindStatusAck"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not an enabled bind credential"},"422":{"description":"Invalid status"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/binds":{"get":{"tags":["replication"],"summary":"`GET /api/v1/replication/binds`","operationId":"list_binds","responses":{"200":{"description":"Every replication bind; ready binds carry their target DSN, egress pin and feed bearer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationBindsResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not the platform's replication service credential"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/binds/catalog":{"get":{"tags":["replication"],"operationId":"catalog","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationCatalog"}}}},"401":{"description":"Authentication required"},"403":{"description":"Service credential required"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/binds/{id}/credential":{"post":{"tags":["replication"],"operationId":"handover","parameters":[{"name":"id","in":"path","description":"Enabled bind record id","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationCredential"}}}},"401":{"description":"Authentication required"},"403":{"description":"Service credential or enabled bind required"},"404":{"description":"No such bind"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/binds/{id}/status":{"post":{"tags":["replication"],"summary":"`POST /api/v1/replication/binds/{id}/status`","operationId":"report_status","parameters":[{"name":"id","in":"path","description":"Replication bind record id","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationBindStatusReport"}}},"required":true},"responses":{"200":{"description":"Recorded (unchanged reports are coalesced)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationBindStatusAck"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not the platform's replication service credential"},"404":{"description":"No such bind"},"422":{"description":"Unknown state"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/changes":{"post":{"tags":["replication"],"summary":"`POST /api/v1/replication/changes`","operationId":"changes","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationChangesRequest"}}},"required":true},"responses":{"200":{"description":"One ascending page of changes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationChangesResponse"}}}},"400":{"description":"Cursor absent, tampered, from another domain, or minted for another firm"},"401":{"description":"Authentication required"},"403":{"description":"The credential lacks `replication:read`, or the firm ceiling withdrew the read"},"410":{"description":"The cursor cannot be safely resumed; re-snapshot"},"503":{"description":"Field-security policy could not be resolved for this firm, or the source database has no instance id"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/daily-history":{"get":{"tags":["replication"],"summary":"`GET /api/v1/replication/daily-history`","operationId":"daily_history","parameters":[{"name":"since","in":"query","description":"Start a fresh walk at this instant, INCLUSIVE. RFC3339 UTC. Mutually\nexclusive with `cursor`. Absent ⇒ from the beginning of the history.","required":false,"schema":{"type":["string","null"]}},{"name":"cursor","in":"query","description":"Resume a walk. Opaque; mutually exclusive with `since`.","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","description":"Page size, default 100, clamped to 1000.","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"One ascending page of daily-history rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationDailyHistoryResponse"}}}},"400":{"description":"Cursor tampered, from another domain, or minted for another firm"},"401":{"description":"Authentication required"},"403":{"description":"The credential lacks `replication:read`, or the firm ceiling withdrew the read"},"422":{"description":"`since` is not an RFC3339 instant, or both `since` and `cursor` were given"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/daily-history/runs":{"get":{"tags":["replication"],"summary":"`GET /api/v1/replication/daily-history/runs`","operationId":"daily_history_runs","parameters":[{"name":"day","in":"query","description":"The local trading date the run covers, ISO `YYYY-MM-DD`. Required —\nmodelled as optional only so its absence is this surface's own 422 rather\nthan the framework's bare 400.","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"The completed nightly runs for that day, plus this firm's row count","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationDailyRunsResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"The credential lacks `replication:read`, or the firm ceiling withdrew the read"},"422":{"description":"`day` is absent or is not an ISO date"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/digest":{"post":{"tags":["replication"],"summary":"`POST /api/v1/replication/digest`","operationId":"digest","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationDigestRequest"}}},"required":true},"responses":{"200":{"description":"Per-tenant digests plus the whole-firm rollup","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationDigestResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"The credential lacks `replication:read`, or the firm ceiling withdrew the read"},"413":{"description":"The firm has more accounts than one digest call folds; pass explicit `tenants` batches"},"422":{"description":"`kind` is not a replicated kind, or the tenant list is oversized or malformed"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/snapshot":{"post":{"tags":["replication"],"summary":"`POST /api/v1/replication/snapshot`","operationId":"snapshot","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationSnapshotRequest"}}},"required":true},"responses":{"200":{"description":"One ascending page of live records","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationSnapshotResponse"}}}},"400":{"description":"Cursor tampered, from another domain, or minted for another firm or kind"},"401":{"description":"Authentication required"},"403":{"description":"The credential lacks `replication:read`, or the firm ceiling withdrew the read"},"422":{"description":"`kind` is not a replicated kind, or the tenant list is oversized or malformed"},"503":{"description":"Field-security policy could not be resolved for this firm, or the source database has no instance id"}},"security":[{"bearerAuth":[]}]}},"/api/v1/replication/whoami":{"get":{"tags":["replication"],"summary":"`GET /api/v1/replication/whoami`","operationId":"whoami","responses":{"200":{"description":"The firm, brand clamp and scopes this credential carries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiReplicationWhoami"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not a broker credential"}},"security":[{"bearerAuth":[]}]}},"/api/v1/trading-terms":{"get":{"tags":["user-api"],"operationId":"list_trading_terms","responses":{"200":{"description":"Every trading-terms tier in the workspace","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiTradingTermSummary"}}}}},"401":{"description":"Missing, malformed, unknown, disabled or expired token"},"403":{"description":"The token does not carry `workspace.trading_terms` within its owner's ceilings"}},"security":[{"bearerAuth":[]}]},"post":{"tags":["user-api"],"summary":"Create a trading-terms tier in the credential's firm.","description":"`product` (`Cfd` / `Equity`) is honoured only when at least one of the firm's\nbrands has Equities Trading enabled. On a firm proven not to offer\nstock trading, a CREATE carrying product-restricted netting settings gets\nserver-stamped `Cfd`, including when `product` is omitted or null. Plain\nnon-stock creates keep no product. Lookup failures never grant this default.\nStock-enabled firms still need a verified `Cfd` product for netting; Equity or missing product is refused\nwith 409 `netting_product_excluded`. The existing workspace/venue guards apply.\nAbsent netting settings mean `Inherit`. Successful creates return HTTP 200.","operationId":"create_trading_terms","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateTradingTermsRequest"}}},"required":true},"responses":{"200":{"description":"The tier, created in the credential's firm","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradingTermsWriteResponse"}}}},"400":{"description":"The tier's `trading_system_id` is unset or does not exist, or — for a firm with Equities Trading enabled on at least one brand — `product` is not one of `Cfd`, `Equity`, or an Equities (`Equity`) tier breaks its rules (internal only, leverage 1, capped margin-call / stop-out levels), or a netting setting (`position_mode`, `netting_cancel_pending`, `netting_commission`) is not one of its values"},"401":{"description":"Missing, malformed, unknown, disabled or expired credential"},"403":{"description":"The credential does not carry `trading-terms:write` within its firm ceiling"},"409":{"description":"`invalid_state` with `detail` `netting_disabled`: netting is not enabled for the firm's workspace and `terms` carries a value that only applies to netting accounts (`position_mode` `Netting`, `netting_cancel_pending` `On` or `netting_commission` `EveryOrder`); `errors` names each such field. Nothing was written. Or `detail` `netting_broker_platform`: the tier is MT5- or MT4-backed (`mt5_group` / `mt4_group` set), so its position mode is the broker platform's, and `terms` carries `position_mode`, `netting_cancel_pending` or `netting_commission` with a value other than `Inherit` / `null`; `errors` names each such field and the body's `reason` member is `mt5` or `mt4`. This refusal does not depend on whether netting is enabled. Nothing was written. Or `detail` `netting_product_excluded`: a new tier with product-restricted netting settings has Equity or an unverified product (`reason` `equity` or `unknown`). Stock-enabled firms require verified Cfd; only a firm proven not to offer stocks receives the server Cfd default for this create"}},"security":[{"bearerAuth":[]}]}},"/api/v1/trading-terms/{id}":{"get":{"tags":["user-api"],"operationId":"get_trading_term","parameters":[{"name":"id","in":"path","description":"Trading-terms tier id, from the list endpoint","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"The tier, with every instrument it configures","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradingTermDetail"}}}},"401":{"description":"Missing, malformed, unknown, disabled or expired token"},"403":{"description":"The token does not carry `workspace.trading_terms` within its owner's ceilings"},"404":{"description":"No such tier in this workspace"}},"security":[{"bearerAuth":[]}]},"put":{"tags":["user-api"],"summary":"Update a trading-terms tier in the credential's firm.","description":"When at least one of the firm's brands has Equities Trading enabled, the\nbody's `product` is applied as sent — set, changed, or cleared by sending\n`null`; a body that omits `product` keeps the stored value. Otherwise the\ntier's stored `product` is kept whatever the body carries.\n\nThe netting settings (`position_mode`, `netting_cancel_pending`,\n`netting_commission`) are applied as sent; a body that omits one keeps the stored\nvalue, and `null` resets it to `Inherit`. A netting value the tier does not already\nstore is refused while netting is not enabled for the workspace.","operationId":"update_trading_terms","parameters":[{"name":"id","in":"path","description":"Trading-terms tier id to update","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUpdateTradingTermsRequest"}}},"required":true},"responses":{"200":{"description":"The tier, updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTradingTermsWriteResponse"}}}},"400":{"description":"The tier's `trading_system_id` is unset or does not exist, `product` is not one of `Cfd`, `Equity`, the tier is an Equities (`Equity`) tier and its product, risk or routing parameters break its rules (internal only, leverage 1, capped margin-call / stop-out levels), `product` would become `Equity` on a tier that is a lead-routing default or a trading-assignment target, or a netting setting (`position_mode`, `netting_cancel_pending`, `netting_commission`) is not one of its values"},"401":{"description":"Missing, malformed, unknown, disabled or expired credential"},"403":{"description":"The credential does not carry `trading-terms:write` within its firm ceiling"},"404":{"description":"No such tier in this firm"},"409":{"description":"`invalid_state`. With `detail` `netting_disabled`: netting is not enabled for the firm's workspace and the write would add a value that only applies to netting accounts (`position_mode` `Netting`, `netting_cancel_pending` `On` or `netting_commission` `EveryOrder`) that the tier does not already store; `errors` names each such field, and nothing was written. With `detail` `netting_open_positions`: the write would switch trading accounts on the tier that hold open positions from Hedging to Netting (a pending order alone never counts; MT5/MT4, MAM and prop accounts never do); the body's `accounts` member is how many, `errors` names `terms.position_mode`, and nothing was written. Close or settle those positions, then retry. With `detail` `netting_broker_platform`: the tier as this write would store it is MT5- or MT4-backed (`mt5_group` / `mt4_group` set), so its position mode is the broker platform's, and the write would set `position_mode`, `netting_cancel_pending` or `netting_commission` to a value other than `Inherit` / `null` that the tier does not already store as an MT5/MT4-backed tier; `errors` names each such field, the body's `reason` member is `mt5` or `mt4`, and nothing was written. On such a tier each of the three can only stay as stored or be reset; a tier that gains an MT5/MT4 group must reset them in the same write. This refusal does not depend on whether netting is enabled. Otherwise: `product` would change between CFD and Equities while trading accounts on the tier hold open positions or pending orders. Or `detail` is the code `prop_challenge_tier_retag_refused`: the write changes what the tier trades (its `product`, or its MT5/MT4 group — set, cleared or swapped) while at least one trading account on the tier carries a live prop challenge, whose tier is the plan the trader bought — Internal (Leverate) and MT5/MT4 challenge accounts alike. Not retryable until those challenges end; nothing was written. This endpoint never re-tiers or opens a prop challenge account — sell and re-sell challenges through the prop endpoints instead: `GET /api/v1/prop-plans` (list plans), `POST /api/v1/prop-quotes` (quote), `POST /api/v1/prop-purchases` (purchase), `GET`/`POST /api/v1/prop-purchases/{id}/retry` (retry), `POST /api/v1/prop-discounts/validate` (discount-code validation)"}},"security":[{"bearerAuth":[]}]}},"/api/v1/transactions":{"post":{"tags":["platform-transactions"],"operationId":"create_transaction","parameters":[{"name":"Idempotency-Key","in":"header","description":"REQUIRED. Scoped to (credential, client_reference_id), so two intentionally-identical deposits never collide. The key is bound to the request it was first used with: a retry of the same request replays the first answer; the same key + reference with a different request (account, trading account, currency, amount, method, type or `prop_purchase_id`) is 409 `invalid_state` / `idempotency_conflict` and nothing runs. The comparison is over the normalised intent, not the bytes: the amount by value (`\"499.0\"` = `\"499.00\"`) and the currency by its upper-case code (`usd` = `USD`).","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateTransactionRequest"}}},"required":true},"responses":{"201":{"description":"Created, always PENDING. A replay (the same Idempotency-Key and `client_reference_id` with the same intent) answers this same 201 and body: the original answer, never a second transaction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransaction"}}}},"400":{"description":"`idempotency_key_required`: the Idempotency-Key header is missing or malformed"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"Scope not granted (`transactions:write`; a deposit that names `prop_purchase_id` ALSO needs `prop-challenges:write` — it settles that purchase and provisions its challenge), or a read-only delegated credential. A delegated trader token may not name a `prop_purchase_id`. The verification preset refuses with `detail` `verification_blocked` (the account must be approved first) or `verification_deposit_ceiling` (the deposit exceeds what capped access still allows; `errors[]` carries `ceiling`, `remaining` and `currency`)"},"404":{"description":"No such account for this credential"},"409":{"description":"`invalid_state`. `idempotency_conflict`: this Idempotency-Key + `client_reference_id` was already used with a DIFFERENT body — mint a new key for a new intent. Insufficient funds: a withdrawal whose magnitude exceeds the account balance is refused; like every refusal of this create it is final for its key (the same Idempotency-Key replays it) — retry the withdrawal under a NEW key once the balance covers it. Or (`prop_purchase_id`) the named prop purchase is not payable now; `detail` is the code: `prop_purchase_already_linked` (another payment already pays it — a second deposit never settles it twice), `prop_purchase_not_pending` (already settling / settled, or failed, expired, cancelled, charged back), `retry_payment_pending` (an earlier retry of this purchase still has a payment that is not final; never sealed: retry under the SAME key once that payment is final)."},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"415":{"description":"`unsupported_media_type`: the body was sent without a JSON `Content-Type`"},"422":{"description":"`validation_failed`. `malformed_body`: the body is not this request's JSON. A delegated trader token's deposit into a prop challenge account: `prop_challenge_deposit_refused`. With `prop_purchase_id`, `detail` is the code: `prop_purchase_link_requires_deposit` (only a positive Deposit pays a purchase), `prop_purchase_not_found` (not this account's purchase), `prop_purchase_payment_not_required` (nothing is owed), `prop_purchase_amount_mismatch` / `prop_purchase_currency_mismatch` (the deposit must be EXACTLY the purchase total in its currency). Or `currency_required`: the request names no `currency`; or `currency_mismatch`: `currency` is not the trading account's own (no conversion is made)"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/transactions/{id}/approve":{"post":{"tags":["platform-transactions"],"operationId":"approve_transaction","parameters":[{"name":"id","in":"path","description":"Transaction id","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"REQUIRED — the account that owns the transaction. Named, not discovered: `records` is tenant-partitioned, so resolving it server-side would be a cross-partition scan on the money path.","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"REQUIRED.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Approved (deposit or withdrawal without a payment provider)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransaction"}}}},"202":{"description":"Withdrawal through a payment provider — accepted for processing. The funds are reserved and the withdrawal is queued together; it is then sent to the provider asynchronously and settles when the provider's payment notification arrives. The transaction stays PENDING until then. A retry with the same Idempotency-Key replays this 202 and never reserves the funds twice.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransaction"}}}},"400":{"description":"`idempotency_key_required` (the Idempotency-Key header is missing or malformed), `malformed_query` (`account_id` is missing or repeated) or `malformed_path`"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"Scope not granted (`transactions:write`), or `trader_transaction_approval_forbidden`: a delegated trader token cannot approve transactions. A transaction that names a prop purchase also needs `prop-challenges:write`. Approving the purchase deposit settles that purchase and provisions its challenge"},"404":{"description":"No such transaction for this credential"},"409":{"description":"The transaction's state does not admit an approve, or the withdrawal has insufficient funds. A broker approving a trader-initiated deposit into a prop challenge account may receive `invalid_state` with detail `prop_challenge_deposit_refused`."},"422":{"description":"`validation_failed` — a prop-challenge refusal, raised before the idempotency claim (a retry replays it identically): a pending money EXIT on a prop challenge account (detail `prop_funded_withdrawal_refused` for an active funded challenge; any other phase answers `prop_evaluation_withdrawal_refused`, the payout-provider enqueue included). Money leaves a challenge account by exactly two exits — a prop payout or an operator Debit"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/transactions/{id}/cancel":{"post":{"tags":["platform-transactions"],"operationId":"cancel_transaction","parameters":[{"name":"id","in":"path","description":"Transaction id","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"REQUIRED — the account that owns the transaction. Named, not discovered: `records` is tenant-partitioned, so resolving it server-side would be a cross-partition scan on the money path.","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"REQUIRED.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransactionReasonRequest"}}},"required":true},"responses":{"200":{"description":"Cancelled (or already cancelled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransaction"}}}},"400":{"description":"`idempotency_key_required` (the Idempotency-Key header is missing or malformed), `malformed_query` (`account_id` is missing or repeated) or `malformed_path`"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"Scope not granted (`transactions:write`), or a read-only delegated credential. A SETTLED row requires the transactions:amend scope. A transaction that names a prop purchase (the purchase deposit, or its settlement fee debit) ALSO needs `prop-challenges:write`, and a delegated trader token is refused"},"404":{"description":"No such transaction for this credential"},"409":{"description":"The transaction's state does not admit a cancel. Or `invalid_state` with `detail` `prop_paid_deposit_bridged_cancel_refused`: the deposit was settled on MT5 and paid a prop purchase; the cash is on the MT5 account and a cancel cannot take it back — correct it with an operator Withdrawal on the MT5 account or a challenge refund. A money-in cancel on a live prop challenge account is refused on Internal/Leverate and MT5 alike. Or platform_settled_cancel_refused: MT4/MT5 funds have settled or cannot be proved unmoved; the transaction is not cancelled and no reversal job is created."},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"415":{"description":"`unsupported_media_type`: the body was sent without a JSON `Content-Type`"},"422":{"description":"`malformed_body` (the body is not this request's JSON), a non-empty reason is required, or `prop_funded_withdrawal_refused` (an active funded challenge; any other phase answers `prop_evaluation_withdrawal_refused`) — a SETTLED money-in on a prop challenge account cannot be reversed (the reversal is money out other than a payout)"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/transactions/{id}/reject":{"post":{"tags":["platform-transactions"],"operationId":"reject_transaction","parameters":[{"name":"id","in":"path","description":"Transaction id","required":true,"schema":{"type":"string"}},{"name":"account_id","in":"query","description":"REQUIRED — the account that owns the transaction. Named, not discovered: `records` is tenant-partitioned, so resolving it server-side would be a cross-partition scan on the money path.","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"REQUIRED.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransactionReasonRequest"}}},"required":true},"responses":{"200":{"description":"Rejected (or already rejected)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiTransaction"}}}},"400":{"description":"`idempotency_key_required` (the Idempotency-Key header is missing or malformed), `malformed_query` (`account_id` is missing or repeated) or `malformed_path`"},"401":{"description":"`unauthorized`: the bearer token is missing, invalid, expired or revoked"},"403":{"description":"Scope not granted (`transactions:write`), or a read-only delegated credential. A transaction that names a prop purchase (the purchase deposit, or its settlement fee debit) ALSO needs `prop-challenges:write`, and a delegated trader token is refused"},"404":{"description":"No such transaction for this credential"},"409":{"description":"The transaction's state does not admit a reject"},"413":{"description":"`payload_too_large`: the request body is over the server's body limit"},"415":{"description":"`unsupported_media_type`: the body was sent without a JSON `Content-Type`"},"422":{"description":"`validation_failed`: `malformed_body` (the body is not this request's JSON), or a non-empty reason is required"},"429":{"description":"`rate_limited`: the credential's request rate is exhausted; retry after `Retry-After` seconds"},"503":{"description":"`write_contention`: the operation gave up under contention after its retries; retry-safe"}},"security":[{"bearerAuth":[]}]}},"/api/v1/users":{"get":{"tags":["users"],"description":"List staff users in the credential's firm workspace. Requires users:read and a firm-wide broker credential. Brand-clamped/delegated credentials are refused. Default 100/max 500 rows; ORM fetch is O(firm staff), then record-id paging in memory. No custom/internal fields are returned.","operationId":"list_users","parameters":[{"name":"limit","in":"query","description":"Default 100, clamped to 500. The ORM fetch is O(firm staff), not SQL paging.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"after","in":"query","description":"Opaque signed cursor returned by this credential's previous page.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUsersPage"}}}},"400":{"description":"Invalid cursor"},"401":{"description":"Authentication required"},"403":{"description":"Scope/firm ceiling or credential restriction"},"422":{"description":"Invalid limit"}},"security":[{"bearerAuth":[]}]},"post":{"tags":["users"],"operationId":"create_user","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateUserRequest"}}},"required":true},"responses":{"201":{"description":"The system user, created in the credential's firm","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCreateUserResponse"}}}},"401":{"description":"Missing, malformed, unknown, disabled or expired credential"},"403":{"description":"The credential does not carry `users:write` within its firm ceiling, is read-only, a supplied permission group belongs to another firm, or granting a group would exceed the credential's own permission ceiling"},"409":{"description":"The composed login identity already exists in this firm (or a social identity is already registered here)"},"422":{"description":"validation_failed: invalid name (blank, over 200 characters, control characters, U+2028/U+2029 or bidi direction controls), bad username / password / email, unknown permission group, or invalid home BU"},"503":{"description":"This node has no Keycloak admin client configured, so it cannot provision a login (not retry-safe until the node is reconfigured)"}},"security":[{"bearerAuth":[]}]}},"/api/v1/users/{id}":{"get":{"tags":["users"],"description":"Read a staff user. Requires users:read and a firm-wide broker credential. Foreign, missing, deleted and brand-invisible ids all return 404. Returns a strong revision ETag.","operationId":"get_user","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUser"}}}},"401":{"description":"Authentication required"},"403":{"description":"Scope/firm ceiling refused"},"404":{"description":"User not visible"}},"security":[{"bearerAuth":[]}]},"patch":{"tags":["users"],"description":"Update only name, permission groups and home business unit. Requires users:write and a firm-wide broker credential. Both CURRENT and proposed groups must fit the credential's permission ceiling, even for name-only updates. Email, enabled, login and internal fields cannot change. Required If-Match uses the existing platform parser: missing/malformed is 422. Idempotency-Key replays the saved result; user save and receipt are committed together.","operationId":"patch_user","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiPatchUserRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUser"}}}},"400":{"description":"Missing Idempotency-Key"},"401":{"description":"Authentication required"},"403":{"description":"Scope/credential/current or proposed ceiling refused"},"404":{"description":"User not visible"},"409":{"description":"Idempotency conflict or request in flight"},"412":{"description":"Visible user's revision changed"},"422":{"description":"validation_failed: invalid name (blank, over 200 characters, control characters, U+2028/U+2029 or bidi direction controls), missing/malformed If-Match, unknown/null/empty patch, or invalid field or reference"}},"security":[{"bearerAuth":[]}]}},"/api/v1/users/{id}/deactivate":{"post":{"tags":["users"],"description":"Deactivate, never delete, a staff user. Requires users:write and a firm-wide broker credential. The CURRENT persona must fit the credential ceiling even if already disabled. Legacy missing home BU does not block disabling; PATCH still validates it. No reactivation or arbitrary fields. Required If-Match: missing/malformed is existing platform 422. User save and idempotency receipt are atomic. A committed enabled-to-disabled transition uses the BO identity-wide session epoch revocation; that post-commit finalizer remains best effort.","operationId":"deactivate_user","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Absent body or empty JSON object only","content":{"application/json":{"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiDeactivateUserRequest"}]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiUser"}}}},"400":{"description":"Missing Idempotency-Key"},"401":{"description":"Authentication required"},"403":{"description":"Scope/credential/current ceiling refused"},"404":{"description":"User not visible"},"409":{"description":"Idempotency conflict or request in flight"},"412":{"description":"Visible user's revision changed"},"422":{"description":"Missing/malformed If-Match or invalid body/reference"}},"security":[{"bearerAuth":[]}]}},"/api/v1/webhooks":{"get":{"tags":["webhooks"],"summary":"List the credential's webhook subscriptions.","operationId":"list_webhooks","responses":{"200":{"description":"The subscriptions visible to this credential","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiWebhookSubscription"}}}}},"401":{"description":"Unauthenticated"},"403":{"description":"The credential does not carry `webhooks:manage`"}},"security":[{"bearerAuth":[]}]},"post":{"tags":["webhooks"],"summary":"Register a webhook endpoint.","operationId":"create_webhook","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookRequest"}}},"required":true},"responses":{"201":{"description":"Created — the plaintext signing secret is returned ONCE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSecretResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"The credential does not carry `webhooks:manage`"},"422":{"description":"Malformed URL, a non-public target, or an unknown category"}},"security":[{"bearerAuth":[]}]}},"/api/v1/webhooks/{id}":{"get":{"tags":["webhooks"],"summary":"Read one subscription.","operationId":"get_webhook","parameters":[{"name":"id","in":"path","description":"The subscription id","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"The subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiWebhookSubscription"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"The credential does not carry `webhooks:manage`"},"404":{"description":"No such subscription (also returned for one outside the credential's firm)"}},"security":[{"bearerAuth":[]}]}},"/api/v1/webhooks/{id}/disable":{"post":{"tags":["webhooks"],"summary":"Disable a subscription. Delivery stops; the record and its cursor stay.","operationId":"disable_webhook","parameters":[{"name":"id","in":"path","description":"The subscription id","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiWebhookSubscription"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"The credential does not carry `webhooks:manage`"},"404":{"description":"No such subscription (also returned for one outside the credential's firm or brand)"}},"security":[{"bearerAuth":[]}]}},"/api/v1/webhooks/{id}/rotate-secret":{"post":{"tags":["webhooks"],"summary":"Rotate the signing secret. The previous secret stays valid for the rotation\nwindow: deliveries carry BOTH `v1=` values until the next rotation.","operationId":"rotate_secret","parameters":[{"name":"id","in":"path","description":"The subscription id","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Rotated — the new plaintext secret is returned ONCE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSecretResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"The credential does not carry `webhooks:manage`"},"404":{"description":"No such subscription (also returned for one outside the credential's firm or brand)"}},"security":[{"bearerAuth":[]}]}},"/api/v1/{entity}/fields":{"get":{"tags":["read"],"summary":"`GET /api/v1/{entity}/fields`","description":"Read-only, offering-gated custom-field DISCOVERY: the firm's queryable\noperator-defined fields for `entity`, so a CRM broker can enumerate its own\nfields instead of having to already know their names. It gates on **exactly\nthe same read scope, firm ceiling, offering shape and FLS masked-set** as the\nbulk read, and advertises no field the bulk read would refuse to project.","operationId":"fields","parameters":[{"name":"entity","in":"path","description":"Base entity whose custom fields to enumerate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The firm's queryable custom fields for this entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiFieldsResponse"}}}},"401":{"description":"Authentication required"},"403":{"description":"Scope does not permit this entity"},"404":{"description":"Unknown entity"},"503":{"description":"This firm's Field-Security policies could not be resolved, so the response cannot be masked correctly and is refused rather than served"}},"security":[{"bearerAuth":[]}]}},"/api/v1/{entity}/query":{"post":{"tags":["read"],"summary":"`POST /api/v1/{entity}/query`","operationId":"query","parameters":[{"name":"entity","in":"path","description":"Base entity to query","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiQueryRequest"}}},"required":true},"responses":{"200":{"description":"One page of rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiQueryResponse"}}}},"400":{"description":"Malformed or tampered cursor"},"401":{"description":"Authentication required"},"403":{"description":"Scope does not permit this entity"},"404":{"description":"Unknown entity"},"413":{"description":"Scope resolves to too many accounts to serve"},"422":{"description":"Invalid filter, column or sort"},"503":{"description":"This firm's Field-Security policies could not be resolved, so the response cannot be masked correctly and is refused rather than served; or the page read timed out (carries Retry-After: retry, or request a smaller page)"}},"security":[{"bearerAuth":[]}]}}},"components":{"schemas":{"AmountPolicy":{"type":"object","required":["min_lot","max_lot","lot_step"],"properties":{"min_lot":{"type":"number","format":"double"},"max_lot":{"type":"number","format":"double"},"lot_step":{"type":"number","format":"double"}}},"ApiAccount":{"type":"object","description":"The account as the broker surface publishes it — the tight create/patch ECHO\n(there is no single-account GET). The bulk read is\n`POST /api/v1/account/query`, which is offering-aware; this echo is not, and\ndeliberately carries no trading state.\n\n**Trading accounts are not inlined here.** A person's trading (`forex`)\naccounts are reachable via the bulk read on the `forex` base\n(`POST /api/v1/forex/query`) — this record is CRM identity only.","required":["id","revision","firm_id"],"properties":{"id":{"type":"string","description":"Account ID encoded as a decimal string to preserve 64-bit integer precision."},"revision":{"type":"integer","format":"int64","description":"The ORM revision. Also the strong `ETag` a mutation must pin."},"client_reference_id":{"type":["string","null"],"description":"Echoed from the create request; absent for an account this credential\ndid not create through the API."},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"phone":{"type":["string","null"]},"country":{"type":["string","null"]},"language":{"type":["string","null"]},"status":{"type":["string","null"]},"brand_id":{"type":["string","null"]},"firm_id":{"type":"string"},"trading_account_ids":{"type":"array","items":{"type":"string"}},"trading_account_status":{"type":["string","null"],"description":"Present only on an opted-in account create: provisioned, not_configured,\nfailed, tier_no_demo_group (a demo was routed to a tier with no demo group),\ndeferred for account-type selection, or not_provisioned on recovery.\nRecover not_provisioned through POST /accounts/{id}/trading-accounts."}}},"ApiAccountStatus":{"type":"object","description":"One trading account's live status. Every money field is a Decimal STRING.","required":["account_id","trading_account_id","currency","applied_revision","open_pnl","balance","credit","equity","margin","margin_free","margin_available","net_deposit","live"],"properties":{"account_id":{"type":"integer","format":"int64","description":"The owning customer account (the record's tenant)."},"trading_account_id":{"type":"integer","format":"int64","description":"The trading account this row describes."},"currency":{"type":"string"},"applied_revision":{"type":"integer","format":"int64","description":"The P&L cache's `applied_revision` at compute time — the freshness token.\n`0` for an account the P&L service has never seen."},"as_of_revision":{"type":"integer","format":"int64","description":"The account's freshest committed revision, read just\nbefore the live P&L was fetched. `applied_revision < as_of_revision` means\nthe P&L cache had not yet applied a change that was already committed when\nthis page was requested. `0` for an account that has never written.\nOptional to read: a client that ignores it sees no other change."},"stale":{"type":"boolean","description":"`true` when this row is `live` AND its P&L is behind\n`as_of_revision` — the figures are older than the account's committed state\n(a lagging or stalled P&L service). Always `false` for a synthesized row\n(`live: false`), whose figures come from the stored `Funds` read after\n`as_of_revision`. Optional to read: a client that ignores it sees no other\nchange."},"open_pnl":{"type":"string","description":"Live unrealized P&L across open positions. `\"0\"` for an account with no\nopen positions (synthesized), never omitted."},"balance":{"type":"string"},"credit":{"type":"string"},"equity":{"type":"string","description":"`balance + credit + open_pnl`."},"margin":{"type":"string"},"margin_free":{"type":"string","description":"Free margin. From the live frame when `live` (which is not always\n`equity - margin`: an MT4 account's broker-sourced figure differs);\n`equity - margin - locked_margin` from stored Funds otherwise."},"margin_available":{"type":"boolean","description":"`false` when this frame's `margin` (and so `margin_free` and\n`margin_level`) could not be computed — equity may still be live. A\nsynthesized row reads its margin from stored Funds and says `true`."},"margin_level":{"type":["string","null"],"description":"`equity / margin * 100`, or **null** when there is no used margin — a\nmargin level of `0` means liquidate-now, so it must never stand in for\n\"nothing at risk\"."},"net_deposit":{"type":"string","description":"`deposits_total - withdrawals_total` from the account's money rollup."},"live":{"type":"boolean","description":"`true` when the figures came from a live P&L snapshot; `false` when this\nrow was synthesized from stored `Funds` because the account is cold."},"positions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ApiPositionStatus"},"description":"The trading account's open positions — present only when the request set\n`include_positions`; empty when there is no live frame to read them from."}}},"ApiAllocationSlice":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["instrument_tenant","instrument_id","trades","winning","losing"],"properties":{"instrument_tenant":{"type":"string"},"instrument_id":{"type":"string"},"share_pct":{"type":["string","null"]},"trades":{"type":"integer","format":"int32","minimum":0},"winning":{"type":"integer","format":"int32","minimum":0},"losing":{"type":"integer","format":"int32","minimum":0},"result":{"type":["string","null"],"description":"Null when the credential's field security masks its source figure."}}},"ApiBarRead":{"type":"object","description":"Terminal chart figures projected onto the broker wire: decimal strings and epoch milliseconds.","required":["ts","o","h","l","c","ticks"],"properties":{"ts":{"type":"integer","format":"int64"},"volume":{"type":["string","null"]},"o":{"type":"string"},"h":{"type":"string"},"l":{"type":"string"},"c":{"type":"string"},"ticks":{"type":"integer","format":"int64"}}},"ApiBreachAction":{"type":"object","required":["action","at_ms"],"properties":{"action":{"$ref":"#/components/schemas/ApiBreachActionKind"},"at_ms":{"type":"integer","format":"int64"},"count":{"type":["integer","null"],"format":"int32","description":"Orders cancelled / positions closed by this pass; null for a lock.","minimum":0}}},"ApiBreachActionKind":{"type":"string","enum":["lock","cancel_orders","close_positions"]},"ApiBreachChallengeState":{"type":"object","required":["status","completed","rules_version"],"properties":{"status":{"type":"string"},"fail_reason":{"type":["string","null"]},"completed":{"type":"boolean"},"completed_at_ms":{"type":["integer","null"],"format":"int64"},"rules_version":{"type":"integer","format":"int32","minimum":0}}},"ApiBreachCoverage":{"type":"string","enum":["retained_equity_rail_latch"]},"ApiBreachDetectionRate":{"type":"object","required":["instrument_id","bid","ask"],"properties":{"instrument_id":{"type":"string"},"bid":{"type":"string"},"ask":{"type":"string"},"sampled_at_ms":{"type":["integer","null"],"format":"int64"}}},"ApiBreachFigures":{"type":"object","description":"The judged equity block at the breach — equity rails only.","required":["equity","balance_including_credit","hwm_equity","start_equity","monetary_today","detection_rates"],"properties":{"equity":{"type":"string"},"balance_including_credit":{"type":"string","description":"Balance plus credit."},"hwm_equity":{"type":"string"},"start_equity":{"type":"string"},"day_baseline":{"type":["string","null"]},"monetary_today":{"type":"string"},"detection_rates":{"type":"array","items":{"$ref":"#/components/schemas/ApiBreachQuote"}}}},"ApiBreachKind":{"type":"string","enum":["fail","daily_profit_freeze"]},"ApiBreachQuote":{"type":"object","description":"A marked-up quote sampled at the breach instant.","required":["instrument_id","bid","ask"],"properties":{"instrument_id":{"type":"string"},"bid":{"type":"string"},"ask":{"type":"string"},"sampled_at_ms":{"type":["integer","null"],"format":"int64"}}},"ApiBreachRecord":{"type":"object","description":"one breach of the append-only history with the enforcement actions that landed for it.","required":["kind","reason","source","decided_at_ms","rules_version","phase_index","actions"],"properties":{"kind":{"$ref":"#/components/schemas/ApiBreachKind"},"reason":{"type":"string","description":"The fail reason (snake_case), or `daily_profit_freeze`."},"source":{"$ref":"#/components/schemas/ApiBreachSource"},"detected_at_ms":{"type":["integer","null"],"format":"int64","description":"The canonical breach instant — equity rails only."},"decided_at_ms":{"type":"integer","format":"int64"},"rules_version":{"type":"integer","format":"int32","description":"Rule version in force at the decision.","minimum":0},"phase_index":{"type":"integer","format":"int32","minimum":0},"figures":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiBreachFigures"}]},"actions":{"type":"array","items":{"$ref":"#/components/schemas/ApiBreachAction"},"description":"Oldest first. A lock already in force is not taken again and has no row."}}},"ApiBreachSource":{"type":"string","enum":["engine","operator","chargeback"]},"ApiBreachUnavailable":{"type":"string","enum":["historical_action_not_persisted","historical_thresholds_unavailable","detection_rates_not_persisted"]},"ApiBulkCreateAccountsRequest":{"type":"object","description":"`POST /api/v1/accounts/bulk` body.","required":["accounts"],"properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/ApiCreateAccountRequest"},"description":"1..=1000 rows. Each row is the ordinary single-create body, including its\nown required `client_reference_id`."}}},"ApiBulkResponse":{"type":"object","description":"The batch outcome. Each row is processed independently; a failed row does\nnot roll back successful rows. Per-row results and counts help the client\ndecide which rows to resubmit.","required":["total","created","failed","rows"],"properties":{"total":{"type":"integer","minimum":0},"created":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiBulkRow"},"description":"Same ORDER as the request. Row `n` of the response is row `n` of the\nsubmission, whatever order the concurrent workers finished in."}}},"ApiBulkRow":{"type":"object","description":"One row's outcome. `status` is the HTTP status that row would have received\non the single-create endpoint, so a client can branch on it with the same\ncode either way.","required":["client_reference_id","status"],"properties":{"client_reference_id":{"type":"string"},"status":{"type":"integer","format":"int32","minimum":0},"id":{"type":["string","null"],"description":"The account id, on success."},"code":{"type":["string","null"],"description":"The stable error code (`invalid_state`, `validation_failed`, …) — never\nfree text a client would have to string-match."},"detail":{"type":["string","null"]}}},"ApiClosePositionRequest":{"type":"object","description":"`POST /api/v1/positions/close` body.","required":["account_id","trading_account_id","position_id"],"properties":{"client_send_time_ms":{"type":["integer","null"],"format":"int64","description":"Optional client placement time in epoch milliseconds."},"ignore_hold_time":{"type":"boolean"},"account_id":{"type":"string"},"trading_account_id":{"type":"string"},"position_id":{"type":"string"},"size":{"type":["string","null"],"description":"Partial close size. Omitted ⇒ close the whole position.\nA plain decimal (`^-?\\d+(\\.\\d+)?$`): an exponent, a leading `+` or padding is 422 `validation_failed`."},"desired_price":{"type":["string","null"],"description":"A plain decimal (`^-?\\d+(\\.\\d+)?$`): an exponent, a leading `+` or padding is 422 `validation_failed`."},"external_id":{"type":["string","null"]}}},"ApiClosedPositionPage":{"type":"object","required":["rows"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiClosedPositionRead"}},"next_cursor":{"type":["string","null"]}}},"ApiClosedPositionRead":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"instrument":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiTradingInstrumentRef"}]},"side":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PositionSide"}]},"volume":{"type":["string","null"]},"open_price":{"type":["string","null"]},"close_price":{"type":["string","null"]},"open_time":{"type":["integer","null"],"format":"int64"},"close_time":{"type":["integer","null"],"format":"int64"},"profit":{"type":["string","null"]},"swap":{"type":["string","null"]},"commission":{"type":["string","null"]},"close_reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CloseReason"}]},"original_position_id":{"type":["string","null"]}}},"ApiCreateAccountRequest":{"type":"object","description":"`POST /api/v1/accounts` body.","required":["client_reference_id","email"],"properties":{"client_reference_id":{"type":"string","description":"The broker's own ID for this person. Required: it identifies the account\nfor idempotent creation, so retries name the same account."},"email":{"type":"string","description":"Primary email — the DDS identity attribute."},"phone":{"type":["string","null"],"description":"Phone in any format; canonicalised best-effort to E.164 for the blind\nindex (never rejected on format — Partner-API parity)."},"phone_region":{"type":["string","null"],"description":"ISO-3166 alpha-2 region hint for phone canonicalisation."},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"country":{"type":["string","null"]},"language":{"type":["string","null"]},"status":{"type":["string","null"],"description":"Initial lead Status from the firm's vocabulary; omitted, null or blank means New.\nAn explicit choice requires permission to write Status under the current field-security policy, as on PATCH.\nUnknown values carry validation_code `lead_status_unknown_value`.\nInvalid values are refused before consuming the Idempotency-Key. A\nreplay keeps the existing account's Status, even if this input differs\nor the firm's vocabulary has changed."},"brand_id":{"type":["string","null"],"description":"Brand to tag the account with. Must be inside the credential's clamp;\nomitted ⇒ the credential's own brand."},"open_trading_account":{"type":"boolean","description":"Opt in to best-effort trading-account provisioning. Bulk creates remain lead-only."}}},"ApiCreateTradingAccountRequest":{"type":"object","description":"Optional overrides for an explicitly requested trading account.","properties":{"trading_terms_id":{"type":["string","null"]},"currency":{"type":["string","null"],"description":"Internal tier: a three-letter currency code. External tier: ignored; the group determines it."},"is_demo":{"type":["boolean","null"]}}},"ApiCreateTradingTermsRequest":{"type":"object","description":"Create a trading-terms tier in the **credential's own firm workspace**.\n\nThe tier lives in the workspace derived from the principal — never one named\nin the body. Any `firm_id` present inside `terms` is IGNORED and overwritten\nwith the authenticated firm (the workspace-access-IDOR guard; mirrors the\nbackoffice `create_terms`, which does `tt.firm_id = id`).","required":["terms"],"properties":{"terms":{"$ref":"#/components/schemas/TradingTerms","description":"The tier payload. `firm_id` is ignored (server-derived); `trading_system_id`\nis mandatory and must reference a real system-tenant trading system."}}},"ApiCreateTransactionRequest":{"type":"object","description":"Transaction creation request. Creation does not approve the transaction.\nApproval uses a separate endpoint and requires the corresponding scope.","required":["client_reference_id","account_id","trading_account_id","currency","amount","transaction_type"],"properties":{"client_reference_id":{"type":"string","description":"The broker's own id for this transaction — the idempotency SUBJECT\n(§5.1), so two intentionally-identical deposits never collide."},"account_id":{"type":"string","description":"Owning account id (string)."},"trading_account_id":{"type":"string","description":"Trading account the money moves on (string)."},"currency":{"type":"string","description":"ISO-style code of a currency in the platform's currency catalog\n(`USD`, `EUR`, `BTC`, …). An unknown code is a 422. It must be the trading\naccount's own currency (no conversion is made): another one is 422\n`validation_failed` with `detail` `currency_mismatch`. Stored upper-case."},"amount":{"type":"string","description":"Decimal string. Money in (`transaction_type` Deposit / Credit) must be positive;\nmoney out (Withdrawal / Debit / Chargeback) must be negative, for example `\"-50.00\"`\nfor a withdrawal of 50. Zero, an amount exceeding the currency's precision\n(USD 2, JPY 0, BTC 8), or a magnitude above 1,000,000,000 is refused with\n422 `validation_failed`. Use a plain decimal (`^-?\\d+(\\.\\d+)?$`);\nan exponent, a leading `+` or padding is refused with 422 `malformed_body`."},"method":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TxMethod","description":"`Deposit` | `Withdrawal` | `Bonus`. Omitted ⇒ derived from the sign.\nWhen given, its direction must agree with the sign of `amount`\n(Deposit / Bonus positive, Withdrawal / Chargeback negative)."}]},"transaction_type":{"$ref":"#/components/schemas/CrmTransactionType","description":"The ledger classification, separate from `method`, which describes\nhow the money moved."},"prop_purchase_id":{"type":["string","null"],"description":"The prop purchase this deposit PAYS (a decimal string id, from\n`POST /api/v1/prop-purchases`). Optional; absent means an ordinary\ndeposit, unchanged. When present the deposit must be a positive\n`Deposit` on the purchase's own account, for exactly the purchase\n`total` in its `currency`, while the purchase is `pending` and no other\npayment pays it (a second one is 409 `prop_purchase_already_linked`).\nThe credential needs `transactions:write` AND `prop-challenges:write`\n(403 otherwise); a delegated trader token may not name one. Approving this deposit settles the purchase and creates its\nchallenge. Exception — a purchase holding a slot of a discount code\nwith a global use cap (`max_uses`): its hold lasts ~15 minutes\n(900 seconds by default) and this deposit, while\npending, does not extend it. Approved after the purchase expired, it\nrevives the purchase when it can; when the code's cap is spent, the\npurchase stays `failed` (`failure_code: discount_code_exhausted`) and\nthe money stays an ordinary deposit on the account.\n\n**Under the prop kill switch this link is still honoured, by design\n(\"brake new commitments, complete committed ones\").** The brake refuses\nNEW purchases (`POST /api/v1/prop-purchases` answers 404 while it is\nengaged), but a purchase that is already\n`pending` is a commitment the trader made before the brake: a deposit\nnaming it is accepted and its approve settles it, exactly as a paid\npurchase whose money lands under the brake settles.\n\nThe whole request intent is the idempotency fingerprint: the same\n`Idempotency-Key` + `client_reference_id` with a different\n`prop_purchase_id` (or amount, currency, method, type, account) is 409\n`invalid_state` / `idempotency_conflict`, never the first answer. The\namount is compared by VALUE and the currency by its upper-case code, so\na retry that respells them (`\"499.0\"` for `\"499.00\"`, `usd` for `USD`)\nis the same request and replays."}}},"ApiCreateUserRequest":{"type":"object","description":"Create a system user / agent in the credential's OWN firm.\n\nThe firm, gate and (defaulted) home BU are all server-derived from the\nprincipal — there is no firm field on the wire to trust. `permission_group_ids`\nare firm-scoped (each MUST belong to the credential's firm and name a real\ngroup there); `home_business_unit_id`, when supplied, must live in the firm too\n(else it defaults to the firm's root BU).","required":["name","auth"],"properties":{"name":{"type":"string","description":"Human-readable display name for the persona. Must be nonblank and at most\n200 Unicode characters (not UTF-8 bytes). Control characters, line/paragraph\nseparators (U+2028/U+2029), and bidi direction controls are refused.\nInvalid names return HTTP 422 with code `validation_failed`.","maxLength":200},"permission_group_ids":{"type":"array","items":{"$ref":"#/components/schemas/ForeignRef"},"description":"Permission groups to grant. EVERY ref must belong to the caller's firm\n(`tenant == firm_id`) and name a real group there; a foreign-firm ref is\nDENIED (403), never silently dropped."},"home_business_unit_id":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef","description":"The persona's single home Business Unit (ownership-model invariant). When\nomitted, defaults to the firm's root BU. When supplied it must live in the\nfirm."}]},"enabled":{"type":"boolean","description":"Whether the login is enabled. Defaults to `true`."},"auth":{"$ref":"#/components/schemas/ApiUserAuthMethod","description":"How to provision the login identity."}}},"ApiCreateUserResponse":{"type":"object","description":"The created persona, echoed back with server-derived fields.","required":["user_id","firm_id","login","enabled","permission_group_ids"],"properties":{"user_id":{"type":"integer","format":"int64","description":"The new `SystemUser` record id (in the firm partition)."},"firm_id":{"type":"integer","format":"int64","description":"The firm the persona was created in — the credential's own, always."},"login":{"type":"string","description":"The stored login identity: `username@<firm_id>` for a password account, the\nemail for a social one."},"enabled":{"type":"boolean"},"permission_group_ids":{"type":"array","items":{"$ref":"#/components/schemas/ForeignRef"}},"home_business_unit_id":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef"}]}}},"ApiCustomFieldDef":{"type":"object","description":"One operator-defined custom field, as advertised by `GET /{entity}/fields`.\nThe response includes its queryable name, display label, stable value type\nand, for an enum field, its picklist options.","required":["name","label","type","editable"],"properties":{"name":{"type":"string","description":"The queryable field name — the key a `columns`/`filter` term names with\n`custom: true` on the bulk-read endpoint."},"label":{"type":"string","description":"The operator's display label. Free text, not an i18n key."},"type":{"type":"string","description":"The stable value type token (`string` / `number` / `boolean` / `date` /\n`timestamp` / `enum`)."},"options":{"type":"array","items":{"type":"string"},"description":"Picklist options; present only for an `enum` field (omitted when empty)."},"editable":{"type":"boolean","description":"Whether a report grid may edit this column in place — the server's verdict."}}},"ApiDeactivateUserRequest":{"type":"object","description":"Deactivation accepts no fields; an absent body is also valid.","additionalProperties":false},"ApiDifference":{"type":"object","required":["field","platform","supplied","delta"],"properties":{"field":{"type":"string"},"platform":{"type":"string"},"supplied":{"type":"string"},"delta":{"type":"string"}}},"ApiEffectiveInstrument":{"type":"object","description":"Instrument fields resolved through the trading-term, firm and instrument\ncascade. A field is absent if no cascade level configures it.","properties":{"contract_size":{"type":["integer","null"],"format":"int64","description":"Notional multiplier (e.g. 100000 for a standard forex lot)."},"display_digits":{"type":["integer","null"],"format":"int32","description":"Price precision. Note this skips the policy layer — `InstrumentPolicy`\ncarries no `display_digits`, so it resolves firm override → instrument.","minimum":0},"tradability":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Tradability"}]},"execution_mode":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ExecutionMode"}]},"min_lot":{"type":["number","null"],"format":"double","description":"Trading-volume bounds, resolved as a unit (all three or none)."},"max_lot":{"type":["number","null"],"format":"double"},"lot_step":{"type":["number","null"],"format":"double"}}},"ApiEquityBreachReason":{"type":"string","enum":["max_total_loss","max_daily_loss"]},"ApiFieldsResponse":{"type":"object","description":"The field-discovery response: the firm's queryable custom fields for one\nentity, so a CRM broker can enumerate its own fields instead of having to\nalready know their names.\n\nA **Leverate Standalone** credential receives an EMPTY `fields` list — it did not\nbuy the CRM product, so no operator-defined custom field is projectable or\nqueryable for it, exactly as the bulk read withholds them. `offering` is the\nresolved shape label so the caller can tell an empty CRM firm (\"no fields\ndefined yet\") from a Standalone one (\"this product has none\").","required":["entity","offering","fields"],"properties":{"entity":{"type":"string","description":"Echoes the path's entity segment."},"offering":{"type":"string","description":"The resolved offering shape (`crm` / `standalone`)."},"fields":{"type":"array","items":{"$ref":"#/components/schemas/ApiCustomFieldDef"},"description":"The surviving custom-field definitions — declared for this entity, not\nmasked. Empty for a Standalone credential."}}},"ApiInstrument":{"type":"object","description":"A tradable instrument, including its identifiers, display label and price precision.","required":["instrument_id","source","symbol"],"properties":{"instrument_id":{"type":"integer","format":"int64","description":"Platform-wide stable handle. The same id used as the NATS subject leaf,\nthe Redis key tag and the QuestDB `instrument_id` tag — and the id an\n`InstrumentPolicy` points at."},"source":{"type":"string","description":"Where the instrument comes from: `Leverate` (the platform's own price feed),\n`Stocks` (a cash stock) or `MT5:<trading_system_id>` / `MT4:<trading_system_id>`\n(a MetaTrader server). Never changes. With `symbol` it names exactly one\ninstrument.","example":"MT5:10055"},"symbol":{"type":"string","description":"The instrument's ticker within its `source`. Never changes, but it is NOT\nunique on its own: the same ticker can exist under several sources. Match an\ninstrument by `instrument_id`, or by the (`source`, `symbol`) pair."},"name":{"type":["string","null"],"description":"Display label: the workspace's own name for the instrument, else the\nplatform's name. If absent, display `symbol`.\nThe label is not an instrument identifier."},"display_digits":{"type":["integer","null"],"format":"int32","description":"Price precision in decimal digits; tick size is `10^-display_digits`.\nAn absent value means there is no global default. A firm override may\nstill supply one; see the trading-terms detail endpoint.","minimum":0},"pip_digit":{"type":["integer","null"],"format":"int32","description":"Digits in one pip. **Not** the same as `display_digits`: with\nfractional-pip pricing `display_digits == pip_digit + 1`.","minimum":0},"base_currency":{"type":["string","null"],"description":"ISO 4217 base currency — only meaningful for a true currency pair."},"quote_currency":{"type":["string","null"],"description":"ISO 4217 quote currency. Also the profit currency for a position."},"instrument_type":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstrumentType","description":"Asset class. May be absent for older instruments."}]},"quantity_unit":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/QuantityUnit","description":"Size unit (`Lot`, `Share` or `Contract`). An absent value defaults to `Lot`.\nA cash equity has `instrument_type` set to `Stock` and `quantity_unit`\nset to `Share`."}]},"exchange":{"type":["string","null"],"description":"Listing venue as an ISO-10383 MIC, for example `XNAS`.\nMay be absent for older instruments."}}},"ApiMoneyPair":{"type":"object","required":["balance","credit"],"properties":{"balance":{"type":"string"},"credit":{"type":"string"}}},"ApiOpenPositionRequest":{"type":"object","description":"`POST /api/v1/positions/open` body.\n\n`account_id` is carried ALONGSIDE `trading_account_id` deliberately: a\ntrading account is a child record inside its account's tenant, so without\nthe account there is no tenant to read it from — and resolving one from the\nother by scanning would be an enumeration path. The pair is checked\n(`trading_account_id` must actually live under `account_id`), so a mismatched\npair is a 404, never a cross-account write.","required":["account_id","trading_account_id","instrument_id","side","size"],"properties":{"client_send_time_ms":{"type":["integer","null"],"format":"int64","description":"Optional client placement time in epoch milliseconds."},"ignore_hold_time":{"type":"boolean"},"account_id":{"type":"string"},"trading_account_id":{"type":"string"},"instrument_id":{"type":"string","description":"SYSTEM-tenant instrument record id."},"side":{"$ref":"#/components/schemas/PositionSide"},"size":{"type":"string","description":"Lots. Decimal STRING on the wire.\nA plain decimal (`^-?\\d+(\\.\\d+)?$`): an exponent, a leading `+` or padding is 422 `malformed_body`."},"desired_price":{"type":["string","null"],"description":"The price the broker wants. Omit for a market order — the server fills\nit from the live marked quote, side-appropriately.\nA plain decimal (`^-?\\d+(\\.\\d+)?$`): an exponent, a leading `+` or padding is 422 `validation_failed`."},"stop_loss":{"type":["string","null"],"description":"A plain decimal (`^-?\\d+(\\.\\d+)?$`): an exponent, a leading `+` or padding is 422 `validation_failed`."},"take_profit":{"type":["string","null"],"description":"A plain decimal (`^-?\\d+(\\.\\d+)?$`): an exponent, a leading `+` or padding is 422 `validation_failed`."},"external_id":{"type":["string","null"],"description":"The broker's own correlation label. **Never uniqueness-checked** (§5.3) —\nexactly-once is the `Idempotency-Key`'s job; this is for the broker's own\nreconciliation and may repeat."}}},"ApiOrderPage":{"type":"object","required":["rows"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiOrderRead"}},"next_cursor":{"type":["string","null"]}}},"ApiOrderRead":{"type":"object","required":["id"],"properties":{"id":{"type":"string"},"instrument":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiTradingInstrumentRef"}]},"side":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PositionSide"}]},"volume":{"type":["string","null"]},"state":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TradeRequestState"}]},"rejection_reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TradeRejectionReason"}]},"client_platform":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ClientPlatform"}]},"quote_source":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Source","description":"Feed source captured at placement, when available and permitted."}]},"client_send_time_ms":{"type":["integer","null"],"format":"int64","description":"Caller-supplied placement time in epoch milliseconds, when supplied and permitted."},"received_at":{"type":["integer","null"],"format":"int64"},"validated_at":{"type":["integer","null"],"format":"int64"},"confirmed_at":{"type":["integer","null"],"format":"int64"},"quote_bid_at_execution":{"type":["string","null"],"description":"Raw feed bid at execution, before the trading-terms markup. Each execution quote field is null\nindependently when it was not stored (legacy or unfilled orders, a path that stamped one side\nonly) or is withheld by FLS."},"quote_ask_at_execution":{"type":["string","null"],"description":"Raw feed ask at execution, before the trading-terms markup."},"quote_bid_marked_at_execution":{"type":["string","null"],"description":"Marked bid at execution: the raw feed bid plus the trading-terms markup. An open Sell, or the\nclose of a Buy position, fills at it (on a close, side is the position's side)."},"quote_ask_marked_at_execution":{"type":["string","null"],"description":"Marked ask at execution: the raw feed ask plus the trading-terms markup. An open Buy, or the\nclose of a Sell position, fills at it."},"quote_ts_at_execution":{"type":["integer","null"],"format":"int64"},"position_to_close":{"type":["string","null"],"description":"Stored close target, if any. Resulting position identifiers are unavailable for opening orders."}}},"ApiOwnReplicationBind":{"type":"object","description":"Exactly one configuration, derived from the authenticated credential.","required":["bind","served_at_ms"],"properties":{"bind":{"$ref":"#/components/schemas/ApiReplicationBind"},"served_at_ms":{"type":"integer","format":"int64"}}},"ApiPatchAccountRequest":{"type":"object","description":"`PATCH /api/v1/accounts/{id}` body — every field optional; only supplied\nfields are applied. Deliberately a SMALL surface: identity attributes\n(email/phone) are NOT patchable here because they participate in the DDS\nclaim index, and moving a claim is a different operation.","properties":{"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"country":{"type":["string","null"]},"language":{"type":["string","null"]},"status":{"type":["string","null"],"description":"An empty or whitespace-only string clears Status. Null or omission preserves\nit; an already-empty echo does not create a revision."}}},"ApiPatchUserRequest":{"type":"object","properties":{"name":{"type":"string","description":"Human-readable display name for the persona. Must be nonblank and at most\n200 Unicode characters (not UTF-8 bytes). Control characters, line/paragraph\nseparators (U+2028/U+2029), and bidi direction controls are refused.\nInvalid names return HTTP 422 with code `validation_failed`.","maxLength":200},"permission_group_ids":{"type":"array","items":{"$ref":"#/components/schemas/ApiUserRef"}},"home_business_unit_id":{"$ref":"#/components/schemas/ApiUserRef"}},"additionalProperties":false},"ApiPendingOrderRead":{"type":"object","description":"Nullable fields are unavailable or withheld by the credential's field security.","required":["id"],"properties":{"id":{"type":"string"},"instrument":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiTradingInstrumentRef"}]},"type":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PendingOrderType"}]},"side":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PositionSide"}]},"volume":{"type":["string","null"]},"price":{"type":["string","null"]},"sl":{"type":["string","null"]},"tp":{"type":["string","null"]},"created_at":{"type":["integer","null"],"format":"int64"},"expires_at":{"type":["integer","null"],"format":"int64"}}},"ApiPositionStatus":{"type":"object","description":"One open position's live figures, in the owning account's currency.","required":["position_id"],"properties":{"position_id":{"type":"integer","format":"int64","description":"The Position's record id."},"profit":{"type":["string","null"],"description":"Unrealised PRICE P&L — swap and commission excluded. **null** when the\nposition could not be priced (no quote, no conversion path)."},"current_price":{"type":["string","null"],"description":"The marked rate the position would close at: bid for a Buy, ask for a\nSell. **null** when the instrument has no live quote."}}},"ApiPropAddon":{"type":"object","description":"One add-on a plan sells.","required":["id","price_kind"],"properties":{"id":{"type":"string","description":"`express_payout`, `profit_booster`, `hold_over_weekend` or\n`double_leverage`; new ids may appear."},"price_kind":{"type":"string","description":"`fixed` (carries `price`) or `percent_of_fee` (carries `rate`)."},"price":{"type":["string","null"],"description":"The fixed price (decimal string)."},"rate":{"type":["string","null"],"description":"The fraction of the size's fee (decimal string)."},"payout_days":{"type":["integer","null"],"format":"int32","description":"Express payout: the reduced first-payout wait, in days.","minimum":0},"trader_fraction":{"type":["string","null"],"description":"Profit booster: the boosted trader share, a fraction (decimal string)."}}},"ApiPropBreachEvidence":{"type":"object","required":["reason","evaluated_at_ms","detected_at_ms","rules_version","equity","balance_including_credit","hwm_equity","start_equity","monetary_today","detection_rates","unavailable"],"properties":{"reason":{"$ref":"#/components/schemas/ApiEquityBreachReason"},"evaluated_at_ms":{"type":"integer","format":"int64","description":"The detecting evaluation's epoch-ms instant, not a globally unique record id."},"detected_at_ms":{"type":"integer","format":"int64"},"rules_version":{"type":"integer","format":"int32","description":"Rule version recorded at detection; never replaced by the current version.","minimum":0},"equity":{"type":"string"},"balance_including_credit":{"type":"string","description":"The latch's balance figure includes credit."},"hwm_equity":{"type":"string"},"start_equity":{"type":"string"},"day_baseline":{"type":["string","null"]},"monetary_today":{"type":"string"},"detection_rates":{"type":"array","items":{"$ref":"#/components/schemas/ApiBreachDetectionRate"},"description":"Persisted marked-up quotes; may be empty. No single causal quote is inferred."},"historical_action":{"type":["string","null"],"description":"Always null in this version: the latch does not record historical actions."},"historical_action_at_ms":{"type":["integer","null"],"format":"int64"},"unavailable":{"type":"array","items":{"$ref":"#/components/schemas/ApiBreachUnavailable"}}}},"ApiPropBreaches":{"type":"object","required":["challenge_id","account_id","trading_account_id","coverage","history_complete","items","breaches","current_challenge"],"properties":{"challenge_id":{"type":"string"},"account_id":{"type":"string"},"trading_account_id":{"type":"string"},"coverage":{"$ref":"#/components/schemas/ApiBreachCoverage"},"history_complete":{"type":"boolean","description":"True only when `breaches` is the whole history: recorded since the challenge's creation, never imported,\nnothing missing or unreadable. False is not proof of a missing breach."},"items":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropBreachEvidence"},"description":"Zero or one retained canonical equity-rail latch, not a full breach history."},"breaches":{"type":"array","items":{"$ref":"#/components/schemas/ApiBreachRecord"},"description":"every recorded breach (fails of every reason, daily-profit freezes) with its actions, oldest\ndecision first."},"current_challenge":{"$ref":"#/components/schemas/ApiBreachChallengeState","description":"Current state, separately read; not the historical action at the breach instant."}}},"ApiPropDiscount":{"type":"object","description":"The code a quote was asked to apply, applied or not.","required":["code","applied","status","amount"],"properties":{"code":{"type":"string"},"applied":{"type":"boolean","description":"`true` exactly when `status` is `valid` and `amount` was taken off."},"status":{"type":"string","description":"The same token `POST /api/v1/prop-discounts/validate` answers."},"kind":{"type":["string","null"],"description":"`percent` or `fixed`."},"rate":{"type":["string","null"],"description":"For `percent`: the fraction (decimal string)."},"amount":{"type":"string","description":"The money taken off (decimal string); zero when not applied."}}},"ApiPropDiscountValidateRequest":{"type":"object","description":"Check a discount code against one choice. A question, not a reservation.","required":["account_id","plan_id","size_label","code"],"properties":{"account_id":{"type":"string","description":"The account that would buy (some codes are per account)."},"plan_id":{"type":"string"},"size_label":{"type":"string"},"addon_ids":{"type":"array","items":{"type":"string"}},"code":{"type":"string","description":"The code as the buyer typed it."}},"additionalProperties":false},"ApiPropDiscountValidateResponse":{"type":"object","description":"The answer to a discount-code check.","required":["valid","status"],"properties":{"valid":{"type":"boolean","description":"`true` exactly when `status` is `valid`."},"status":{"type":"string","description":"`valid`, `not_found`, `invalid`, `expired`, `manual_deactivated`,\n`minimum_not_reached`, `more_than_maximum`, `try_exceeded`,\n`per_account_limit_exceeded` or `first_time_deposit_required`."}}},"ApiPropLineItem":{"type":"object","description":"One typed line of an order (quote or purchase).","required":["kind","description_key","amount","currency"],"properties":{"kind":{"type":"string","description":"`fee`, `addon`, `discount`, `retry_discount` or `keeper`; new kinds may\nappear."},"description_key":{"type":"string","description":"A stable copy key for the line's label\n(`prop.purchase.line.<kind>[.<reference>]`)."},"reference":{"type":["string","null"],"description":"What the line refers to: the add-on id, the discount code, the retry\ndiscount kind (`percent` / `fixed`) or the keeper dimension; `null` on\nthe fee line."},"amount":{"type":"string","description":"SIGNED money (decimal string): a charge is positive, a saving negative."},"currency":{"type":"string","description":"The order currency."}}},"ApiPropMinProfitableDays":{"type":"object","description":"The Minimum profitable days rule of one phase.","required":["days","min_day_profit","per_payout_cycle"],"properties":{"days":{"type":"integer","format":"int32","description":"How many profitable days are needed.","minimum":0},"min_day_profit":{"type":"string","description":"The smallest result a day must close at to count, in the plan currency (decimal string)."},"per_payout_cycle":{"type":"boolean","description":"`true`: counted again in each payout cycle of the funded phase (from the start of the phase or the\nlast approved payout); `false`: counted once over the phase."}}},"ApiPropPlan":{"type":"object","description":"One sellable plan.","required":["plan_id","revision","name","description","kind","currency","digits","free_trial","discount_codes_applicable","sizes","phases","addons"],"properties":{"plan_id":{"type":"string"},"revision":{"type":"integer","format":"int64","description":"Goes up on every change; send it as `expected_plan_revision`."},"name":{"type":"string"},"description":{"type":"string"},"kind":{"type":"string","description":"`paid`, or `free` for a free trial."},"currency":{"type":"string"},"digits":{"type":"integer","format":"int32","description":"Decimal places of `currency` (USD 2, JPY 0, BTC 8).","minimum":0},"free_trial":{"type":"boolean"},"discount_codes_applicable":{"type":"boolean","description":"`true` when a discount code can be entered on this plan at all (a paid\nplan; a free trial takes no code). Says nothing about WHICH codes: a\ncode is judged by `POST /api/v1/prop-discounts/validate` or the quote."},"sizes":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropPlanSize"}},"phases":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropPlanPhase"}},"addons":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropAddon"},"description":"Only the add-ons this plan sells."},"retry":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiPropPlanRetry","description":"Present when the plan offers a discounted retry after a failure."}]}}},"ApiPropPlanPhase":{"type":"object","description":"One phase of a plan and the rules it is judged by.","required":["index","kind","leverage","require_kyc","rules","keepers"],"properties":{"index":{"type":"integer","format":"int32","minimum":0},"kind":{"type":"string","description":"`audition`, `free_trial` or `funded`."},"leverage":{"type":"integer","format":"int32","minimum":0},"profit_split_trader_fraction":{"type":["string","null"],"description":"The trader's profit share in this phase, a fraction (decimal string)."},"require_kyc":{"type":"boolean"},"rules":{"$ref":"#/components/schemas/ApiPropRules"},"keepers":{"type":"array","items":{"type":"string"},"description":"The rule-protection (\"keeper\") products this phase sells, by\ndimension: `max_daily` and/or `max_total`. Empty = none is ever offered\non this phase. Eligibility only: this API has no keeper purchase route\nyet, and a keeper is priced per challenge, never here. Always present."}}},"ApiPropPlanRetry":{"type":"object","description":"The plan's retry offer terms.","required":["discount_kind","source"],"properties":{"discount_kind":{"type":"string","description":"`percent` (carries `discount_rate`) or `fixed` (carries `discount_amount`)."},"discount_rate":{"type":["string","null"]},"discount_amount":{"type":["string","null"]},"source":{"type":"string","description":"`original` (off the re-priced order) or `paid` (off what was paid)."},"expiry_days":{"type":["integer","null"],"format":"int32","minimum":0},"max_retries":{"type":["integer","null"],"format":"int32","minimum":0}}},"ApiPropPlanSize":{"type":"object","description":"One size of a plan.","required":["label","fee","funding","is_default"],"properties":{"label":{"type":"string","description":"What a purchase sends as `size_label`."},"fee":{"type":"string","description":"The price (decimal string)."},"funding":{"type":"string","description":"The account size the trader trades (decimal string)."},"is_default":{"type":"boolean"}}},"ApiPropPlansResponse":{"type":"object","description":"The plans this firm sells right now.","required":["plans"],"properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropPlan"}}}},"ApiPropPurchase":{"type":"object","description":"One purchase.","required":["purchase_id","account_id","status","mode","plan_id","plan_revision","plan_name","size_label","addon_ids","subtotal","discount_amount","retry_discount_amount","total","currency","digits","created_at_ms","line_items"],"properties":{"purchase_id":{"type":"string"},"account_id":{"type":"string"},"status":{"type":"string","description":"`pending`, `settling`, `settled`, `failed` or `chargebacked`."},"mode":{"type":"string","description":"`normal`, `free_trial` or `retry` — decided by the plan and the route."},"plan_id":{"type":"string"},"plan_revision":{"type":"integer","format":"int64"},"plan_name":{"type":"string"},"size_label":{"type":"string"},"addon_ids":{"type":"array","items":{"type":"string"}},"subtotal":{"type":"string","description":"The list price: the plan fee plus the add-ons (decimal string).\nAlways `subtotal − discount_amount − retry_discount_amount == total`,\nexactly, on every purchase (itemised or not)."},"discount_code":{"type":["string","null"]},"discount_amount":{"type":"string","description":"What the discount CODE took off this order (decimal string, `\"0.00\"`\nwhen none). A retry never carries a code, so it is `\"0.00\"` on a\n`retry` purchase — the retry's saving is `retry_discount_amount`.\nEquals the negated `discount` line when the purchase is itemised.\n`subtotal − discount_amount − retry_discount_amount == total`."},"retry_discount_amount":{"type":"string","description":"What the RETRY discount took off this order (decimal string, `\"0.00\"`\nwhen none — every purchase that is not a `retry`). It is what was\nactually taken off THIS order, so a retry priced off what was paid\nreads `subtotal − total`, not the configured rate × the paid amount.\nEquals the negated `retry_discount` line when the purchase is itemised.\n`subtotal − discount_amount − retry_discount_amount == total`."},"total":{"type":"string","description":"What the buyer pays. Authoritative."},"currency":{"type":"string"},"digits":{"type":"integer","format":"int32","minimum":0},"retry_of":{"type":["string","null"],"description":"The original purchase a retry retries."},"challenge_id":{"type":["string","null"],"description":"The challenge the purchase created, once settled."},"current_challenge_id":{"type":["string","null"],"description":"The challenge the trader is on now (a later phase of the same one)."},"failure_reason":{"type":["string","null"],"description":"Why a `failed` purchase did not complete: `payment_declined`,\n`payment_expired` or `cancelled`. `null` otherwise — including a failed\npurchase the broker's desk resolved by hand."},"failure_code":{"type":["string","null"],"description":"The coded reason a `failed` purchase surfaces beyond `failure_reason`:\n`discount_code_exhausted` when a deposit approved AFTER the purchase\nexpired (a capped discount-code hold ends after ~15 minutes — see\n`payment_required`) found the code's global use cap already spent. The\npurchase keeps `failure_reason: payment_expired`, no challenge is\ncreated, and the money stays an ordinary deposit on the account.\n`null` on every other purchase. New codes may appear. Always present."},"created_at_ms":{"type":"integer","format":"int64"},"settled_at_ms":{"type":["integer","null"],"format":"int64"},"trading_account_id":{"type":["string","null"],"description":"The trading account the challenge trades on. `null` until `settled`,\nlike `challenge_id`. Always present."},"transaction_id":{"type":["string","null"],"description":"The monetary transaction linked as this purchase's payment: the\ndeposit whose approval settled it, else the deposit attached to it. A\ndeposit is attached the moment it is CREATED naming the purchase, so\nthis can be set while `status` is still `pending` and\n`payment_required` is `true` — the payment is linked but has not\nsettled. `null` when no payment is linked (a free trial, a zero total,\nnot paid yet). Always present."},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropLineItem"},"description":"What was sold, as typed lines summing to `total` exactly (each line is\none `ApiPropLineItem`). Always present, never `null`: `[]` means not\nitemised — a purchase recorded before lines were stored, never\nback-filled and never rebuilt on read. Every purchase priced from a quote\ncarries at least one line, so `[]` is never ambiguous. `subtotal` /\n`discount_amount` / `retry_discount_amount` / `total` stay\nauthoritative for an empty list (the identity holds there too)."}}},"ApiPropPurchaseRequest":{"type":"object","description":"Buy one plan for one account. The only choices are the plan, its size, the\nadd-ons it sells and one discount code; every rule, price and flag comes\nfrom the plan. A field not listed here is refused (`unknown_field`).","required":["account_id","plan_id","size_label"],"properties":{"account_id":{"type":"string","description":"The buying account (a decimal string id)."},"plan_id":{"type":"string","description":"The plan id, from the plan list."},"size_label":{"type":"string","description":"One of the plan's `sizes[].label`."},"addon_ids":{"type":"array","items":{"type":"string"},"description":"Add-on ids the plan sells (`addons[].id`), no repeats."},"discount_code":{"type":["string","null"],"description":"One discount code per purchase."},"expected_plan_revision":{"type":["integer","null"],"format":"int64","description":"The plan `revision` shown to the buyer; a plan changed since refuses the\npurchase (`purchase_plan_changed`, 409) and writes nothing. It is a\nprecondition, not part of the request's identity, and that 409 is NOT\nstored under the Idempotency-Key: re-read the plan and retry with the\nnew `revision` under the SAME Idempotency-Key (a new key works too)."}},"additionalProperties":false},"ApiPropPurchaseResponse":{"type":"object","description":"A purchase and whether money is still owed on it.","required":["purchase","payment_required"],"properties":{"purchase":{"$ref":"#/components/schemas/ApiPropPurchase"},"payment_required":{"type":"boolean","description":"`true` while the purchase is `pending` with a positive total: pay it with\na `POST /api/v1/transactions` deposit naming `prop_purchase_id`.\nA purchase that holds a slot of a discount code with a global use cap\n(`max_uses`) is held for a short time only (default 15 minutes,\n`PROP_CAPPED_HOLD_TTL_SECS`): a linked deposit still pending then does\nNOT keep it open — it fails `payment_expired` and frees the slot. A\nlater approval of that deposit revives it when it can; when the code's\ncap is spent by then, it stays `failed` with `failure_code:\ndiscount_code_exhausted` and the money stays an ordinary deposit."}}},"ApiPropQuote":{"type":"object","description":"The price of one choice, line by line.","required":["plan_id","plan_revision","size_label","currency","digits","funding","fee","addons","subtotal","total","free_trial","line_items"],"properties":{"plan_id":{"type":"string"},"plan_revision":{"type":"integer","format":"int64"},"size_label":{"type":"string"},"currency":{"type":"string"},"digits":{"type":"integer","format":"int32","minimum":0},"funding":{"type":"string"},"fee":{"type":"string"},"addons":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropQuoteAddonLine"}},"subtotal":{"type":"string","description":"`fee` plus the add-ons."},"discount":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiPropDiscount","description":"`null` when no code was sent. A code that does not apply never fails\nthe quote: it comes back with `applied: false` and its `status`, and\nthe purchase would refuse it 422 `discount_<status>`."}]},"total":{"type":"string","description":"What the buyer pays: never below zero, never above `subtotal`."},"free_trial":{"type":"boolean"},"line_items":{"type":"array","items":{"$ref":"#/components/schemas/ApiPropLineItem"},"description":"The same order as typed lines — the fee, each add-on, then any saving\nas ONE negative line — summing to `total` exactly. A purchase made from\nthis quote stores exactly these lines. The lines are the invoice: where\na saving's own figure and its line differ, reconcile against the lines\nand `total`."}}},"ApiPropQuoteAddonLine":{"type":"object","description":"One priced add-on of a quote.","required":["id","price_kind","amount"],"properties":{"id":{"type":"string"},"price_kind":{"type":"string","description":"`fixed` or `percent`."},"rate":{"type":["string","null"],"description":"For `percent`: the fraction of the fee (decimal string)."},"amount":{"type":"string"}}},"ApiPropQuoteRequest":{"type":"object","description":"Price one choice exactly as a purchase would, reserving nothing — the\npurchase body without the plan-revision lock.","required":["account_id","plan_id","size_label"],"properties":{"account_id":{"type":"string","description":"The account that would buy."},"plan_id":{"type":"string"},"size_label":{"type":"string"},"addon_ids":{"type":"array","items":{"type":"string"}},"discount_code":{"type":["string","null"],"description":"A code that does not apply never fails the quote: it comes back as\n`discount` with `applied: false` and its `status`; only a purchase refuses it."}},"additionalProperties":false},"ApiPropRetryDiscount":{"type":"object","description":"The retry discount.","required":["kind","source"],"properties":{"kind":{"type":"string","description":"`percent` (carries `rate`) or `fixed` (carries `amount`)."},"rate":{"type":["string","null"]},"amount":{"type":["string","null"]},"source":{"type":"string","description":"`original` or `paid`."}}},"ApiPropRetryOffer":{"type":"object","description":"The retry offer for a purchase whose challenge failed. `available: false`\nalways carries `unavailable_reason`, or names the retry already waiting for\npayment (`pending_purchase_id`).","required":["available","of_purchase_id","plan_id","size_label","addon_ids","currency","digits","lineage_purchase_ids"],"properties":{"available":{"type":"boolean"},"unavailable_reason":{"type":["string","null"],"description":"`not_offered`, `origin_not_settled`, `challenge_not_failed`, `expired`,\n`limit_reached`, `plan_unavailable`, `not_priceable`, `retry_in_progress`\n`already_paid` (an earlier retry of it was paid) or\n`payment_pending` (an earlier retry's payment is not final yet; re-opens) or\n`superseded` (a newer retry of this lineage settled: only the newest failed\npurchase offers a retry)."},"of_purchase_id":{"type":"string"},"challenge_id":{"type":["string","null"]},"plan_id":{"type":"string"},"size_label":{"type":"string","description":"Forced on the retry: the original size."},"addon_ids":{"type":"array","items":{"type":"string"},"description":"Forced on the retry: the original add-ons."},"discount":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiPropRetryDiscount"}]},"fee":{"type":["string","null"]},"full_price":{"type":["string","null"],"description":"What the same order costs without the retry discount."},"cost":{"type":["string","null"],"description":"What the retry costs."},"currency":{"type":"string"},"digits":{"type":"integer","format":"int32","minimum":0},"expires_at_ms":{"type":["integer","null"],"format":"int64"},"retries_left":{"type":["integer","null"],"format":"int32","description":"Retries left before this one; `null` = unlimited.","minimum":0},"pending_purchase_id":{"type":["string","null"],"description":"A retry of this purchase already waiting for payment: pay that one."},"in_progress_challenge_id":{"type":["string","null"],"description":"An earlier retry's challenge still running (`retry_in_progress`)."},"prior_failure_reason":{"type":["string","null"],"description":"Why the challenge that opened this offer failed (`max_total_loss`,\n`max_daily_loss`, `duration_expired`, `weekend_hold`, `inactivity`,\n`manually_disqualified`, `extra_funding_detected`; new reasons may\nappear — a challenge cancelled by a payment reversal reads\n`manually_disqualified`). `null` when it did not fail."},"original_challenge_id":{"type":["string","null"],"description":"The challenge the lineage's ORIGINAL purchase produced; `null` when the\noriginal is gone or never settled."},"lineage_purchase_ids":{"type":"array","items":{"type":"string"},"description":"The purchase chain, the ORIGINAL first, ending with `of_purchase_id`\n(original, retry 1, retry 2, …)."},"purchase_blocked_by":{"type":["string","null"],"description":"The purchase gate that would refuse buying this retry NOW: the exact\n`detail` code `POST /api/v1/prop-purchases/{id}/retry` would answer\n(409 — e.g. `purchase_kyc_required`, `purchase_support_required`,\n`purchase_deposit_not_qualified`, `verification_required_to_pay`,\n`verification_required_for_amount`, `purchase_pending_limit_reached`;\nnew codes may appear), judged by the same checks the purchase runs, in\nits order, on `cost`. `null` when nothing blocks, on every offer that\nis not `available` — except one refused `not_priceable` because the\nplan's MT5 target cannot provision, which names\n`plan_target_not_available` (422 on the purchase) — and when the check\ncould not be read (the purchase still checks). Advisory: `available`\nstays `true` while a gate blocks — clear the gate, then buy. Always\npresent. Readable with `prop-challenges:read`: a read credential sees\nthe account's purchase-gate state here (only for an account it can\nreach — never another account's)."},"purchase_blocked_purchase_id":{"type":["string","null"],"description":"The purchase `purchase_blocked_by` binds: set only for\n`purchase_pending_limit_reached` — the account's newest open unpaid\ncheckout, the purchase that refusal names (pay it, or let it expire,\ninstead of opening another). `null` otherwise. Always present."}}},"ApiPropRetryRequest":{"type":"object","description":"Buy the retry of a failed challenge — takes NO selection: the original\npurchase's size and add-ons are forced. The body is `{}`.","additionalProperties":false},"ApiPropRules":{"type":"object","description":"The phase's headline rules; fractions of the account size (decimal\nstrings). A rule the plan switches off is absent.","properties":{"profit_target":{"type":["string","null"]},"max_daily_loss":{"type":["string","null"]},"max_total_loss":{"type":["string","null"]},"max_daily_profit":{"type":["string","null"]},"min_trading_days":{"type":["integer","null"],"format":"int32","minimum":0},"duration_days":{"type":["integer","null"],"format":"int32","minimum":0},"min_profitable_days":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiPropMinProfitableDays","description":"Minimum profitable days: the phase passes (and, on a funded phase, each payout is allowed) only after\n`days` trading days that each closed at or above `min_day_profit`. Absent when the plan does not use the\nrule on this phase."}]}}},"ApiQueryRequest":{"type":"object","description":"The bulk-read request body.","properties":{"filter":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/QueryNode","description":"Server-validated filter tree. Field names are registry lookup keys, not\nSQL — an unknown name is a 422, never an identifier."}]},"columns":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ColumnTerm"},"description":"Which registry fields to project. Absent ⇒ every field of the base\nentity."},"sort":{"type":["string","null"],"description":"Sort column, from the per-entity allowlist. A non-allowlisted sort is a\n422 `sort_not_allowed` — the allowlist is exactly the set of INDEXED\nexpressions, so an arbitrary sort cannot turn a page into a heap sort."},"dir":{"type":["string","null"],"description":"Page direction. Default `desc` (newest first)."},"limit":{"type":["integer","null"],"format":"int64","description":"Rows per page. Default 100, clamped to 500."},"after":{"type":["string","null"],"description":"Opaque cursor from a previous page's `next_cursor`."}}},"ApiQueryResponse":{"type":"object","description":"A page. No total by default: counting a firm-wide ledger costs more than the\npage itself, and a stale count is worse than none.","required":["rows","sort"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiQueryRow"}},"next_cursor":{"type":["string","null"],"description":"Present iff another page exists. Opaque — mint and verify live only in\n`pagination`."},"sort":{"type":"string","description":"The sort this page was ACTUALLY ordered by.\n\nNormally the one requested (or the base's default). It differs when the\ndefault sort field is withheld from this credential: the page then falls\nback to the primary key rather than refusing the whole base. Echoed so a\nclient walking the default order can see which order it got — and so the\ncursor-vs-sort mismatch it would hit the day an unmask grant lands is\nexplainable rather than mysterious."}}},"ApiQueryRow":{"type":"object","description":"One query result row, containing its record ID, owning account ID and\nrequested fields permitted by the credential's field-security policy.","required":["record_id","account_id","fields"],"properties":{"record_id":{"type":"integer","format":"int64","description":"The row's own record id."},"account_id":{"type":"integer","format":"int64","description":"The owning customer account (the row's tenant) — the identity every scope\ndecision is made against."},"fields":{"type":"object","description":"The requested fields available for this entity, with field-security\nrestrictions applied. Fields not selected or not permitted are omitted.\nA related column (`path` + `field`) appears under its dotted path, e.g.\n`instrument.symbol` (a custom field: `account.cf:<name>`)."}}},"ApiReconciliation":{"type":"object","required":["currency","platform","supplied","differences"],"properties":{"currency":{"type":"string"},"digits":{"type":["integer","null"],"format":"int32","description":"ISO 4217 minor units of `currency`; null for a currency with no ISO rule (crypto, metals).","minimum":0},"platform":{"$ref":"#/components/schemas/ApiMoneyPair"},"supplied":{"$ref":"#/components/schemas/ApiMoneyPair"},"differences":{"type":"array","items":{"$ref":"#/components/schemas/ApiDifference"}}}},"ApiReplicationBind":{"type":"object","description":"One bind. A disabled or refused bind carries no `dsn`, `feed_bearer` or\n`target.pinned_ip` — the keys are absent, not blank.","required":["id","firm_id","label","broker_id","enabled","pii","timezone","allow_rebuild","schema_version","cadence","egress_allowlist","target","target_engine","rebuild_requested_ms","pii_purge_requested_ms","pii_purge_completed_request_ms"],"properties":{"id":{"type":"integer","format":"int64"},"firm_id":{"type":"integer","format":"int64"},"label":{"type":"string"},"broker_id":{"type":"string"},"enabled":{"type":"boolean"},"pii":{"type":"boolean"},"timezone":{"type":"string","description":"IANA zone every replicated time is converted into."},"allow_rebuild":{"type":"boolean"},"schema_version":{"type":"integer","format":"int32","description":"The target's DDL ledger head the replicator last reported."},"cadence":{"$ref":"#/components/schemas/ApiReplicationBindCadence"},"egress_allowlist":{"type":"array","items":{"type":"string"},"description":"Bare IPs / CIDR ranges every target address must fall inside; empty = any\npublic address. The replicator re-applies it before every connection."},"target":{"$ref":"#/components/schemas/ApiReplicationBindTarget"},"target_engine":{"$ref":"#/components/schemas/TargetEngine","description":"The target database engine, recorded from the connection URL's scheme.\nFor older binds without a recorded engine, the label is inferred from the port.\nInformational: the replicator connects using `dsn`; this label matches the\nengine shown on the Backoffice health card."},"target_ca_pem":{"type":["string","null"],"description":"A PEM CA bundle the target's certificate chains to (private CA)."},"dsn":{"type":["string","null"],"description":"The DECRYPTED target DSN (`sslmode=verify-full`). Present only when ready."},"feed_bearer":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiReplicationFeedBearer","description":"A bearer for the bind's own `replication:read` credential. Present only\nwhen ready."}]},"refusal":{"type":["string","null"],"description":"Why the bind is not served (`credential_unusable`, `firm_mismatch`,\n`egress:<reason>`, `target_mismatch`, `kms_unavailable`,\n`bearer_unavailable`). Absent when served or merely disabled."},"rebuild_requested_ms":{"type":"integer","format":"int64","description":"The operator's last re-snapshot request (epoch milliseconds, `0` = none).\nA new value restarts the bind, which then performs its one automatic rebuild."},"pii_purge_requested_ms":{"type":"integer","format":"int64","description":"The operator's last PII purge request (epoch milliseconds, `0` = none)."},"pii_purge_completed_request_ms":{"type":"integer","format":"int64","description":"The purge request this bind last reported completed. The replicator\npurges at startup while `pii_purge_requested_ms` is newer and PII is disabled."}}},"ApiReplicationBindCadence":{"type":"object","required":["feed_poll_ms","sweep_ms","daily_check_ms","feed_idle_max_ms","audit_ms"],"properties":{"feed_poll_ms":{"type":"integer","format":"int64","minimum":0},"sweep_ms":{"type":"integer","format":"int64","minimum":0},"daily_check_ms":{"type":"integer","format":"int64","minimum":0},"feed_idle_max_ms":{"type":"integer","format":"int64","minimum":0},"audit_ms":{"type":"integer","format":"int64","minimum":0}}},"ApiReplicationBindHealth":{"type":"object","description":"A bind's health, as reported by the replicator. Timestamps are epoch\nmilliseconds on the replicator's clock; `0` means never. Every field is\noptional; unknown fields are ignored.","properties":{"reported_at_ms":{"type":"integer","format":"int64"},"started_ms":{"type":"integer","format":"int64","description":"When the bind's task started (the floor of the audit window)."},"last_write_ms":{"type":"integer","format":"int64","description":"The last commit that stamped a `MODIFY_TIME`."},"last_write_stamp":{"type":["string","null"]},"tables":{"$ref":"#/components/schemas/ApiReplicationBindHealthTables"},"feed":{"$ref":"#/components/schemas/ApiReplicationBindHealthFeed"},"backfill":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiReplicationBindHealthBackfill"}]},"audit":{"$ref":"#/components/schemas/ApiReplicationBindHealthAudit"},"pii_purge":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiReplicationBindHealthPiiPurge"}]},"rebuilt_ms":{"type":"integer","format":"int64"},"rebuilds":{"type":"integer","format":"int64"}}},"ApiReplicationBindHealthAudit":{"type":"object","description":"The drift audit over the bind task's last 24 hours.","properties":{"last_run_ms":{"type":"integer","format":"int64"},"last_outcome":{"type":"string","description":"`clean`, `healed`, `failed` or `waiting_for_feed`."},"runs":{"type":"integer","format":"int64"},"mismatched":{"type":"integer","format":"int64"},"repaired":{"type":"integer","format":"int64"},"ghosts":{"type":"integer","format":"int64"},"unrepaired_last":{"type":"integer","format":"int64"},"window_since_ms":{"type":"integer","format":"int64"}}},"ApiReplicationBindHealthBackfill":{"type":"object","description":"The initial load's progress.","properties":{"kind":{"type":"string"},"kinds_done":{"type":"integer","format":"int64"},"kinds_total":{"type":"integer","format":"int64"},"started_at_ms":{"type":"integer","format":"int64"}}},"ApiReplicationBindHealthFeed":{"type":"object","description":"The change feed as the bind last read it.","properties":{"caught_up":{"type":"boolean"},"lag_ids":{"type":"integer","format":"int64","description":"An id distance (journal ids are global), not a row count."},"high_water_id":{"type":"integer","format":"int64"},"applied_id":{"type":"integer","format":"int64"},"settled_at_ms":{"type":"integer","format":"int64"},"last_page_ms":{"type":"integer","format":"int64"}}},"ApiReplicationBindHealthPiiPurge":{"type":"object","description":"A completed PII purge.","properties":{"completed_request_ms":{"type":"integer","format":"int64"},"ran_ms":{"type":"integer","format":"int64"},"rows_changed":{"type":"integer","format":"int64"}}},"ApiReplicationBindHealthTables":{"type":"object","description":"The last batch that wrote each target table family.","properties":{"users_ms":{"type":"integer","format":"int64"},"trades_ms":{"type":"integer","format":"int64"},"daily_ms":{"type":"integer","format":"int64"},"deleted_ms":{"type":"integer","format":"int64"}}},"ApiReplicationBindStatusAck":{"type":"object","required":["id","last_seen_ms"],"properties":{"id":{"type":"integer","format":"int64"},"last_seen_ms":{"type":"integer","format":"int64","description":"When the server last recorded a report for this bind (epoch ms). Unchanged\nreports are coalesced, so this can lag the call."},"beat_key":{"type":["string","null"],"description":"Session-only signing key, present only on a successful own-bind projection."}}},"ApiReplicationBindStatusReport":{"type":"object","description":"The replicator's status report for one bind.","required":["state"],"properties":{"state":{"type":"string","description":"`connecting`, `ready`, `parked`, `rebuild_required` or `stopped`."},"last_error":{"type":["string","null"]},"last_cursor":{"type":["string","null"]},"rebuild_required":{"type":"boolean"},"schema_version":{"type":"integer","format":"int32"},"health":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiReplicationBindHealth","description":"The bind's health information, displayed on the Backoffice health card.\nOptional: omitting it preserves the previously reported health information."}]},"session_id":{"type":["string","null"],"description":"Optional process metadata; old workers keep their existing route/scope."},"running_image":{"type":["string","null"]},"git_sha":{"type":["string","null"]},"config_revision_applied":{"type":["integer","null"],"format":"int64"},"started_ms":{"type":["integer","null"],"format":"int64"}}},"ApiReplicationBindTarget":{"type":"object","required":["host","port"],"properties":{"host":{"type":"string"},"port":{"type":"integer","format":"int32","minimum":0},"database":{"type":["string","null"]},"pinned_ip":{"type":["string","null"],"description":"The validated target address. Before every connection, the replicator\nrequires it to remain among the target host's addresses."},"resolved_ips":{"type":"array","items":{"type":"string"},"description":"Every address the host resolved to when it was pinned."}}},"ApiReplicationBindsResponse":{"type":"object","description":"The directory.","required":["binds","served_at_ms"],"properties":{"binds":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationBind"}},"served_at_ms":{"type":"integer","format":"int64","description":"When this directory was assembled (epoch ms)."}}},"ApiReplicationCatalog":{"type":"object","description":"Controller inventory contains only identity and a configuration stamp. It\nnever decrypts stored credentials or mints a feed token.","required":["binds","served_at_ms"],"properties":{"binds":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationCatalogEntry"}},"served_at_ms":{"type":"integer","format":"int64"}}},"ApiReplicationCatalogEntry":{"type":"object","required":["id","firm_id","enabled","config_revision"],"properties":{"id":{"type":"integer","format":"int64"},"firm_id":{"type":"integer","format":"int64"},"enabled":{"type":"boolean"},"config_revision":{"type":"integer","format":"int64"}}},"ApiReplicationChangeRow":{"type":"object","description":"One change. `payload` is absent for a delete.","required":["id","tenant","kind","record_id","revision","op"],"properties":{"id":{"type":"integer","format":"int64","description":"The journal position of this change. Strictly increasing across the feed;\nechoed for diagnostics — page with `next_cursor`, never by constructing a\ncursor from this."},"tenant":{"type":"integer","format":"int64","description":"The record's tenant. For account-scoped kinds this is the account id."},"kind":{"type":"string","description":"The records-store kind NAME (`forex`, `balance_action`, …)."},"record_id":{"type":"integer","format":"int64"},"revision":{"type":"integer","format":"int64","description":"For `insert`/`update`: the LIVE record's revision, which is what the\npayload below reflects. For `delete`: the revision at which the delete was\njournaled."},"op":{"type":"string","description":"`insert` | `update` | `delete`."},"payload":{"type":["object","null"],"description":"The live payload, FLS-redacted and projected. Absent for a delete —\nincluding an insert/update whose live row has since been deleted, which is\nreported as a delete."}}},"ApiReplicationChangesRequest":{"type":"object","description":"The change-feed request.","properties":{"cursor":{"type":["string","null"],"description":"Opaque cursor from a previous page's `next_cursor`.\n\n**`null` means \"position me at the current settled high-water\", and\nreturns no rows** — it does NOT mean \"from the beginning\". That is what a\nbind captures before its initial snapshot scan: a\njournal row is written only after its records transaction commits, so\nnothing at or below this position can be missing from the snapshot that\nfollows, and everything after it is replayed by the incremental loop where\nthe sink's revision guard makes the replay a no-op. Replaying from zero\ninstead would re-page the entire retained journal on every misconfigured\nbind — and would 410 wherever retention is enabled."},"limit":{"type":["integer","null"],"format":"int64","description":"Rows per page. Default 100, clamped to 1000."}}},"ApiReplicationChangesResponse":{"type":"object","description":"One page of changes.","required":["rows","source_instance_id"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationChangeRow"}},"next_cursor":{"type":["string","null"],"description":"The position to resume from. Present whenever a position exists at all.\nOn a page that came back short it is the position the page read up to\n(nothing more for this firm sits below it), so an empty page can still move\nit forward; on a page that read nothing it is the caller's own position\nechoed back, so a poll loop never loses its place. Absent only when this\nprocess has not yet settled on any position for this firm (retry after the\nsettle window)."},"high_water_id":{"type":["integer","null"],"format":"int64","description":"The largest journal id observed for this firm by THIS call (its own rows\nand the catalog rows, of any kind), settled or not. `high_water_id >\nsettled` is normal and expected — it is the change the settle window is\nstill holding back."},"settled_at":{"type":["string","null"],"description":"When the served position was FIRST observed (RFC 3339). Absent when no\nposition has settled yet."},"source_instance_id":{"type":"string","description":"The identity of the database this page was read from\n(`system_settings.instance_id`). A replica bound to one source must refuse\npages from another: record ids and journal positions from two databases\ncollide by construction, so interleaving them corrupts silently. Stable for\nthe life of a database; changes only when it is flushed or reinstalled."}}},"ApiReplicationCredential":{"type":"object","description":"Replication credentials returned only when created. Store the client secret\nsecurely; it cannot be retrieved again.","required":["client_id","client_secret"],"properties":{"client_id":{"type":"string"},"client_secret":{"type":"string"}}},"ApiReplicationDailyHistoryResponse":{"type":"object","description":"One ascending page of daily history.","required":["rows","settled_at"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationDailyHistoryRow"}},"next_cursor":{"type":["string","null"],"description":"Absent ⇔ you are caught up to `settled_at`. Present ⇒ call again with it."},"settled_at":{"type":"string","description":"The high-water this page was served against: no row with a later\n`updated_at` was considered. Once `next_cursor` is absent, THIS is your\nnext `since` — never the last row's own `updated_at`."}}},"ApiReplicationDailyHistoryRow":{"type":"object","description":"One `public.account_daily_history` row, every column.\n\nMoney is a Decimal STRING throughout, the rule this whole listener follows —\na float balance is `0.1 + 0.2` in a customer's ledger. The four gross legs and\n`snapshot_at_ms` are nullable and are serialised as `null` when absent rather\nthan omitted: on a row written before migration 021 the split was never stored\nand is not derivable, and \"unknown\" is a different answer from \"zero\".","required":["tenant_id","workspace_id","trading_account_id","day","trading_terms_id","trading_terms_name","currency","balance_prev","balance","deposit","credit","profit_closed","profit","equity","margin","margin_free","daily_credit","daily_pl","daily_volume","open_swap","open_commission","updated_at"],"properties":{"tenant_id":{"type":"integer","format":"int64","description":"The account id — `account_daily_history.tenant_id`."},"workspace_id":{"type":"integer","format":"int64","description":"The firm that owned the account ON THIS DAY."},"trading_account_id":{"type":"integer","format":"int64","description":"The trading account (`ForexAccount`) id — the legacy `mt4_daily.LOGIN`."},"day":{"type":"string","description":"The account's local trading date, ISO `YYYY-MM-DD`."},"trading_terms_id":{"type":"integer","format":"int64"},"trading_terms_name":{"type":"string","description":"Denormalised tier name — the legacy `mt4_daily.GROUP`."},"currency":{"type":"string"},"balance_prev":{"type":"string"},"balance":{"type":"string"},"deposit":{"type":"string","description":"NET money movement of the balance pool that day (deposits − withdrawals);\nthe legacy parity column. The gross legs are below."},"credit":{"type":"string"},"profit_closed":{"type":"string"},"profit":{"type":"string"},"equity":{"type":"string"},"margin":{"type":"string"},"margin_free":{"type":"string"},"daily_credit":{"type":"string","description":"NET movement of the credit pool that day."},"daily_pl":{"type":"string"},"daily_volume":{"type":"string"},"prev_day":{"type":["string","null"],"description":"The previous row's `day` for this account; `null` on its first day."},"open_swap":{"type":"string"},"open_commission":{"type":"string"},"snapshot_at_ms":{"type":["integer","null"],"format":"int64","description":"Epoch-ms the row's money state was valued; `null` on rows predating\nmigration 015."},"deposit_in":{"type":["string","null"],"description":"GROSS deposits into the balance pool that day (absolute). `null` means\n\"net-only day\" — a row written before migration 021, whose split was never\nstored. NOT zero."},"deposit_out":{"type":["string","null"]},"credit_in":{"type":["string","null"]},"credit_out":{"type":["string","null"]},"updated_at":{"type":"string","description":"When this row was last inserted or overwritten — the walk's key. RFC3339\nUTC, microsecond precision."}}},"ApiReplicationDailyRunsResponse":{"type":"object","description":"The run markers for one day, plus the firm's own row count for it.","required":["day","runs","firm_row_count"],"properties":{"day":{"type":"string","description":"Echo of the requested day, ISO `YYYY-MM-DD`."},"runs":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationRunMarker"},"description":"Completed runs on the trading systems this firm uses. A system with no\ncompleted run for the day is ABSENT — that absence is the closed gate."},"firm_row_count":{"type":"integer","format":"int64","description":"How many `daily-history` rows this firm has for that day right now. The\nnumber to reconcile a replica against, and the one signal that catches a\nday deleted and not re-inserted (which a frozen marker count never could)."}}},"ApiReplicationDigestRequest":{"type":"object","description":"The digest request.","required":["kind"],"properties":{"kind":{"type":"string","description":"Which replicated kind to digest."},"tenants":{"type":["array","null"],"items":{"type":"integer","format":"int64"},"description":"Restrict the digest to these tenants (at most 1000), intersected with the\nfirm's roster. Absent digests every tenant in scope."}}},"ApiReplicationDigestResponse":{"type":"object","description":"A digest over one kind.","required":["kind","tenants","firm"],"properties":{"kind":{"type":"string"},"tenants":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationDigestRow"},"description":"Ascending by tenant. Exactly the requested tenants that are in scope, or\nevery tenant in scope when none were requested."},"firm":{"$ref":"#/components/schemas/ApiReplicationDigestRollup","description":"The cheap first comparison: a sink checks this, and only bisects per\ntenant when it differs."}}},"ApiReplicationDigestRollup":{"type":"object","description":"The whole-firm fold of the rows beside it.","required":["tenants","count","revision_sum","hash_xor"],"properties":{"tenants":{"type":"integer","format":"int64","description":"How many tenants were in scope."},"count":{"type":"integer","format":"int64"},"revision_sum":{"type":"integer","format":"int64"},"hash_xor":{"type":"integer","format":"int32"}}},"ApiReplicationDigestRow":{"type":"object","description":"One tenant's digest over one kind.","required":["tenant","count","revision_sum","hash_xor"],"properties":{"tenant":{"type":"integer","format":"int64"},"count":{"type":"integer","format":"int64","description":"Live records of this kind under this tenant. `0` for a tenant that is in\nscope and holds none — which is NOT the same as being absent from this\nlist, and a sink must not conflate them (an absent tenant is not this\nfirm's; a zero one is, and simply has no rows)."},"revision_sum":{"type":"integer","format":"int64","description":"`sum(revision)` over those records."},"hash_xor":{"type":"integer","format":"int32","description":"`bit_xor(hashtext(record_id::text || ':' || revision::text))` — a 32-bit\nsigned value. Order-independent and payload-independent."}}},"ApiReplicationFeedBearer":{"type":"object","required":["access_token","token_type","expires_in"],"properties":{"access_token":{"type":"string"},"token_type":{"type":"string","description":"Always `Bearer`."},"expires_in":{"type":"integer","format":"int64","description":"Seconds."}}},"ApiReplicationRunMarker":{"type":"object","description":"One completed nightly run — the gate a daily pull opens on (Box 5.3).","required":["trading_system_id","zone","day","taken_at","account_count"],"properties":{"trading_system_id":{"type":"integer","format":"int64","description":"The trading system whose local midnight bounded the day."},"zone":{"type":"string","description":"That system's IANA zone. Informational."},"day":{"type":"string","description":"The local trading date the run covered, ISO `YYYY-MM-DD`."},"taken_at":{"type":"string","description":"When the run completed. RFC3339 UTC."},"account_count":{"type":"integer","format":"int64","description":"How many rows the run wrote — across EVERY firm on that trading system,\nwhich is the marker's own figure and is NOT firm-scoped. Reconcile a\nreplica against `firm_row_count` on the response instead."}}},"ApiReplicationSnapshotRequest":{"type":"object","description":"The snapshot request.","required":["kind"],"properties":{"kind":{"type":"string","description":"Which replicated kind to page. One of the names the change feed serves;\nanything else is refused rather than answered with an empty page."},"cursor":{"type":["string","null"],"description":"Opaque cursor from a previous page's `next_cursor`. `null` starts the scan."},"limit":{"type":["integer","null"],"format":"int64","description":"Rows per page. Default 100, clamped to 1000."},"tenants":{"type":["array","null"],"items":{"type":"integer","format":"int64"},"description":"Restrict the scan to these tenants (account ids; for the catalog kinds,\nthe system tenant).\n\n**It can only narrow.** The list is intersected with the firm's own\nroster, so an id belonging to another firm — or to nothing — is simply\nabsent from the scan rather than refused, which is the same answer the\ndigest gives and keeps the endpoint from becoming an existence oracle.\nAt most 1000 ids. This is what makes a per-account repair (Box 6.6) cost\none account instead of a full re-page of the firm."}}},"ApiReplicationSnapshotResponse":{"type":"object","description":"One page of a snapshot.","required":["rows","source_instance_id"],"properties":{"rows":{"type":"array","items":{"$ref":"#/components/schemas/ApiReplicationSnapshotRow"}},"next_cursor":{"type":["string","null"],"description":"The position to resume from. **Absent ONLY when the scan is complete.** An\nempty page that still carries a cursor means \"keep going\" — the walk was\nstopped by its per-call window budget, not by running out of records."},"source_instance_id":{"type":"string","description":"The identity of the database this page was read from — the same value the\nchange feed reports, so a sink can refuse a different source before its\nfirst staged row."}}},"ApiReplicationSnapshotRow":{"type":"object","description":"One record of the requested kind.","required":["tenant","kind","record_id","revision","payload"],"properties":{"tenant":{"type":"integer","format":"int64","description":"The record's tenant. For an account-scoped kind this IS the account id."},"kind":{"type":"string","description":"The records-store kind NAME, echoed so a row is self-describing."},"record_id":{"type":"integer","format":"int64"},"revision":{"type":"integer","format":"int64","description":"The LIVE revision — the same number the change feed reports and the digest\nsums, so a sink's `src_revision` guard always compares like with like."},"payload":{"type":"object","description":"The payload, FLS-redacted then projected onto the feed's per-kind\nallowlist. A masked field is ABSENT, never null."}}},"ApiReplicationWhoami":{"type":"object","description":"Which firm a credential is bound to.","required":["client_rid","firm_id","scopes"],"properties":{"client_rid":{"type":"integer","format":"int64","description":"The `BrokerApiClient` record id."},"firm_id":{"type":"integer","format":"int64","description":"The firm workspace this credential reads — the one a replication feed\nread with it serves."},"brand_id":{"type":["integer","null"],"format":"int64"},"scopes":{"type":"array","items":{"type":"string"}}}},"ApiSideBreakdown":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["trades","winning","losing"],"properties":{"trades":{"type":"integer","format":"int32","minimum":0},"winning":{"type":"integer","format":"int32","minimum":0},"losing":{"type":"integer","format":"int32","minimum":0},"win_rate_pct":{"type":["string","null"]},"result":{"type":["string","null"],"description":"Null when the credential's field security masks its source figure."}}},"ApiStatisticsBody":{"oneOf":[{"$ref":"#/components/schemas/ApiStatisticsRange"},{"$ref":"#/components/schemas/ApiStatisticsRead"}]},"ApiStatisticsLive":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","properties":{"equity":{"type":["string","null"]},"margin":{"type":["string","null"]},"margin_usage_pct":{"type":["string","null"]},"avg_leverage":{"type":["string","null"]},"largest_exposure_pct":{"type":["string","null"]}}},"ApiStatisticsMetrics":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["money","quality","risk","score","composition","days_with_history","return_coverage_insufficient"],"properties":{"money":{"$ref":"#/components/schemas/ApiStatsMoney"},"quality":{"$ref":"#/components/schemas/ApiStatsQuality"},"risk":{"$ref":"#/components/schemas/ApiStatsRisk"},"score":{"$ref":"#/components/schemas/ApiStatsScore"},"composition":{"$ref":"#/components/schemas/ApiStatsComposition"},"days_with_history":{"type":"integer","format":"int32","minimum":0},"return_coverage_insufficient":{"type":"boolean"},"first_day":{"type":["string","null"]},"last_day":{"type":["string","null"]}}},"ApiStatisticsRange":{"type":"object","description":"Ranged broker statistics. No stored period rows and no `by_symbol`. `live` is right now, not the range.","required":["kind","analytics","range","currency","digits","live"],"properties":{"kind":{"$ref":"#/components/schemas/StatisticsBodyKind","description":"Discriminator. The period form has no `kind`, so its bytes stay the same."},"analytics":{"$ref":"#/components/schemas/StatisticsAnalytics"},"range":{"$ref":"#/components/schemas/ApiStatisticsWindow"},"currency":{"type":"string"},"digits":{"type":"integer","format":"int32","minimum":0},"quality":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/QualityRangeView"}]},"live":{"$ref":"#/components/schemas/ApiStatisticsLive"}}},"ApiStatisticsRead":{"type":"object","required":["statistics","live","analytics"],"properties":{"statistics":{"type":"array","items":{"$ref":"#/components/schemas/ApiStatisticsRow"}},"live":{"$ref":"#/components/schemas/ApiStatisticsLive"},"analytics":{"$ref":"#/components/schemas/StatisticsAnalytics"},"by_symbol":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ApiAllocationSlice"},"description":"All-time per-symbol results; omitted in the period form or when analytics are withheld."}}},"ApiStatisticsRow":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["tenant_id","trading_account_id","period","calculated_at_ms","metrics"],"properties":{"tenant_id":{"type":"string"},"trading_account_id":{"type":"string"},"period":{"$ref":"#/components/schemas/StatsPeriod"},"calculated_at_ms":{"type":"integer","format":"int64"},"metrics":{"$ref":"#/components/schemas/ApiStatisticsMetrics"}}},"ApiStatisticsWindow":{"type":"object","properties":{"from":{"type":["integer","null"],"format":"int64"},"to":{"type":["integer","null"],"format":"int64"}}},"ApiStatsComposition":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["allocation","longs","shorts"],"properties":{"allocation":{"type":"array","items":{"$ref":"#/components/schemas/ApiAllocationSlice"}},"longs":{"$ref":"#/components/schemas/ApiSideBreakdown"},"shorts":{"$ref":"#/components/schemas/ApiSideBreakdown"}}},"ApiStatsMoney":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","properties":{"profit":{"type":["string","null"],"description":"Null when the credential's field security masks its source figure."},"deposits":{"type":["string","null"],"description":"Null unless transactions:read is granted and transaction amounts are visible."},"return_pct":{"type":["string","null"]},"avg_daily_result":{"type":["string","null"]},"avg_monthly_result":{"type":["string","null"]}}},"ApiStatsQuality":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["trades","winning_trades","losing_trades","longest_win_streak","longest_loss_streak","profitable_weeks","weeks_with_trades"],"properties":{"trades":{"type":"integer","format":"int32","minimum":0},"winning_trades":{"type":"integer","format":"int32","minimum":0},"losing_trades":{"type":"integer","format":"int32","minimum":0},"win_rate_pct":{"type":["string","null"]},"gross_profit":{"type":["string","null"],"description":"Null when the credential's field security masks its source figure."},"gross_loss":{"type":["string","null"],"description":"Null when the credential's field security masks its source figure."},"profit_factor":{"type":["string","null"]},"expectancy":{"type":["string","null"]},"avg_win":{"type":["string","null"]},"avg_loss":{"type":["string","null"]},"best_trade":{"type":["string","null"]},"worst_trade":{"type":["string","null"]},"best_day":{"type":["string","null"]},"worst_day":{"type":["string","null"]},"longest_win_streak":{"type":"integer","format":"int32","minimum":0},"longest_loss_streak":{"type":"integer","format":"int32","minimum":0},"profitable_weeks_pct":{"type":["string","null"]},"profitable_weeks":{"type":"integer","format":"int32","minimum":0},"weeks_with_trades":{"type":"integer","format":"int32","minimum":0},"weeks_in_period":{"type":["integer","null"],"format":"int32","minimum":0},"trades_per_week":{"type":["string","null"]},"avg_hold_winners_secs":{"type":["integer","null"],"format":"int64","description":"Null when field security masks the position open or close time."},"avg_hold_losers_secs":{"type":["integer","null"],"format":"int64","description":"Null when field security masks the position open or close time."},"traded_volume_lots":{"type":["string","null"],"description":"Null when field security masks the position size."},"avg_trade_size_lots":{"type":["string","null"],"description":"Null when field security masks the position size."},"costs":{"type":["string","null"],"description":"Null when the credential's field security masks its source figure."}}},"ApiStatsRisk":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","properties":{"max_drawdown_pct":{"type":["string","null"]},"max_drawdown_money":{"type":["string","null"]},"max_drawdown_all_time_pct":{"type":["string","null"]},"recovery_factor":{"type":["string","null"]},"risk_level":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RiskLevel"}]}}},"ApiStatsScore":{"type":"object","description":"Explicit broker projection of terminal figures; IDs and decimal quantities are strings.","required":["rated"],"properties":{"value":{"type":["string","null"]},"band":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ScoreBand"}]},"rated":{"type":"boolean"}}},"ApiStatusRequest":{"type":"object","properties":{"limit":{"type":["integer","null"],"format":"int64","description":"Accounts per page. Default 100, clamped to 500."},"after":{"type":["string","null"],"description":"Opaque cursor from a previous page's `next_cursor`. Always a\n`record_id`-sorted cursor — status pages are keyed on the account id."},"account_ids":{"type":["array","null"],"items":{"type":"integer","format":"int64"},"description":"Serve exactly these accounts instead of paging the roster: at most 500\naccount ids, answered in one page (`limit` and `next_cursor` do not apply,\nand combining it with `after` is a validation error).\n\n**It can only narrow.** The list is intersected with the credential's own\nscope, so an id belonging to another firm or brand — or to nothing — is\nsimply absent from the page rather than refused."},"include_positions":{"type":"boolean","description":"Also return each trading account's open positions with their live price\nP&L and close rate (`positions`). Default `false`."}}},"ApiStatusResponse":{"type":"object","required":["accounts"],"properties":{"accounts":{"type":"array","items":{"$ref":"#/components/schemas/ApiAccountStatus"}},"next_cursor":{"type":["string","null"]}}},"ApiTimelineActor":{"type":"object","description":"Who performed a timeline entry, when the row itself names an operator.\n\nNever the client: a client-driven row carries `origin: \"client\"` and no\nactor. `impersonator_name` is the REAL operator behind an impersonated write,\nresolved to a NAME and never to a second id.","required":["kind"],"properties":{"kind":{"type":"string","description":"`system_user` / `client` / `system` — string-backed, so a value a newer\nwriter mints still crosses the wire."},"system_user_id":{"type":["string","null"],"description":"Set only for a `system_user` actor."},"name":{"type":["string","null"],"description":"Resolved display name, or absent when the record no longer resolves."},"impersonator_name":{"type":["string","null"],"description":"Present only on a row written through an impersonation session."}}},"ApiTimelineDay":{"type":"object","description":"One histogram bucket — a day (or month) and the per-side counts on it.","required":["day","client","brand"],"properties":{"day":{"type":"string","description":"`YYYY-MM-DD`, or `YYYY-MM` at month granularity, in the requested zone."},"client":{"type":"integer","format":"int64"},"brand":{"type":"integer","format":"int64"}}},"ApiTimelineDaysPage":{"type":"object","description":"The per-day counts a date scrubber is built from.","required":["account_id","tz","granularity","days","truncated"],"properties":{"account_id":{"type":"string"},"tz":{"type":"string"},"granularity":{"type":"string"},"days":{"type":"array","items":{"$ref":"#/components/schemas/ApiTimelineDay"},"description":"Newest bucket first."},"oldest_ms":{"type":["integer","null"],"format":"int64"},"newest_ms":{"type":["integer","null"],"format":"int64"},"truncated":{"type":"boolean","description":"An arm hit its per-arm ceiling, so the counts are a FLOOR, not a total —\nand `oldest_ms` is then the oldest row SERVED, not the account's oldest."}}},"ApiTimelineEntry":{"type":"object","description":"One entry of an account's two-sided timeline.\n\nWhich fields are populated follows from `source`, so every variant field is\noptional. `summary` is an **English fallback** — a client with its own\nvocabulary renders from the structured fields — and is EMPTY both for a row\nthat carries no text and for one whose text is withheld by field security:\nthe two are deliberately indistinguishable.","required":["source","kind","side","origin","record_id","timestamp_ms","summary","imported"],"properties":{"source":{"type":"string","description":"The timeline slug (`login`, `money_approved`, `owner_changed`, …)."},"kind":{"type":"string","description":"The records-store kind the row came from."},"side":{"type":"string","description":"`client` or `brand` — which side of the relationship acted."},"origin":{"type":"string","description":"`operator` | `client` | `automation` | `import` | `system`. Never a name."},"record_id":{"type":"string"},"timestamp_ms":{"type":"integer","format":"int64"},"summary":{"type":"string"},"status":{"type":["string","null"]},"actor":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiTimelineActor"}]},"event_type":{"type":["string","null"]},"direction":{"type":["string","null"]},"duration_secs":{"type":["integer","null"],"format":"int64"},"email_type":{"type":["string","null"]},"old_status":{"type":["string","null"]},"new_status":{"type":["string","null"]},"method":{"type":["string","null"]},"amount":{"type":["string","null"],"description":"`money_*` — a decimal string, never a JSON number."},"currency":{"type":["string","null"]},"transaction_type":{"type":["string","null"]},"phase":{"type":["string","null"],"description":"`requested` or `approved`."},"trading_account_id":{"type":["string","null"]},"trading_account_name":{"type":["string","null"]},"counterpart_trading_account_id":{"type":["string","null"],"description":"`money_approved` with `event_type = account_transfer`: ONE internal\ntransfer between the account's own trading accounts. The money left\n`trading_account_id` for this one."},"counterpart_trading_account_name":{"type":["string","null"]},"imported":{"type":"boolean","description":"The row came in from a legacy Leverate server."},"close_reason":{"type":["string","null"]},"profit":{"type":["string","null"],"description":"Decimal string."},"position_side":{"type":["string","null"],"description":"`Buy` / `Sell`: the position direction. The separate `side` field\nidentifies the client or brand side of the timeline."},"size":{"type":["string","null"],"description":"Decimal string."},"close_rate":{"type":["string","null"],"description":"Decimal string."},"instrument_id":{"type":["string","null"]},"instrument_name":{"type":["string","null"]},"old_owner":{"type":["string","null"],"description":"The frozen `\"user:<id>\"` / `\"bu:<id>\"` owner token."},"new_owner":{"type":["string","null"]},"old_owner_name":{"type":["string","null"]},"new_owner_name":{"type":["string","null"]},"doc_type_key":{"type":["string","null"]},"decision":{"type":["string","null"]},"subject":{"type":["string","null"]},"channel":{"type":["string","null"]},"trigger_key":{"type":["string","null"]},"workflow_name":{"type":["string","null"]}}},"ApiTimelinePage":{"type":"object","description":"One keyset page of an account's timeline, newest first.","required":["account_id","allowed_types","masked_fields","entries","has_more","generated_ms"],"properties":{"account_id":{"type":"string"},"allowed_types":{"type":"array","items":{"type":"string"},"description":"The slugs this credential is permitted to read, in canonical order. A\nslug absent here was never queried — `types=` is intersected with this\nset silently rather than refused, since a 403 on \"you asked for money\"\nis an oracle for \"this account has money rows\"."},"masked_fields":{"type":"array","items":{"type":"string"},"description":"Field-security keys that actually changed this response — a blanked\nsummary, a withheld amount, or a whole source dropped. Published so a\nclient can explain an empty column instead of implying the data is\nabsent."},"entries":{"type":"array","items":{"$ref":"#/components/schemas/ApiTimelineEntry"}},"next_cursor":{"type":["string","null"],"description":"Pass back as `cursor` for the next (older) page. Absent ⇒ no more."},"has_more":{"type":"boolean"},"generated_ms":{"type":"integer","format":"int64","description":"When the server composed this page, epoch ms."}}},"ApiTradeRequest":{"type":"object","description":"The outcome of a trade command as the broker sees it.","required":["id","account_id","trading_account_id","instrument_id","action","side","size","desired_price","state","received_at"],"properties":{"min_open_seconds":{"type":["integer","null"],"format":"int32","minimum":0},"remaining_seconds":{"type":["integer","null"],"format":"int32","minimum":0},"ignored_hold_time":{"type":["boolean","null"]},"id":{"type":"string","description":"The `TradeRequest` record id — the handle for a retry and for reconciling\nthe async confirmation."},"account_id":{"type":"string"},"trading_account_id":{"type":"string"},"instrument_id":{"type":"string"},"action":{"$ref":"#/components/schemas/TradeAction"},"side":{"$ref":"#/components/schemas/PositionSide"},"size":{"type":"string"},"desired_price":{"type":"string"},"state":{"$ref":"#/components/schemas/TradeRequestState"},"rejection_reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TradeRejectionReason","description":"The machine-readable rejection taxonomy. Published — unlike an operator's\nfree-text reasoning, this is the broker's OWN order being refused, and a\nclient that cannot branch on why cannot correct the next attempt."}]},"confirmed_price":{"type":["string","null"]},"position_id":{"type":["string","null"],"description":"The position this request acted on. **Close:** the position closed.\n**Open:** the position the order opened, present on the `POST\n/positions/open` answer when the fill is known synchronously (a filled\ninternal order, or an externally executed one whose mirror was proven);\n`null` for a rejection; for a `Placed` (202) delayed or external order\nstill being decided; and when the answer is rebuilt from the stored\norder rather than the fill — a `202` order re-read after it settled, or\na retry after a server crash between the fill and its idempotency seal.\nIn those cases learn the outcome from the `order` and `position`\nevents, or find the position through `POST /api/v1/position/query`."},"external_id":{"type":["string","null"]},"received_at":{"type":"integer","format":"int64","description":"Unix epoch milliseconds."}}},"ApiTradingAccount":{"type":"object","description":"Public provisioning result. Authentication material is never projected.","required":["trading_account_id","login","account_id","currency","is_demo","status"],"properties":{"trading_account_id":{"type":"string"},"login":{"type":"string"},"account_id":{"type":"string"},"currency":{"type":"string"},"is_demo":{"type":"boolean"},"status":{"type":"string"}}},"ApiTradingInstrumentRef":{"type":"object","description":"System catalog instrument reference. Identifiers are decimal strings.","required":["tenant","record_id"],"properties":{"tenant":{"type":"string"},"record_id":{"type":"string"}}},"ApiTradingTermDetail":{"type":"object","description":"One tier in full: its own settings plus every instrument it configures.","required":["trading_terms_id","revision","terms","instruments"],"properties":{"trading_terms_id":{"type":"integer","format":"int64"},"revision":{"type":"integer","format":"int64","description":"The same composite revision the list reports for this tier."},"terms":{"$ref":"#/components/schemas/TradingTerms","description":"The stored tier payload — leverage, margin-call / stop-out levels,\nislamic flag, execution delay, and so on."},"instruments":{"type":"array","items":{"$ref":"#/components/schemas/ApiTradingTermInstrument"},"description":"One entry per instrument configured for this tier. Omitted fields inherit\nfrom the next cascade level."}}},"ApiTradingTermInstrument":{"type":"object","description":"A tier's configuration for one instrument: what is stored, and what it\nresolves to.","required":["instrument_id","symbol","policy","effective"],"properties":{"instrument_id":{"type":"integer","format":"int64"},"symbol":{"type":"string","description":"Canonical symbol, for matching."},"name":{"type":["string","null"],"description":"Operator display label; if absent, display `symbol`."},"policy":{"$ref":"#/components/schemas/InstrumentPolicy","description":"The stored policy, verbatim. Sparse — a `null` field means \"inherit\",\nnot \"zero\"; read `effective` for the resolved value."},"effective":{"$ref":"#/components/schemas/ApiEffectiveInstrument","description":"The policy resolved down the `InstrumentPolicy → FirmInstrumentOverride\n→ Instrument` cascade. This is what the platform will actually apply."}}},"ApiTradingTermSummary":{"type":"object","description":"A tier as it appears in the list — just enough to decide whether to fetch it.","required":["trading_terms_id","name","revision"],"properties":{"trading_terms_id":{"type":"integer","format":"int64"},"name":{"type":"string"},"revision":{"type":"integer","format":"int64","description":"Changes whenever the tier **or any of its instrument policies** changes.\nMonotonic, from the platform-global revision sequence. Use it as a cache\nkey: re-fetch the detail only when this moves."}}},"ApiTradingTermsWriteResponse":{"type":"object","description":"The tier as persisted by a create/update: its id plus the stored payload,\nechoed back with `firm_id` set to the credential's own firm.","required":["trading_terms_id","terms"],"properties":{"trading_terms_id":{"type":"integer","format":"int64"},"terms":{"$ref":"#/components/schemas/TradingTerms"}}},"ApiTransaction":{"type":"object","description":"A monetary transaction as the broker surface publishes it.","required":["id","account_id","trading_account_id","currency","amount","method","transaction_type","status","is_ftd","created_at"],"properties":{"id":{"type":"string"},"account_id":{"type":"string"},"trading_account_id":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"string"},"method":{"$ref":"#/components/schemas/TxMethod"},"transaction_type":{"$ref":"#/components/schemas/CrmTransactionType","description":"The ledger classification, separate from `method`, which describes\nhow the money moved."},"status":{"$ref":"#/components/schemas/ApiTransactionStatus"},"is_ftd":{"type":"boolean"},"created_at":{"type":"integer","format":"int64","description":"Unix epoch milliseconds."},"prop_purchase_id":{"type":["string","null"],"description":"The prop purchase this deposit was CREATED to pay (a decimal string id)\n— the purchase marker on the row, whichever surface created it: a\nBroker Platform API create naming `prop_purchase_id`, and equally a\nWebTrader or payment-provider checkout deposit, which stamps the same marker.\nEchoed so the caller can see which purchase a (replayed) answer is\nabout; it is visible to any credential that may read the transaction\n(`transactions:read`), with or without `prop-challenges:read` — the id\nalone discloses nothing the purchase routes would not. It is the\ncreation link, not a payment status: a deposit cancelled or rejected\nbefore it settled still echoes the purchase although it no longer pays\nit (read the purchase for its state). Absent on every transaction that\nwas created to pay no purchase, so an ordinary transaction's body is\nunchanged."}}},"ApiTransactionReasonRequest":{"type":"object","description":"Body for `POST /api/v1/transactions/{id}/{reject,cancel}` — a non-empty\nreason is REQUIRED, mirroring the operator rule. The reason is stored on\nthe record but never published back on this surface (§4.3): it is operator\nreasoning, and a broker reading its own submitted text back adds nothing.","required":["reason"],"properties":{"reason":{"type":"string"}}},"ApiTransactionStatus":{"type":"string","description":"Lifecycle of a transaction as the broker sees it. A single enum rather than\nfour booleans: the domain's `approved`/`processed`/`rejected`/`cancelled`\nflags have one shared interpretation. Processing without approval is `failed`,\nwhile approved processing is `settled`; cancelled and rejected take precedence.","enum":["pending","approved","settled","rejected","cancelled","indeterminate","failed"]},"ApiUpdateTradingTermsRequest":{"type":"object","description":"Update an existing trading-terms tier in the credential's own firm workspace.\nThe tier id comes from the path; `firm_id` in `terms` is ignored exactly as on\ncreate.","required":["terms"],"properties":{"terms":{"$ref":"#/components/schemas/TradingTerms"}}},"ApiUser":{"type":"object","required":["user_id","firm_id","name","email","enabled","permission_group_ids","revision"],"properties":{"user_id":{"type":"string"},"firm_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","description":"Display login identity. It cannot be changed through this API."},"enabled":{"type":"boolean"},"permission_group_ids":{"type":"array","items":{"$ref":"#/components/schemas/ApiUserRef"}},"home_business_unit_id":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ApiUserRef"}]},"revision":{"type":"string"}}},"ApiUserAuthMethod":{"oneOf":[{"type":"object","required":["username","password","method"],"properties":{"username":{"type":"string"},"password":{"type":"string"},"method":{"type":"string","enum":["password"]}}},{"type":"object","required":["email","method"],"properties":{"email":{"type":"string"},"method":{"type":"string","enum":["google"]}}},{"type":"object","required":["email","method"],"properties":{"email":{"type":"string"},"method":{"type":"string","enum":["microsoft"]}}}],"description":"How the new staff user's login identity is provisioned.\n\n* `password`: send a bare username (no `@` or whitespace). The server appends\n  `@<firm_id>`, so another firm can reuse the username. If the resulting\n  identity already exists, creation returns 409.\n* `google` / `microsoft`: social login using the user's real email. The\n  login identity is provisioned on first sign-in."},"ApiUserRef":{"type":"object","description":"User reference containing the workspace tenant and record ID as strings.","required":["tenant","record_id"],"properties":{"tenant":{"type":"string"},"record_id":{"type":"string"}},"additionalProperties":false},"ApiUsersPage":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiUser"}},"next_cursor":{"type":["string","null"]}}},"ApiWebhookSubscription":{"type":"object","description":"A webhook subscription as the broker sees it. Deliberately carries **no**\nsecret field of any kind.","required":["id","url","event_categories","disabled","last_delivered_seq","created_at"],"properties":{"id":{"type":"integer","format":"int64","description":"The subscription id."},"url":{"type":"string","description":"The delivery URL (always `https://`)."},"brand_id":{"type":["integer","null"],"format":"int64","description":"Optional brand clamp; `null` ⇒ firm-wide."},"event_categories":{"type":"array","items":{"type":"string"},"description":"The event categories delivered to this endpoint."},"disabled":{"type":"boolean","description":"`true` once disabled (by an operator, or automatically when the target\nstopped passing the egress guard)."},"disabled_reason":{"type":["string","null"],"description":"Why it was disabled; `null` while live."},"last_delivered_seq":{"type":"integer","format":"int64","description":"The stream sequence of the last successfully delivered event — the same\n`seq` the WebSocket durable class reports.","minimum":0},"created_at":{"type":"integer","format":"int64","description":"Creation time, Unix epoch milliseconds."}}},"CatalogResponse":{"type":"object","required":["instances","now_ms","orphaned_status"],"properties":{"instances":{"type":"array","items":{"$ref":"#/components/schemas/InstanceCatalogEntry"}},"now_ms":{"type":"integer","format":"int64"},"orphaned_status":{"type":"array","items":{"$ref":"#/components/schemas/InstanceKey"},"description":"Keys that still have a status row but no entry in `instances` (their source is gone),\nsorted and unique; always present, possibly empty. Attestation only, never removal\nauthority: a controller that holds no object for such a key may report it removed\n(`POST /api/v1/instances/{key}/controller` with `observed_removed`), and the server\nre-checks the source before it settles the row (409 when the key is present again)."}}},"CertificateRequest":{"type":"object","required":["thumbprint_sha1"],"properties":{"thumbprint_sha1":{"type":"string","description":"The thumbprint from the listing. The request names NO key: the server always encrypts\nto the key the two-person approval registered."}},"additionalProperties":false},"ClientPlatform":{"type":"string","enum":["Web","Mobile","Mt4","Manager","Partner","Api","Ai","SystemTrigger"]},"CloseReason":{"type":"string","description":"Why a position closed, recorded in `close_reason`. This is independent of\nhow the position was opened.\n\n`Manual` covers trader and operator closes. `TakeProfit` and `StopLoss`\nidentify price-triggered closes; `StopOut` identifies margin liquidation.\n`Partner` identifies a partner-routed close. The `Mam*` reasons identify\nmanaged-account closes, including the end of a managed-account relationship.\n`PropChallenge` identifies an automated challenge close, such as verdict\nfinalization, a daily-profit freeze, a weekend close or a detection-rate close.\nThe challenge events and audit comment provide the detailed trigger.\nOlder closed positions may have no close reason.","enum":["Manual","TakeProfit","StopLoss","TrailingStop","StopOut","Partner","MamInvestorDisconnected","MamManagerDetached","MamLossLimit","MamBrokerRemoved","MamInviteCancelled","MamMasterClose","MamBrokerForceClose","PropChallenge","OppositeOrder","TraderProfitTrigger","TraderLossLimit","PammForcedReduction","PammFlatten"]},"ColumnTerm":{"type":"object","description":"One selected output column. `path` is a relation path from the base entity,\nso a column can name a field on a joined row (`path: [\"account\"], field: \"name\"`).\nSupply relation names as separate path elements. The server derives the\noutput column ID from the resolved relation and field names.","required":["field"],"properties":{"path":{"type":"array","items":{"type":"string"}},"field":{"type":"string"},"custom":{"type":"boolean","description":"Project a custom field — same namespace rule as on a condition.\n\nLoad-bearing rather than cosmetic: a custom field's name may COLLIDE with\na builtin's, so without this flag the meaning of a stored selection would\ndepend on what an operator happened to add afterwards."}}},"Combinator":{"type":"string","enum":["and","or"]},"CommissionPolicy":{"type":"object","description":"A resolved commission rule. `commission_size` is the pip count for `Pips`,\nthe percentage for `Percentage`, the quote-currency amount per share for\n`PerShare`, or the account-currency amount per lot for `Money`. The computed\ncharge is negative (a cost).\nThe trading-term policy takes precedence over the firm override.","properties":{"commission_type":{"$ref":"#/components/schemas/CommissionType"},"commission_size":{"type":"number","format":"double","description":"Commission size in pips, percent or money per lot, according to `commission_type`.\nDefaults to zero when absent. An `Unsupported` commission type incurs\nno commission until the policy is reconfigured."},"minimum_per_trade":{"type":["number","null"],"format":"double","description":"Equities account-currency minimum, applied after FX to the variable fee.\nAccepted for cash equities with PerShare or Percentage rules; legacy\n`min_commission` is deliberately unrelated to this new field."}}},"CommissionType":{"type":"string","description":"Commission model, ported 1:1 from the legacy Leverate server\n(`Executor.Domain\\CommissionCalc`), with an additive Equities model.\nPer-share writes are accepted for cash equities; charging requires a native Equity tier.","enum":["Pips","Percentage","PerShare","Money","Unsupported"]},"ControllerPhase":{"type":"string","enum":["provisioning","ready","stopped","removing","error"]},"ControllerReport":{"type":"object","required":["controller_phase"],"properties":{"controller_phase":{"$ref":"#/components/schemas/ControllerPhase"},"pod_name":{"type":["string","null"],"description":"ASCII pod name.","maxLength":253},"restart_count":{"type":["integer","null"],"format":"int32","minimum":0},"desired_image":{"type":["string","null"]},"observed_removed":{"type":"boolean"}},"additionalProperties":false},"CreateWebhookRequest":{"type":"object","description":"Create-subscription request.","required":["url","event_categories"],"properties":{"url":{"type":"string","description":"The delivery URL. Must be `https://` and must resolve exclusively to\npublic addresses — a private, loopback, link-local or cloud-metadata\ntarget is refused at create time and re-checked at every send."},"event_categories":{"type":"array","items":{"type":"string"},"description":"The event categories to deliver: any of `account`, `order`, `position`,\n`transaction`, `workflow`. At least one is required."}}},"CredentialPair":{"type":"object","required":["client_id","client_secret"],"properties":{"client_id":{"type":"string"},"client_secret":{"type":"string"}}},"CrmTransactionType":{"type":"string","description":"The transaction classification: `Deposit`, `Withdrawal`, `Credit`, `Debit`\nor `Chargeback`. This describes the ledger entry's purpose; the separate\npayment method describes how the money moved. Unknown classifications\nare rejected.","enum":["Deposit","Withdrawal","Credit","Debit","Chargeback"]},"EmptyRequest":{"type":"object","additionalProperties":false},"ExecutionMode":{"type":"string","description":"Execution mode for an instrument under a given override / policy.","enum":["Market","Instant","Request"]},"ForeignRef":{"type":"object","description":"Reference to a record in a different tenant (current state).\n\nWire shape: `{ \"tenant\": <i64>, \"record_id\": <i64> }`.","required":["tenant","record_id"],"properties":{"tenant":{"type":"integer","format":"int64"},"record_id":{"type":"integer","format":"int64"}}},"InstanceBeatSession":{"type":"object","description":"What an authenticated beat is checked against. `counter` is the\nlast accepted beat counter; a beat must carry a strictly greater one.","required":["rid","generation"],"properties":{"rid":{"type":"integer","format":"int64"},"generation":{"type":"integer","format":"int64"},"counter":{"type":"integer","format":"int64","minimum":0}}},"InstanceCatalogEntry":{"type":"object","required":["instance_key","family","source","enabled","desired","desired_replicas","config_revision","namespace","execution_class","supports_liveness","cpu_limit_allowed","probe_defaults"],"properties":{"instance_key":{"$ref":"#/components/schemas/InstanceKey"},"family":{"$ref":"#/components/schemas/InstanceFamily"},"source":{"$ref":"#/components/schemas/InstanceSource"},"enabled":{"type":"boolean"},"desired":{"$ref":"#/components/schemas/InstanceDesired"},"desired_replicas":{"type":"integer","format":"int32","maximum":1,"minimum":0},"reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceReason"}]},"reconcile_blocked":{"type":"boolean"},"credential_current":{"type":["boolean","null"]},"config_revision":{"type":"integer","format":"int64","minimum":1},"namespace":{"type":"string"},"execution_class":{"type":"boolean"},"supports_liveness":{"type":"boolean"},"cpu_limit_allowed":{"type":"boolean"},"probe_defaults":{"$ref":"#/components/schemas/InstanceProbes"},"effective_override":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceOverride"}]}}},"InstanceDesired":{"type":"string","enum":["running","stopped"]},"InstanceFamily":{"type":"string","enum":["risk","mt5","mt4","replicator"]},"InstanceKey":{"type":"string","description":"Canonical instance identity with family, role and positive numeric source IDs."},"InstanceOverride":{"type":"object","description":"Operator overrides for a managed instance.","required":["instance_key"],"properties":{"instance_key":{"$ref":"#/components/schemas/InstanceKey"},"paused":{"type":"boolean"},"paused_reason":{"type":["string","null"]},"image_ref":{"type":["string","null"]},"restart_requested_ms":{"type":["integer","null"],"format":"int64"},"resources":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceResources"}]},"probes":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceProbes"}]},"updated_ms":{"type":"integer","format":"int64"},"_extra":{"type":"object"}}},"InstanceProbe":{"type":"object","description":"Probe command, port and timeout are template-owned, never operator input.","required":["enabled","period_s","failure_threshold","initial_delay_s"],"properties":{"enabled":{"type":"boolean"},"period_s":{"type":"integer","format":"int32","minimum":0},"failure_threshold":{"type":"integer","format":"int32","minimum":0},"initial_delay_s":{"type":"integer","format":"int32","minimum":0}}},"InstanceProbes":{"type":"object","properties":{"liveness":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceProbe"}]},"readiness":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceProbe"}]}}},"InstanceReason":{"type":"string","enum":["disabled","paused","removing","probe_failed","image_unavailable","credential_revoked","config_error","connection_failed","rebuild_required"]},"InstanceRelease":{"type":"object","description":"Default release image and recent release history for a family.","required":["family","image_ref","set_by","set_at_ms"],"properties":{"family":{"$ref":"#/components/schemas/InstanceFamily"},"image_ref":{"type":"string"},"set_by":{"type":"string"},"set_at_ms":{"type":"integer","format":"int64"},"previous":{"type":"array","items":{"$ref":"#/components/schemas/InstanceReleaseVersion"}},"_extra":{"type":"object"}}},"InstanceReleaseVersion":{"type":"object","required":["image_ref","set_by","set_at_ms"],"properties":{"image_ref":{"type":"string"},"set_by":{"type":"string"},"set_at_ms":{"type":"integer","format":"int64"}}},"InstanceResources":{"type":"object","description":"Values override template defaults; omission never removes a request/limit.","properties":{"cpu_request":{"type":["string","null"]},"cpu_limit":{"type":["string","null"]},"mem_request":{"type":["string","null"]},"mem_limit":{"type":["string","null"]}}},"InstanceSelfCertificate":{"type":"object","description":"Which certificate is current; never the material.","required":["subject_cn","thumbprint_sha1","not_after_ms"],"properties":{"subject_cn":{"type":"string"},"thumbprint_sha1":{"type":"string"},"not_after_ms":{"type":"integer","format":"int64"}}},"InstanceSelfFirm":{"type":"object","required":["firm_id","enabled"],"properties":{"firm_id":{"type":"integer","format":"int64"},"enabled":{"type":"boolean"},"certificate":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceSelfCertificate","description":"Absent for a disabled firm (its metadata is not even sent) and for a firm with no\nuploaded certificate."}]}}},"InstanceSelfResponse":{"type":"object","required":["instance_key","served_at_ms","settings_revision","settings","firms"],"properties":{"instance_key":{"type":"string"},"served_at_ms":{"type":"integer","format":"int64"},"settings_revision":{"type":"string","description":"SHA-256 over the canonical JSON of `settings` (tag `instance-self-settings-v1`). A change\nreconnects every enabled firm; an unchanged value reconnects nobody."},"settings":{"$ref":"#/components/schemas/InstanceSelfSettings"},"firms":{"type":"array","items":{"$ref":"#/components/schemas/InstanceSelfFirm"}}}},"InstanceSelfSettings":{"type":"object","description":"The settings the bridge applies live (p2 §4.1): P3's A fields plus the four existing EE fields.\nMissing A fields on a legacy row are absent here; the bridge then refuses them, never guesses.","required":["client_application_name","open_timeout_ms","operation_timeout_ms","keep_alive_interval_ms"],"properties":{"endpoints":{"type":"array","items":{"$ref":"#/components/schemas/RiskEndpoint"}},"service_name":{"type":["string","null"]},"server_identity":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ServerIdentity","description":"A DNS name, or the server's PUBLIC pinned certificate."}]},"client_application_name":{"type":"string"},"open_timeout_ms":{"type":"integer","format":"int32","minimum":0},"operation_timeout_ms":{"type":"integer","format":"int32","minimum":0},"keep_alive_interval_ms":{"type":"integer","format":"int32","minimum":0}}},"InstanceSource":{"type":"object","required":["kind","tenant","record_id"],"properties":{"kind":{"type":"string"},"tenant":{"type":"integer","format":"int64"},"record_id":{"type":"integer","format":"int64"},"trading_system_id":{"type":["integer","null"],"format":"int64"},"workspace_id":{"type":["integer","null"],"format":"int64"},"shard_id":{"type":["integer","null"],"format":"int64"}}},"InstanceState":{"type":"string","enum":["starting","ready","degraded","stopped"]},"InstanceStatus":{"type":"object","description":"Observed process and controller state, merged by field ownership.","required":["instance_key","family","state"],"properties":{"instance_key":{"$ref":"#/components/schemas/InstanceKey"},"family":{"$ref":"#/components/schemas/InstanceFamily"},"state":{"$ref":"#/components/schemas/InstanceState"},"reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceReason"}]},"since_ms":{"type":"integer","format":"int64"},"last_seen_ms":{"type":"integer","format":"int64"},"last_transition_ms":{"type":"integer","format":"int64"},"session_id":{"type":["string","null"]},"running_image":{"type":["string","null"]},"git_sha":{"type":["string","null"]},"config_revision_applied":{"type":["integer","null"],"format":"int64"},"started_ms":{"type":["integer","null"],"format":"int64"},"pod_name":{"type":["string","null"]},"restart_count":{"type":"integer","format":"int32","minimum":0},"controller_phase":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ControllerPhase"}]},"desired_image":{"type":["string","null"]},"detail":{},"beat":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceBeatSession","description":"The credential that registered `session_id` and the highest beat\ncounter accepted for it. Never the beat key itself: that is derived from the\nbroker signing secret on demand and only ever returned to the instance.\nCleared whenever the session changes or the credential rotates; a row\nwithout it accepts no NATS beat."}]}}},"InstrumentPolicies":{"type":"object","description":"Optional policy overrides. An omitted or null policy inherits the entire\npolicy from the next cascade level.\n\nQuote markup is configured separately through the top-level `shift_bid_pips`,\n`shift_ask_pips`, `spread_mode` and `spread_value` fields on the instrument\npolicy and firm instrument override.","properties":{"amount":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AmountPolicy"}]},"swap":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SwapPolicy"}]},"commission":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CommissionPolicy"}]}}},"InstrumentPolicy":{"type":"object","required":["trading_terms_id","instrument","shift_bid_pips","shift_ask_pips","spread_value","hedging_percentage","policies","is_removed"],"properties":{"trading_terms_id":{"type":"integer","format":"int64","description":"Same-tenant ref to the parent TradingTerms."},"instrument":{"$ref":"#/components/schemas/ForeignRef","description":"Cross-tenant ref to the global Instrument."},"contract_size":{"type":["integer","null"],"format":"int64","description":"Integer notional multiplier: the number of underlying units represented\nby one lot. An omitted value inherits from the next cascade level."},"tradability":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Tradability"}]},"execution_mode":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ExecutionMode"}]},"shift_bid_pips":{"type":"number","format":"double","description":"Quote markup, applied at equity-calc time before PnL. Sparse — set\nonly the fields that diverge from the inherited Instrument. None on\nevery markup field means \"this policy carries no markup\" and the\nresolution cascade falls through to `FirmInstrumentOverride`. See\nthe quote-markup pricing rules for semantics."},"shift_ask_pips":{"type":"number","format":"double"},"spread_mode":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SpreadMode"}]},"spread_value":{"type":"number","format":"double"},"hedging_percentage":{"type":"number","format":"double","description":"Per-instrument hedge percentage (`0..=100`) at the trading-term policy\nlayer. An absent value inherits from the firm override, then workspace\nsettings. `0` means full margin; `100` means fully hedged with no margin.\nApplies only when the workspace hedging mode is Percentage."},"policies":{"$ref":"#/components/schemas/InstrumentPolicies"},"leverage_rule":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/LeverageRule","description":"Inline leverage rule at the trading-term policy layer, which takes\nprecedence over the firm override and instrument settings. Within this\nlayer, an inline rule takes precedence over `leverage_group`. If absent,\nthe group is tried first, followed by the lower cascade levels."}]},"leverage_group":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef","description":"Reference to a `LeverageGroup` at the\npolicy layer. A `ForeignRef` because it may point at a system root group\nor a firm-own group; the cascade deref prefers a firm-tenant record with\nthe same record_id (workspace override). Loses to `leverage_rule`."}]},"buy_only":{"type":["boolean","null"],"description":"Buy-only on netting accounts: a Sell is accepted only as far as the account's net long\nposition covers it. `null`/absent inherits the firm's instrument override; off when no\nlayer sets it. No effect on hedging accounts."},"max_exposure_lots":{"type":["number","null"],"format":"double","description":"Trading-group override of the client max-exposure cap on this instrument, in lots. Absent\ninherits the instrument cap; `0` removes the cap for this tier; a positive value replaces it.\nManaged from the backoffice only."},"is_removed":{"type":"boolean"},"_extra":{"type":"object"}}},"InstrumentType":{"type":"string","description":"Asset class of an instrument, serialized as the variant name (`\"Forex\"`,\n`\"CFD\"`, `\"Crypto\"`, `\"Stock\"`, `\"Index\"`, `\"Commodity\"`).\n\nOnly `Forex` instruments describe a true currency pair (base + quote). Every\nother type denominates profit and loss in its quote currency.","enum":["Forex","CFD","Crypto","Stock","Index","Commodity"]},"LeverageRule":{"oneOf":[{"type":"object","description":"`final_leverage = round(account_leverage × multiplier)`, floored at 1.","required":["value","kind"],"properties":{"value":{"type":"object","description":"`final_leverage = round(account_leverage × multiplier)`, floored at 1.","required":["multiplier"],"properties":{"multiplier":{"type":"number","format":"double"}}},"kind":{"type":"string","enum":["relative_multiplier"]}}},{"type":"object","description":"Fixed leverage, independent of the account.","required":["value","kind"],"properties":{"value":{"type":"object","description":"Fixed leverage, independent of the account.","required":["leverage"],"properties":{"leverage":{"type":"integer","format":"int32","minimum":0}}},"kind":{"type":"string","enum":["fixed_leverage"]}}},{"type":"object","description":"Flat margin per 1 lot, in the instrument's base currency.","required":["value","kind"],"properties":{"value":{"type":"object","description":"Flat margin per 1 lot, in the instrument's base currency.","required":["margin_per_lot"],"properties":{"margin_per_lot":{"type":"number","format":"double"}}},"kind":{"type":"string","enum":["margin_per_lot"]}}}],"description":"One of the three leverage behaviors, used by inline leverage rules and\nleverage groups. The JSON shape is `{ \"kind\": \"fixed_leverage\", \"value\": {\n\"leverage\": 200 } }`. Decimal fields are JSON numbers."},"NettingCancelPendingSetting":{"type":"string","description":"The cancel-pending rule as a tier states it.","enum":["Inherit","Off","On"]},"NettingCommissionSetting":{"type":"string","description":"The netting commission option as a tier states it.","enum":["Inherit","OpeningVolumeOnly","EveryOrder"]},"Operator":{"type":"string","description":"How a condition compares. For `eq` and `neq`, the number of supplied values\ndetermines the comparison:\n\n| Values | `eq` | `neq` |\n|--------|------|-------|\n| 0 | is empty | is set |\n| 1 | equals the value | differs from the value |\n| 2+ | is in the set | is not in the set |\n\n`is_set` and `is_not_set` are aliases for zero-value `neq` and `eq`.\nThey accept no values.\n\n`older_than` and `within_last` accept one duration token, such as `\"90m\"`,\n`\"12h\"` or `\"3d\"`, and compare against the current time minus that duration.\nThey apply only to timestamp fields, not ISO-8601 date strings. A null or\nabsent timestamp matches neither relative operator; use `is_not_set`\nto find missing values.","enum":["eq","neq","contains","not_contains","starts_with","ends_with","gt","gte","lt","lte","older_than","within_last","is_set","is_not_set"]},"PendingOrderType":{"type":"string","description":"Pending-order trigger types. Direction rules (matched against the\nincoming tick's bid/ask in the pnl tick subscriber):\n\n| Type             | Fires when                | New position side |\n|------------------|---------------------------|-------------------|\n| `BuyLimit`       | `ask <= trigger_price`    | Buy               |\n| `SellLimit`      | `bid >= trigger_price`    | Sell              |\n| `BuyStop`        | `ask >= trigger_price`    | Buy               |\n| `SellStop`       | `bid <= trigger_price`    | Sell              |\n| `BuyStopLimit`   | two-stage, see below      | Buy               |\n| `SellStopLimit`  | two-stage, see below      | Sell              |\n\n## The two-stage types\n\nA stop-limit order splits \"the market reached my level\" from \"the price is\ngood enough to trade at\". It carries **two** prices:\n\n* `stop_limit_price` — the **activation** level. Crossing it\n  arms the order (`stop_triggered = true`); it never executes anything by\n  itself. Same direction rule as the plain stop types:\n  `BuyStopLimit` arms on `ask >= stop_limit_price`, `SellStopLimit` on\n  `bid <= stop_limit_price`.\n* `trigger_price` — the **limit bound**, i.e. the worst price\n  the order will fill at. Once armed, the order executes only while\n  `ask <= trigger_price` (Buy) / `bid >= trigger_price` (Sell) — the same\n  direction rule as the plain limit types.\n\nBoth conditions are evaluated on the same tick, so the ordinary case (market\nreaches the stop and the price is still acceptable) fills immediately with no\nintermediate commit. When the market gaps straight through the limit, the\norder stays armed and waits for the price to come back — arming is a\none-way door, deliberately.","enum":["BuyLimit","SellLimit","BuyStop","SellStop","BuyStopLimit","SellStopLimit"]},"PositionModeSetting":{"type":"string","description":"The position mode a tier or a trading account states.","enum":["Inherit","Hedging","Netting"]},"PositionSide":{"type":"string","enum":["Buy","Sell"]},"QualityRangeView":{"type":"object","description":"The trade-quality figures of one trading account over positions CLOSED in `[from_ms, to_ms)`, computed\non read using the same calculations as stored periods. Money is a\ndecimal STRING at the account currency's catalog `digits`; ratios are JSON numbers.","required":["trades","winning_trades","losing_trades","gross_profit","gross_loss"],"properties":{"trades":{"type":"integer","format":"int32","description":"Positions closed in the range (a partial close counts).","minimum":0},"winning_trades":{"type":"integer","format":"int32","description":"Net result above zero.","minimum":0},"losing_trades":{"type":"integer","format":"int32","description":"Net result below zero. A break-even (net exactly 0) trade is neither a win nor a loss, but counts in `trades`\nand so in the win-rate denominator.","minimum":0},"win_rate_pct":{"type":["number","null"],"format":"double","description":"`winning_trades ÷ trades × 100`, percent points; `null` with no trade."},"profit_factor":{"type":["number","null"],"format":"double","description":"Gross profit ÷ gross loss; `null` while there is no losing trade."},"gross_profit":{"type":"string","description":"Sum of positive net results. **Money — a decimal STRING.**","example":"201.00"},"gross_loss":{"type":"string","description":"Absolute sum of negative net results (reported positive). **Money — a decimal STRING.**","example":"2648.58"},"avg_win":{"type":["string","null"],"description":"Mean net result of the winning trades; `null` without one. **Money — a decimal STRING.**","example":"40.20"},"avg_loss":{"type":["string","null"],"description":"Mean loss of the losing trades, reported positive; `null` without one. **Money — a decimal STRING.**","example":"264.86"},"best_trade":{"type":["string","null"],"description":"The largest single net result (negative when every trade lost); `null` with no trade. **Money — a decimal\nSTRING.**","example":"60.00"},"worst_trade":{"type":["string","null"],"description":"The smallest single net result (positive when every trade won); `null` with no trade. **Money — a decimal\nSTRING.**","example":"-678.00"}}},"QuantityUnit":{"type":"string","description":"Unit in which an instrument's sizes are expressed (minimum, maximum and step\nsize, and every trade size): `\"Lot\"`, `\"Share\"` or `\"Contract\"`. When absent,\nsizes are in lots.\n\nA `\"Stock\"` instrument quoted in `\"Share\"` is a cash equity, traded in whole\nshares without leverage; a `\"Stock\"` without a unit is a share CFD traded in\nlots.","enum":["Lot","Share","Contract"]},"QueryNode":{"oneOf":[{"type":"object","required":["field","op","kind"],"properties":{"field":{"type":"string"},"op":{"$ref":"#/components/schemas/Operator"},"values":{"type":"array","items":{"type":"string"}},"path":{"type":"array","items":{"type":"string"},"description":"Relation hops from the enclosing entity to the one that owns `field`.\n\nEmpty is the ordinary case — the field belongs to the entity in\nscope. A non-empty path lets a row reach a related entity's field\nwithout the operator having to build a block for it, which is how\nthe picker offers `Main trading account › Leverage` inline.\n\nIt compiles to a correlated `EXISTS` per hop with the comparison at\nthe centre, NOT to a join. Same matching semantics — every registry\nrelation is 1:1 — but it stays a predicate, so it is legal inside an\nOR and adds nothing to the FROM clause.\n\nNote what that means for the negative operators: the comparison sits\nINSIDE the subquery, so `trading_account.name <> 'Live'` reads as\n\"has a trading account, whose name is not Live\" — a row with no\ntrading account does not match. That is the same answer a block\nwould give, which is the point."},"custom":{"type":"boolean","description":"Read `field` from the workspace's **custom** fields\n(`payload->'customFields'`) rather than the registry.\n\nAn explicit flag rather than a name-collision fallback: an operator\nmay name a custom field `status`, and letting the lookup guess would\nsilently change what an already-stored filter means the day they do."},"kind":{"type":"string","enum":["condition"]}}},{"type":"object","required":["combinator","kind"],"properties":{"combinator":{"$ref":"#/components/schemas/Combinator"},"children":{"type":"array","items":{"$ref":"#/components/schemas/QueryNode"}},"kind":{"type":"string","enum":["group"]}}},{"type":"object","description":"A related entity: its fields become filterable inside the block.\n\n**It does NOT assert the row exists.** Every relation join is a LEFT\nJOIN, so a block with conditions narrows through those\nconditions in the WHERE clause, and a block with none is a no-op. Use\nan `exists` node to test presence.","required":["relation","combinator","kind"],"properties":{"relation":{"type":"string"},"combinator":{"$ref":"#/components/schemas/Combinator"},"children":{"type":"array","items":{"$ref":"#/components/schemas/QueryNode"}},"kind":{"type":"string","enum":["join"]}}},{"type":"object","description":"A **presence test** on a related entity: \"has data\" / \"has no data\".\n\nThe counterpart to a relation join, and the reason a block needs no\nmode. A block LEFT-joins the related row so its columns are reachable,\nand filters only through the conditions written inside it. This is a\ncorrelated `EXISTS` / `NOT EXISTS` subquery instead: it asks only\nwhether the row is there, and reads nothing out of it. Since the join\nstopped filtering, this is the ONLY way to say \"the row must exist\".\n\nTwo things follow, and they are the whole reason it exists:\n\n  * `NOT EXISTS` is the only way to say **\"has no such row\"**. A join\n    cannot express it by construction, so before this there was no way\n    to ask the question at all.\n  * It is legal **inside an OR**, where a block is refused. A subquery\n    is an ordinary predicate, so it narrows only its own side of the OR\n    instead of silently filtering the other.","required":["relation","kind"],"properties":{"relation":{"type":"string"},"negated":{"type":"boolean","description":"`true` -> `NOT EXISTS`: match rows that have no such related row."},"kind":{"type":"string","enum":["exists"]}}}],"description":"One node of the query tree.\n\nUnknown fields are **accepted and ignored** on purpose: the browser's editing\nmodel carries `id`, `origin` and a denormalized `entity` that are its own\nbookkeeping. Rejecting them would couple the wire to the editor's internals;\nsilently re-deriving what matters (the join target) is both looser and safer.\n\n`#[schema(no_recursion)]` on the child lists is required, not cosmetic: this\nis a self-referential tree, and without it utoipa inlines the nested schema\nforever and overflows the stack while generating the spec.\n\n`Serialize` is here so a saved filter can store the tree in its validated\nform rather than as an opaque blob — round-tripping is exact because the\nenum is internally tagged, and the editor's own bookkeeping (`id`, `origin`,\na denormalized `entity`) is dropped on the way in and never comes back."},"ReleasesResponse":{"type":"object","required":["releases","now_ms"],"properties":{"releases":{"type":"array","items":{"$ref":"#/components/schemas/InstanceRelease"}},"now_ms":{"type":"integer","format":"int64"}}},"RiskEndpoint":{"type":"object","description":"One risk server address, exactly the bridge's `RiskEndpointConfig`\n(`src/risk-bridge/Config/FirmConnectionConfig.cs`). List order is priority: index 0 is\nthe primary, then backup 1, 2, …","required":["host","port"],"properties":{"host":{"type":"string"},"port":{"type":"integer","format":"int32","minimum":0}}},"RiskKind":{"type":"string","enum":["loss","profit"]},"RiskLevel":{"type":"string","description":"Risk banding from max drawdown over the last 12 months. Fixed\nthresholds, Leverate-owned, never broker-configurable: low < 10%,\nmedium 10-25%, high > 25%. NOT the score band — a high score is good, a\nhigh risk level is not.","enum":["low","medium","high"]},"RiskPeriod":{"type":"string","enum":["trade","daily","weekly"]},"ScoreBand":{"type":"string","description":"Score banding, independent of risk level. A higher score indicates\nbetter performance; a higher risk level indicates greater risk.","enum":["low","medium","high"]},"SealedCertificate":{"type":"object","description":"The PFX and its password, encrypted to the registered delivery key (8.7 §3.3).","required":["thumbprint_sha1","alg","epk","nonce","ciphertext"],"properties":{"thumbprint_sha1":{"type":"string"},"alg":{"type":"string"},"epk":{"type":"string","description":"base64url, the server's one-use P-256 public point (65 bytes)."},"nonce":{"type":"string","description":"base64url, 12 bytes."},"ciphertext":{"type":"string","description":"base64url, AES-256-GCM output including the tag."}}},"ServerIdentity":{"oneOf":[{"type":"object","required":["dns_name","kind"],"properties":{"dns_name":{"type":"string"},"kind":{"type":"string","enum":["dns_name"]}}},{"type":"object","description":"The server's PUBLIC certificate. `thumbprint_sha1`, `subject` and `not_after_ms`\nare derived by the server from `pem`, never taken from a client.","required":["pem","thumbprint_sha1","subject","not_after_ms","kind"],"properties":{"pem":{"type":"string"},"thumbprint_sha1":{"type":"string"},"subject":{"type":"string"},"not_after_ms":{"type":"integer","format":"int64"},"kind":{"type":"string","enum":["pinned_certificate"]}}}],"description":"How the bridge verifies the risk server: exactly one of a DNS name or a pinned\npublic certificate (the Leverate `BaseChannelFactoryBuilder` rule). Switching kind\nreplaces the other value."},"SetRelease":{"type":"object","required":["image_ref"],"properties":{"image_ref":{"type":"string"}},"additionalProperties":false},"Source":{"type":"string","description":"Instrument source: \"Leverate\" for the Leverate feed, \"Stocks\" for cash stocks, or \"MT5:<id>\" / \"MT4:<id>\" for an external trading system.","examples":["Leverate","Stocks","MT5:10055","MT4:10056"]},"SpreadMode":{"type":"string","description":"Spread mode used with the spread value on an instrument policy or\nfirm instrument override. Configure the mode and value together,\nor omit both to inherit from the next cascade level.","enum":["Fixed","Variable"]},"StatisticsAnalytics":{"type":"string","description":"Whether a statistics response carries every figure, only the summary, or — for a MAM master — nothing of its own.","enum":["full","summary","master"]},"StatisticsBodyKind":{"type":"string","enum":["range"]},"StatsPeriod":{"type":"string","description":"A statistics window key. Six precomputed periods plus the two fixed windows; all bucketing follows the platform trading day, never local\nmidnight.","enum":["1w","1m","3m","6m","1y","all","today","this_week"]},"SwapMultipliers":{"type":"object","required":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],"properties":{"monday":{"type":"number","format":"double"},"tuesday":{"type":"number","format":"double"},"wednesday":{"type":"number","format":"double"},"thursday":{"type":"number","format":"double"},"friday":{"type":"number","format":"double"},"saturday":{"type":"number","format":"double"},"sunday":{"type":"number","format":"double"}}},"SwapPolicy":{"type":"object","required":["swap_type","swap_long_amount","swap_short_amount","swap_long_pips","swap_short_pips","swap_long_percent","swap_short_percent","multipliers","multiplier_enabled"],"properties":{"swap_type":{"$ref":"#/components/schemas/TradingTermsSwapType"},"swap_long_amount":{"type":"number","format":"double"},"swap_short_amount":{"type":"number","format":"double"},"swap_long_pips":{"type":"number","format":"double"},"swap_short_pips":{"type":"number","format":"double"},"swap_long_percent":{"type":"number","format":"double"},"swap_short_percent":{"type":"number","format":"double"},"multipliers":{"$ref":"#/components/schemas/SwapMultipliers"},"multiplier_enabled":{"type":"boolean"}}},"TargetEngine":{"type":"string","description":"The target database engine: `postgres` for PostgreSQL or `mysql` for MySQL.\nRecorded from the connection URL and displayed in the bind directory.\nThe replicator derives its connection engine from the URL itself.","enum":["postgres","mysql"]},"TokenRequestForm":{"type":"object","description":"The `application/x-www-form-urlencoded` token request (documentation shape —\nthe handler parses the form manually).\n\n**The common grant is `client_credentials`**: a broker exchanges its\n`client_id` + `client_secret` (plus an optional `scope`) for a bearer JWT.\nThat is all most integrations ever send. The `subject_token*` fields exist\nONLY for the far rarer `token-exchange` grant that mints a delegated trader\ntoken; a `client_credentials` request leaves them unset — they are called out\nas such below so a reader is not misled into thinking they are required.","required":["grant_type"],"properties":{"grant_type":{"type":"string","description":"The OAuth2 grant. Use `client_credentials` for a broker server credential\n(THE common case); `urn:ietf:params:oauth:grant-type:token-exchange` only to\nmint a delegated trader token from a server token holding `trader:delegate`."},"scope":{"type":["string","null"],"description":"OPTIONAL. Space-delimited requested scopes (⊆ the credential's granted\nscopes). Omit to receive the credential's full granted set."},"client_id":{"type":["string","null"],"description":"`client_credentials`: the client id (`client_secret_post`), unless the id +\nsecret are supplied via HTTP Basic instead."},"client_secret":{"type":["string","null"],"description":"`client_credentials`: the client secret (`client_secret_post`), unless the\nid + secret are supplied via HTTP Basic instead."},"subject_token":{"type":["string","null"],"description":"TOKEN-EXCHANGE grant ONLY: the subject id (decimal) being delegated. Not\nused by — and ignored for — `client_credentials`."},"subject_token_type":{"type":["string","null"],"description":"TOKEN-EXCHANGE grant ONLY: the subject token type URN. Not used by — and\nignored for — `client_credentials`."}}},"TokenResponse":{"type":"object","description":"The 200 body for both grants.","required":["access_token","token_type","expires_in"],"properties":{"access_token":{"type":"string","description":"The minted bearer — a JWT (client_credentials) or an opaque `dt_` token\n(token-exchange)."},"token_type":{"type":"string","description":"RESPONSE ONLY — always `\"Bearer\"`. Not a request parameter; a client never\nsends this."},"expires_in":{"type":"integer","format":"int64","description":"Lifetime in seconds (600 for client JWTs, 900 for delegated tokens)."},"scope":{"type":["string","null"],"description":"Space-delimited granted scopes."},"issued_token_type":{"type":["string","null"],"description":"token-exchange only: the issued token type URN (RFC 8693)."}}},"Tradability":{"type":"string","description":"Tradability is also referenced from `Instrument` (the global default)\nand overrideable in both `FirmInstrumentOverride` and `InstrumentPolicy`.\nLiving here lets the cascade-level structs share one definition.","enum":["FullTrade","CloseOnly","NonTradable"]},"TradeAction":{"type":"string","enum":["Open","Close"]},"TradeRejectionReason":{"oneOf":[{"type":"string","enum":["UserDoesNotHaveTradingPermission"]},{"type":"string","enum":["AccountReadOnly"]},{"type":"string","enum":["AccountQuarantine"]},{"type":"string","enum":["AccountNotFound"]},{"type":"string","description":"The trading account exists, but its external trading account has not yet\nbeen provisioned. Requests from traders and automated system triggers\nare refused until provisioning completes.","enum":["AccountNotProvisioned"]},{"type":"string","description":"The account is managed by a money manager. Its owner cannot open, close,\npartially close or modify trades. Automated system triggers and the\nBackoffice `ignore_tradability` override remain available.","enum":["AccountManaged"]},{"type":"string","description":"The money manager is suspended. Market opens, pending-order placement,\nmodification or activation, and Backoffice reopens are refused on the\nmaster account. Closes, stop-loss/take-profit edits and pending-order\ncancels remain available. Automated system triggers and the Backoffice\n`ignore_tradability` override cannot bypass this restriction.","enum":["MasterSuspended"]},{"type":"string","description":"The account uses an equity trading-terms tier, which permits long positions\nonly. A Sell may reduce existing holdings but cannot open a short position.\nThis applies to market opens, pending-order placement, modification or\nactivation, and Backoffice position edits and reopens. Existing shorts\ncan still be closed. The restriction cannot be bypassed.","enum":["ShortNotAllowed"]},{"type":"object","description":"A discretionary native equity close would consume shares reserved by\nresting Sell orders. The entire requested close is refused.","required":["equity_close_reserved"],"properties":{"equity_close_reserved":{"type":"object","description":"A discretionary native equity close would consume shares reserved by\nresting Sell orders. The entire requested close is refused.","required":["reserved","available"],"properties":{"reserved":{"type":"number","format":"double"},"available":{"type":"number","format":"double"}}}}},{"type":"string","enum":["InvalidSymbol"]},{"type":"string","enum":["TradingIsDisabled"]},{"type":"string","enum":["CloseOnly"]},{"type":"string","description":"The instrument is not part of the firm's catalog (not in any\nInstrumentPack assigned to the firm), so this account may not open a\nposition or place a pending order on it.","enum":["InstrumentNotInCatalog"]},{"type":"string","description":"The instrument belongs to a different trading platform than the account.\nAn MT5 account can trade only its own server's symbols; an internal\naccount can trade only the legacy feed's symbols. Catalog membership\nalone does not make the instrument tradable on this account.","enum":["InstrumentNotOnAccountPlatform"]},{"type":"string","description":"The instrument is on the account's platform, but no per-symbol rule in\nthe account's MT5 group offers it. A matching rule that disables the\nsymbol instead returns `TradingIsDisabled`.","enum":["InstrumentNotInMt5Group"]},{"type":"string","description":"The instrument's security slot has `show = false` in the account's MT4\ngroup. A visible slot with `trade = false` instead returns\n`TradingIsDisabled`.","enum":["InstrumentNotInMt4Group"]},{"type":"string","enum":["MarketIsClosed"]},{"type":"string","enum":["NotConnectedToFeed"]},{"type":"string","enum":["InvalidPrice"]},{"type":"string","enum":["InvalidSize"]},{"type":"string","enum":["InvalidStopLoss"]},{"type":"string","enum":["InvalidTakeProfit"]},{"type":"string","enum":["InvalidStopLossLimitLevel"]},{"type":"string","enum":["InvalidTakeProfitLimitLevel"]},{"type":"string","enum":["InvalidPriceLimitLevel"]},{"type":"string","description":"A Stop Limit's limit price is farther from its activation price than\nthe broker's configured maximum offset in ticks. Applies when placing\nor modifying a pending order.","enum":["LimitOffsetAboveMaximum"]},{"type":"string","enum":["WrongCurrency"]},{"type":"string","enum":["NoRateAvailable"]},{"type":"string","enum":["MaxExposureReached"]},{"type":"string","enum":["TotalMaxExposureReached"]},{"type":"string","enum":["InsufficientMargin"]},{"type":"string","description":"Pending-order admission only; never stamped onto a TradeRequest.","enum":["InsufficientBuyingPower"]},{"type":"string","enum":["BuyingPowerUnavailable"]},{"type":"string","enum":["BuyingPowerUnavailableForAccount"]},{"type":"string","enum":["NotEnoughMoneyForBroker"]},{"type":"string","description":"No leverage rule resolved for this (symbol, account) anywhere in the\ncascade (trading-term policy → firm override → instrument, neither\nspecific rule nor group), or the resolved rule was unusable (e.g. a\nrelative multiplier that rounds to leverage 0). The broker must\nconfigure a leverage rule for the instrument before it can be traded.","enum":["NoLeverageConfigured"]},{"type":"string","enum":["TradeAlreadyClosed"]},{"type":"string","enum":["ReadOnlyForTrader"]},{"type":"string","enum":["ScalpingClosedDelay"]},{"type":"string","enum":["PendingOrderExpired"]},{"type":"string","enum":["PendingOrderExecuted"]},{"type":"string","enum":["PendingOrderDoesNotExist"]},{"type":"string","enum":["PendingOrderRule"]},{"type":"string","description":"A pending order is refused because its netting account has cancel-pending\nenabled and holds no position in the instrument. This differs from\n`PendingOrderRule`, which reports an MT5 expiration restriction.","enum":["PendingOrderRequiresOpenPosition"]},{"type":"string","enum":["InvalidActivation"]},{"type":"string","enum":["OrderNotExist"]},{"type":"string","enum":["RejectedByRisk"]},{"type":"string","enum":["NoAttractivePrice"]},{"type":"string","enum":["UnsupportedBookType"]},{"type":"string","enum":["NoHedgingBehaviour"]},{"type":"string","enum":["DisableSellDirectionForOptions"]},{"type":"string","enum":["TimeExpired"]},{"type":"string","description":"Requested execution delay exceeds the permitted maximum.","enum":["DelayOutOfBounds"]},{"type":"string","enum":["LeverageMismatchOnNettingPosition"]},{"type":"string","description":"The request is structurally valid, but the requested trading feature\nis not supported.","enum":["UnsupportedFeature"]},{"type":"string","enum":["InvalidAmount"]},{"type":"string","enum":["GeneralError"]},{"type":"object","description":"A trader-defined risk limit was reached. `kind` and `period` identify\nthe limit; `until_ms` is the end of the restriction in epoch milliseconds.","required":["trader_risk_limit_reached"],"properties":{"trader_risk_limit_reached":{"type":"object","description":"A trader-defined risk limit was reached. `kind` and `period` identify\nthe limit; `until_ms` is the end of the restriction in epoch milliseconds.","required":["kind","period","until_ms"],"properties":{"kind":{"$ref":"#/components/schemas/RiskKind"},"period":{"$ref":"#/components/schemas/RiskPeriod"},"until_ms":{"type":"integer","format":"int64"}}}}},{"type":"string","description":"The account is executed on an external MetaTrader platform (MT5 or MT4), and\nits brand does not allow MetaTrader accounts to be traded on this platform\n(`mtTradeInWt` is off): it is traded in the MetaTrader terminal. Refuses a\ntrader's market open and pending-order placement from the WebTrader, mobile or\nthe trader's AI, unless the account is a money-manager master whose trading\nterminal is this platform. Closes, partial closes, stop-loss/take-profit edits\nand pending-order changes and cancels remain available.","enum":["AccountTradedInMetaTrader"]},{"type":"string","description":"S1 writes this when a gated, non-equities Close would partly close a\nposition on an account restricted by its brand's partial-close policy.\n**Rollback caution:** this is a STORED wire string; an older binary\ncannot deserialize requests carrying it.","enum":["PartialCloseNotAllowed"]},{"type":"string","description":"S3 writes this when a gated, non-equities opposite netting order would\nreduce a position and leave a remainder on a restricted account.\n**Rollback caution:** this is a STORED wire string; an older binary\ncannot deserialize requests carrying it.","enum":["NettingReduceNotAllowed"]},{"type":"string","description":"The client's account is restricted: trading suspended, or the account\nblocked or closed. Every trading account of it is close-only for the\ntrader: market opens and pending-order placement or modification are\nrefused; closes, partial closes, stop-loss/take-profit edits and\npending-order cancels remain available. Automated system triggers and the\nBackoffice `ignore_tradability` override are not refused.\n\n**Rollback caution:** a STORED wire string. A binary that predates this\nvariant cannot deserialize a request rejected with it.","enum":["AccountRestricted"]}],"description":"Why a trade request was rejected. A rejection can occur during validation\nor while a placed request is processed by the execution venue."},"TradeRequestState":{"type":"string","enum":["Rejected","Placed","Confirmed"]},"TradingTerms":{"type":"object","required":["firm_id","name","status","leverage","margin_call_level","stop_out_level","force_stop_loss","guarantee_stop_loss","is_islamic"],"properties":{"firm_id":{"type":"integer","format":"int64"},"trading_system_id":{"type":"integer","format":"int64","description":"System-tenant `TradingSystem` this tier is pinned to (the swap clock a\n`ForexAccount` created against this tier inherits). `0` = unset. Webtrader\nself-service signup reads this to decide which trading system a\nbrand-default trading account is provisioned under."},"name":{"type":"string"},"status":{"$ref":"#/components/schemas/TradingTermsStatus"},"leverage":{"type":"integer","format":"int32","minimum":0},"margin_call_level":{"type":"number","format":"double"},"stop_out_level":{"type":"number","format":"double"},"force_stop_loss":{"type":"boolean"},"guarantee_stop_loss":{"type":"boolean"},"is_islamic":{"type":"boolean"},"free_days":{"type":["integer","null"],"format":"int32","minimum":0},"default_execution_delay_ms":{"type":["integer","null"],"format":"int32","description":"Default execution delay in milliseconds for trades placed on this tier.\nIf absent, trades execute immediately. A per-request `delay_ms` overrides\nthis default; the effective delay is capped at 10,000 milliseconds.","minimum":0},"liquidation_rejection_cap":{"type":["integer","null"],"format":"int32","description":"Maximum close attempts for the same position within one liquidation\ncycle before that position is skipped for the rest of the cycle. An absent\nvalue uses the service default. The counter resets when the cycle\ncompletes or freezes.","minimum":0},"sirix_server_id":{"type":["integer","null"],"format":"int64","description":"ID of the source Leverate server definition for an imported trading-terms\ntier. Null for a tier created natively."},"sirix_id":{"type":["string","null"],"description":"Source Leverate trading-terms identifier. Together with `sirix_server_id`\nand the workspace, it identifies the imported tier and prevents duplicate\nimports. Null for a tier created natively."},"mt5_group":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef","description":"The MT5 group this tier was imported from. Absent for tiers created\nnatively or imported from Leverate. Accounts on an MT5-backed tier use\nthe group's spread rules."}]},"mt4_group":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef","description":"The MT4 group this trading-terms tier was imported from. Used to apply\nthe group's spread rules to its accounts. Null for tiers created natively\nor imported from another source."}]},"demo_mt5_group":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef","description":"The MT5 group a demo account on this MT5-backed tier opens in. `null`/absent = demo\naccounts are refused on this tier. Managed from the backoffice trading-terms page only."}]},"demo_mt4_group":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ForeignRef","description":"The MT4 group a demo account on this MT4-backed tier opens in. `null`/absent = demo\naccounts are refused on this tier. Managed from the backoffice trading-terms page only."}]},"external_execution_instance_id":{"type":["integer","null"],"format":"int64","description":"External execution venue (instance id) this tier routes to. `null` = internal\nexecution. Managed from the backoffice trading-terms page only."},"product":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TradingTermsProduct","description":"Product this tier's accounts trade. `null`/absent = unscoped. Managed from the\nbackoffice trading-terms page; the Platform API may set or clear it only for a\nfirm with Equities Trading enabled on at least one brand."}]},"position_mode":{"$ref":"#/components/schemas/PositionModeSetting","description":"How this tier's accounts count positions: `Hedging` (each order opens its own position),\n`Netting` (one net position per instrument), or `Inherit` (the workspace default). Absent\nmeans `Inherit`. On a write, `Netting` is refused while netting is not enabled for the\nworkspace (unless the tier already stores it); on an update an absent key keeps the stored\nvalue and `null` resets it to `Inherit`."},"netting_cancel_pending":{"$ref":"#/components/schemas/NettingCancelPendingSetting","description":"Netting accounts only: `On` refuses a pending order while no position is open on its\ninstrument and cancels the instrument's pending orders when its position fully closes;\n`Off` does neither; `Inherit` takes the workspace's. Absent means `Inherit`. On a write,\n`On` is refused while netting is not enabled for the workspace (unless the tier already\nstores it); on an update an absent key keeps the stored value and `null` resets it."},"netting_commission":{"$ref":"#/components/schemas/NettingCommissionSetting","description":"Netting accounts only: commission on the volume an order opens (`OpeningVolumeOnly`) or on\nevery order (`EveryOrder`); `Inherit` takes the workspace's. Absent means `Inherit`. On a\nwrite, `EveryOrder` is refused while netting is not enabled for the workspace (unless the\ntier already stores it); on an update an absent key keeps the stored value and `null`\nresets it."},"_extra":{"type":"object"}}},"TradingTermsProduct":{"type":"string","description":"The product an account on this tier trades. `Cfd` — leveraged CFDs (every\nexisting tier); `Equity` — whole-share stocks at 1:1. Absent = unscoped: the tier\nis not product-filtered (the legacy arm, like an unset trading system).\n**APPEND-ONLY.** A stored tier names its variant by string, so renaming or\nremoving one orphans every record that used it; new products get a NEW variant.","enum":["Cfd","Equity"]},"TradingTermsStatus":{"type":"string","enum":["Active","Inactive","MarkedForDeletion"]},"TradingTermsSwapType":{"type":"string","enum":["Default","Amount","Pips","Percent"]},"Transition":{"type":"object","required":["state","session_id"],"properties":{"state":{"$ref":"#/components/schemas/InstanceState"},"reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstanceReason"}]},"session_id":{"type":"string","description":"Nonempty ASCII process-session identifier.","maxLength":64,"minLength":1},"running_image":{"type":["string","null"],"maxLength":512},"git_sha":{"type":["string","null"],"description":"ASCII source revision identifier.","maxLength":64},"config_revision_applied":{"type":["integer","null"],"format":"int64","minimum":1},"started_ms":{"type":["integer","null"],"format":"int64","minimum":0},"detail":{"description":"Family-specific JSON, at most 4096 bytes when serialized as UTF-8."}},"additionalProperties":false},"TransitionAccepted":{"allOf":[{"$ref":"#/components/schemas/InstanceStatus"},{"type":"object","required":["beat_key"],"properties":{"beat_key":{"type":"string","description":"64 lowercase hex (32 bytes): the HMAC-SHA256 key for this session's beats on\n`disruptor.instance.status.<instance_key>`. Each beat carries a `counter`\nstrictly greater than the last and `mac` = hex HMAC-SHA256(key,\n`instance-beat-v1\\n{instance_key}\\n{session_id}\\n{counter}`). A new\nsession or a rotated credential yields a new key. Never log it.","maxLength":64,"minLength":64}}}],"description":"The accepted status row plus this session's NATS beat key. No\n`Debug` on purpose — the key must never reach a log line."},"TxMethod":{"type":"string","description":"How the money moved: `Deposit`, `Withdrawal`, `Bonus` or `Chargeback`.\nIf omitted on an older transaction, a negative amount means `Withdrawal`;\notherwise it means `Deposit`.","enum":["Deposit","Withdrawal","Bonus","Chargeback"]},"WebhookSecretResponse":{"allOf":[{"$ref":"#/components/schemas/ApiWebhookSubscription"},{"type":"object","required":["secret"],"properties":{"secret":{"type":"string","description":"The plaintext signing secret (`whsec_…`), shown once."}}}],"description":"The create / rotate response. `secret` is the ONLY time the plaintext signing\nsecret is ever transmitted — store it now; it cannot be read back."}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"A Bearer JWT. Two credentials use this scheme: a personal API token (backoffice → user menu → Tokens) for the user operations (Get Instruments, Get Trading Terms, the market-data WebSocket); or a broker client-credentials JWT from the OAuth2 `client_credentials` grant at `POST /api/v1/oauth/token` for the broker operations — the bulk query surface, account / position / transaction writes, user creation, trading-terms writes, prop challenge sales, and webhook management — which reject personal tokens. See the API description for which credential each operation requires; where a 403 response names a specific scope, that is the scope the operation requires."}}},"tags":[{"name":"user-api","description":"Token-authenticated API for a system user's own automation."},{"name":"read","description":"Keyset-paginated bulk reads over the registry-driven query surface."},{"name":"webhooks","description":"Register and manage signed outbound webhook endpoints (`webhooks:manage`)."},{"name":"users","description":"Create system users / agents in the credential's own firm (`users:write`)."},{"name":"replication","description":"Firm-scoped change discovery for a replication bind (`replication:read`)."},{"name":"platform-prop","description":"Sell prop challenges from a broker's backend (`prop-challenges:read` / `prop-challenges:write`): list the firm's plans, validate a discount code, quote a choice, buy a plan or a retry for an account, read the purchase. A paid purchase is settled by the `POST /api/v1/transactions` deposit that names it (`prop_purchase_id`, `transactions:write`)."}]}