> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trdrs.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the risk state

> Returns the five per-account controls (daily and weekly loss limits, daily and weekly profit targets, and the end-of-day close) plus the lock state the risk monitor holds for the account. These are the controls behind every `423 risk_locked` a trading route answers: when one fires, the monitor flattens the account and locks trading until the period resets (daily at the 17:00 CT roll, weekly at Sunday 17:00 CT). `broker` is required; `account` names one account under a multi-account login, else the default. The same `lock` object streams live as the `lock` event on `/api/account/stream`.



## OpenAPI

````yaml /partner-platform/openapi.json get /api/risk
openapi: 3.1.0
info:
  title: trdrs Engine API
  version: 1.1.0
  description: >-
    ## API Reference


    This is the served OpenAPI contract for the trdrs engine: market data,
    trading and account

    routes for your firm's traders, trdrs Connect account-registration handoff,
    and preview

    challenge routes.


    See Quick Start for the first integration path: key setup, market config,
    chart data, Connect

    account registrations, idempotency, stream reconnects, and conformance.


    See Overview and API Standards for the cross-cutting contract rules.
servers:
  - url: https://app.trdrs.co
    description: Production
  - url: /
    description: This engine
security: []
tags:
  - name: Market data
    description: >-
      Symbol search and resolution, OHLCV history, quote snapshots, the server
      clock, and the live bar stream. Crypto rides each venue’s public feed;
      futures stream from the caller’s own connected Rithmic account. With none
      connected, futures requests answer 503 `feed_requires_connection`.
  - name: News
    description: >-
      Aggregated market news and the economic calendar, from licensed/open
      sources, keyword-tagged with futures roots at ingest. Platform-wide
      content (nothing per-user), admitted exactly like Market data: a licensed
      origin, a session, or a firm API key. Headlines page by published time,
      scope by instrument root, and stream live over SSE; thumbnails serve
      through the image proxy.
  - name: Trading
    description: >-
      The money surface: entries, exits, replaces, cancels, and position/account
      flattening. Every order-placing call uses `clientOrderId` as its
      idempotency key.
  - name: Account
    description: >-
      Reading a connected account. You do not create trading accounts here: a
      trader connects their own broker account (or creates a free demo account)
      in the app, and firms create evaluation accounts through the Partner API
      (Firm accounts → Create evaluation accounts) or register venue accounts
      through Connect (Create an account registration). Account state and the
      durable ledgers: balances, positions, working orders, fills, P&L history,
      and the live account stream.
  - name: Connect
    description: >-
      trdrs Connect account registration, for partner firms. Register an account
      you issued on your own venue — a pending account registration — with the
      trader’s sign-in email, optionally the venue account id and the login name
      your venue issued. The trader finds it waiting in the connect flow the
      moment they sign in with that email: the connect step is pre-filled with
      everything except the credential, which the trader always enters
      themselves. A registration never transmits a password and never grants
      access to anything before the trader’s own login succeeds. These routes
      answer a partner-scoped key only; a firm API key or a user session gets
      401. Registrations expire after 30 days; re-registering the same email +
      account refreshes the expiry instead of duplicating. The end-to-end flow
      guide is **[Quick Start](/docs/guides/quick-start)**.
  - name: Firm accounts
    description: >-
      Evaluation accounts your firm issues on the trdrs venue, through your
      partner key — the other half of account setup. Connect registrations hand
      off accounts that exist on your venue; these routes create and manage
      accounts on ours: the trader trades them on trdrs, and your firm owns the
      lifecycle. Every route is scoped to accounts your firm created through
      this API — an account the same trader opened themselves is invisible and
      untouchable here, by construction. Creation is batched with per-item
      results, and every write carries your own `referenceId`, so a crashed
      pipeline retries safely. Served when the deployment runs the prop engine;
      without it, every route in this group answers `404`.
  - name: Webhooks
    description: >-
      The outbound event bus: register an https endpoint and the platform pushes
      events to it instead of your back office polling us. Every delivery is
      signed (`trdrs-signature: t=<unix>,v1=<hmac-sha256>` over
      `${t}.${rawBody}`) so you can prove it came from us and is fresh, and
      every delivery is durable — a failed attempt is retried with backoff for
      about nine hours and the whole log is readable, so an endpoint that was
      down is a delay rather than a lost event. Serves brokers and prop firms
      alike: the account-registration (`registration.*`) events fire wherever
      Connect does, and the account events fire where the prop engine runs.
  - name: Challenges
    description: >-
      The prop evaluation surface: challenge programs and a trader’s own
      enrollments. **Preview: the one group on this page outside the
      additive-only guarantee** (the pre-contract v1 scaffold; the Phase-1
      rebuild will change these shapes; see Stability). **Cookie-authenticated,
      not key-authenticated**, and served only when the engine runs with
      `CHALLENGES_ENABLED`; without that flag the bundle is absent and every
      route below returns `404`. The firm-console/admin half of this surface is
      deliberately not documented here. It is back office, not licensed surface.
paths:
  /api/risk:
    get:
      tags:
        - Account
      summary: Get the risk state
      description: >-
        Returns the five per-account controls (daily and weekly loss limits,
        daily and weekly profit targets, and the end-of-day close) plus the lock
        state the risk monitor holds for the account. These are the controls
        behind every `423 risk_locked` a trading route answers: when one fires,
        the monitor flattens the account and locks trading until the period
        resets (daily at the 17:00 CT roll, weekly at Sunday 17:00 CT). `broker`
        is required; `account` names one account under a multi-account login,
        else the default. The same `lock` object streams live as the `lock`
        event on `/api/account/stream`.
      parameters:
        - name: broker
          in: query
          required: true
          schema:
            type: string
          description: >-
            A connected broker (`rithmic`, `tastytrade`, `paper`, ...).
            Required: risk controls are per account, never a priority default.
        - name: account
          in: query
          schema:
            type: string
          description: >-
            Pick an account within that broker. Validated against the caller's
            own set; out-of-set is a 400.
      responses:
        '200':
          description: The controls as stored and the current lock state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RiskStateResponse'
        '400':
          description: Missing/unknown broker, or an account outside the caller set
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing/unknown/revoked credential
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - tenantKey: []
      x-codeSamples:
        - lang: javascript
          label: TypeScript
          source: >-
            const res = await
            fetch('https://app.trdrs.co/api/risk?broker=rithmic&account=PA-4821-07',
            {
              headers: { Authorization: `Bearer ${process.env.TRDRS_API_KEY}` },
            })

            const data = await res.json()
        - lang: shell
          label: cURL
          source: >-
            curl
            'https://app.trdrs.co/api/risk?broker=rithmic&account=PA-4821-07' \
              -H "Authorization: Bearer $TRDRS_API_KEY"
components:
  schemas:
    RiskStateResponse:
      type: object
      description: >-
        RiskStateResponse. The account controls as stored, and the current lock
        state.
      properties:
        settings:
          $ref: '#/components/schemas/RiskSettings'
        lock:
          $ref: '#/components/schemas/RiskLock'
      required:
        - settings
        - lock
      example:
        settings:
          broker: rithmic
          accountNumber: PA-4821-07
          dailyLossEnabled: true
          dailyLossValue: 1000
          weeklyLossEnabled: false
          weeklyLossValue: null
          dailyProfitEnabled: false
          dailyProfitValue: null
          weeklyProfitEnabled: false
          weeklyProfitValue: null
          eodCloseEnabled: true
          eodCloseValue: 15
          lockSettingsWhenTradingLocked: true
          updatedAt: 1787581500
        lock:
          broker: rithmic
          accountNumber: PA-4821-07
          tradingLocked: false
          settingsLocked: false
          lockReason: null
          lockWindow: null
          tradingUnlockAt: null
          settingsUnlockAt: null
          triggerPnl: null
          flattenConfirmed: false
          monitoring: live
          settings:
            broker: rithmic
            accountNumber: PA-4821-07
            dailyLossEnabled: true
            dailyLossValue: 1000
            weeklyLossEnabled: false
            weeklyLossValue: null
            dailyProfitEnabled: false
            dailyProfitValue: null
            weeklyProfitEnabled: false
            weeklyProfitValue: null
            eodCloseEnabled: true
            eodCloseValue: 15
            lockSettingsWhenTradingLocked: true
            updatedAt: 1787581500
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
      example:
        error: invalid_instrument
    RiskSettings:
      type: object
      description: >-
        RiskSettings. The five per-account controls: four loss/profit thresholds
        in account currency and the end-of-day close in whole minutes before the
        16:00 CT session close. An enabled control always carries a positive
        value; a disabled one reads null.
      properties:
        broker:
          type: string
        accountNumber:
          type: string
        dailyLossEnabled:
          type: boolean
        dailyLossValue:
          type:
            - number
            - 'null'
          description: >-
            Close out and lock trading for the day when the session is down this
            much.
        weeklyLossEnabled:
          type: boolean
        weeklyLossValue:
          type:
            - number
            - 'null'
          description: >-
            Close out and lock trading for the week when the week is down this
            much.
        dailyProfitEnabled:
          type: boolean
        dailyProfitValue:
          type:
            - number
            - 'null'
          description: >-
            Close out and lock trading for the day when the session is up this
            much.
        weeklyProfitEnabled:
          type: boolean
        weeklyProfitValue:
          type:
            - number
            - 'null'
          description: >-
            Close out and lock trading for the week when the week is up this
            much.
        eodCloseEnabled:
          type: boolean
        eodCloseValue:
          type:
            - number
            - 'null'
          description: >-
            Whole minutes before the 16:00 CT close at which every position
            closes and trading locks until the 17:00 CT reopen, 1-240.
            Time-based: fires independently of the P&L feed.
        lockSettingsWhenTradingLocked:
          type: boolean
          description: >-
            When a control locks trading, also lock these settings until 16:00
            CT, so the lock cannot be undone mid-period. Coerced off while no
            control is enabled.
        updatedAt:
          type: number
          description: Epoch seconds of the last write.
      required:
        - broker
        - accountNumber
        - dailyLossEnabled
        - dailyLossValue
        - weeklyLossEnabled
        - weeklyLossValue
        - dailyProfitEnabled
        - dailyProfitValue
        - weeklyProfitEnabled
        - weeklyProfitValue
        - eodCloseEnabled
        - eodCloseValue
        - lockSettingsWhenTradingLocked
        - updatedAt
    RiskLock:
      type: object
      description: >-
        RiskLock. The lock and monitoring state the risk monitor holds for one
        account. `tradingLocked` is the fail-closed gate every order-placing
        route reads (423 `risk_locked` while true); `settingsLocked` refuses
        control edits and the manual unlock until `settingsUnlockAt`.
      properties:
        broker:
          type: string
        accountNumber:
          type: string
        tradingLocked:
          type: boolean
        settingsLocked:
          type: boolean
          description: >-
            True while "prevent changes when trading is locked" holds the
            settings shut (until 16:00 CT).
        lockReason:
          type:
            - string
            - 'null'
          enum:
            - daily_loss
            - weekly_loss
            - daily_profit
            - weekly_profit
            - eod_close
            - eval_breach
            - firm_halt
            - null
          description: >-
            Which control fired. `eval_breach` is a prop evaluation failing;
            `firm_halt` is a partner firm halting the account, permanent until
            the firm resumes (the manual unlock refuses both). Null while
            trading.
        lockWindow:
          type:
            - string
            - 'null'
          enum:
            - daily
            - weekly
            - null
          description: >-
            The period the lock belongs to: daily unlocks at the next 17:00 CT
            roll, weekly at Sunday 17:00 CT.
        tradingUnlockAt:
          type:
            - number
            - 'null'
          description: >-
            Epoch seconds when trading unlocks by itself, or null (no lock, or a
            lock with no scheduled release).
        settingsUnlockAt:
          type:
            - number
            - 'null'
          description: Epoch seconds when the settings unlock (16:00 CT), or null.
        triggerPnl:
          type:
            - number
            - 'null'
          description: The net P&L that fired the lock, or null.
        flattenConfirmed:
          type: boolean
          description: >-
            True once the post-trigger flatten has been observed flat. Until
            then the lock holds while the monitor keeps closing a residual
            position.
        monitoring:
          type: string
          enum:
            - live
            - paused
          description: >-
            `paused` means the P&L feed is unknown or stale so no new control
            can fire; existing locks still hold. Never a silent all-clear.
        settings:
          $ref: '#/components/schemas/RiskSettings'
      required:
        - broker
        - accountNumber
        - tradingLocked
        - settingsLocked
        - lockReason
        - lockWindow
        - tradingUnlockAt
        - settingsUnlockAt
        - triggerPnl
        - flattenConfirmed
        - monitoring
        - settings
  securitySchemes:
    tenantKey:
      type: http
      scheme: bearer
      description: >-
        Your firm’s API key (the API calls this the `tenant` key; `trdrs_sk_…`),
        server-to-server only.

````