> ## 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.

# Preview an exit plan

> Returns what the plan would place for this account and this order: every leg priced from the account's own instrument facts, what the ladder protects, what the order carries that it does not, and the token that binds the order. Preview before placing: the placement carries this token and no levels, so the engine and the trader are agreeing on the same order rather than on a price a client computed.



## OpenAPI

````yaml /partner-platform/openapi.json post /api/account/exit-plans/preview
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/account/exit-plans/preview:
    post:
      tags:
        - Account
      summary: Preview an exit plan
      description: >-
        Returns what the plan would place for this account and this order: every
        leg priced from the account's own instrument facts, what the ladder
        protects, what the order carries that it does not, and the token that
        binds the order. Preview before placing: the placement carries this
        token and no levels, so the engine and the trader are agreeing on the
        same order rather than on a price a client computed.
      parameters:
        - name: broker
          in: query
          schema:
            type: string
        - name: account
          in: query
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExitPlanPreviewRequest'
      responses:
        '200':
          description: The resolved plan and its token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExitPlanPreview'
        '400':
          description: >-
            The plan does not apply, the account cannot run it, or it does not
            resolve on this instrument
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing/unknown/revoked credential
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No such exit plan
          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/account/exit-plans/preview', {
              method: 'POST',
              headers: {
                'content-type': 'application/json',
                Authorization: `Bearer ${process.env.TRDRS_API_KEY}`,
              },
              body: JSON.stringify({
                "planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
                "instrument": "ESU6",
                "side": "buy",
                "quantity": 2,
                "entryType": "limit",
                "entryPrice": 6480.5
              }),
            })

            const data = await res.json()
        - lang: shell
          label: cURL
          source: |-
            curl -X POST 'https://app.trdrs.co/api/account/exit-plans/preview' \
              -H "Authorization: Bearer $TRDRS_API_KEY" \
              -H 'content-type: application/json' \
              -d '{"planId":"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37","instrument":"ESU6","side":"buy","quantity":2,"entryType":"limit","entryPrice":6480.5}'
components:
  schemas:
    ExitPlanPreviewRequest:
      type: object
      description: >-
        What the plan would place for this account and this order. The engine
        supplies every price; the request names the order and nothing else.
      properties:
        planId:
          type: string
        clientOrderId:
          type: string
          description: >-
            The client order id the placement will ride under. The token is
            bound to it, so a confirmation is spent on one submission rather
            than good for any order until it expires.
        instrument:
          type: string
        side:
          type: string
          enum:
            - buy
            - sell
        quantity:
          type: number
        entryType:
          type: string
          enum:
            - market
            - limit
            - stop
            - stop_limit
        entryPrice:
          type:
            - number
            - 'null'
          description: >-
            The resting entry's own price. Ignored for a market entry, whose
            ladder is measured from the mark at placement.
      required:
        - planId
        - clientOrderId
        - instrument
        - side
        - quantity
      example:
        planId: 0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37
        instrument: ESU6
        side: buy
        quantity: 2
        entryType: limit
        entryPrice: 6480.5
    ExitPlanPreview:
      type: object
      description: >-
        WireExitPlanPreview (@trdrs/contracts): the resolved legs plus the token
        that binds them. The token is a signed binding over the order — the
        account, the client order id, the plan and its revision, the instrument,
        the side, the quantity and the entry — never over the prices: placement
        reloads the plan at that revision and re-resolves, so a preview proves
        what was agreed rather than carrying a price a client could have chosen.
        A market entry's levels are indicative for the same reason.
      properties:
        planId:
          type: string
        planRevision:
          type: string
        legs:
          type: array
          items:
            $ref: '#/components/schemas/ResolvedExitLeg'
        managedQuantity:
          type: number
        unmanagedQuantity:
          type: number
          description: What the order carries that the plan does not protect.
        engineManaged:
          type: boolean
          description: >-
            True when the engine itself will ratchet the stop, rather than the
            venue holding it still.
        token:
          type: string
        expiresAt:
          type: integer
          description: Epoch milliseconds
      required:
        - planId
        - planRevision
        - legs
        - managedQuantity
        - unmanagedQuantity
        - engineManaged
        - token
        - expiresAt
      example:
        planId: 0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37
        planRevision: q2Jm4XxT0aVnR7cLp1sZfE9d
        legs:
          - seq: 1
            quantity: 1
            stopTicks: 12
            stopPrice: 6477.5
            targetTicks: 20
            targetPrice: 6485.5
            breakevenTriggerTicks: null
            breakevenPlusTicks: null
            trailSteps: []
          - seq: 2
            quantity: 1
            stopTicks: 12
            stopPrice: 6477.5
            targetTicks: null
            targetPrice: null
            breakevenTriggerTicks: 8
            breakevenPlusTicks: 0
            trailSteps:
              - stepSeq: 1
                triggerTicks: 16
                trailDistanceTicks: 8
                frequencyTicks: 2
        managedQuantity: 2
        unmanagedQuantity: 0
        engineManaged: true
        token: WyI3YTFmNGM5M2IyOGQwNWU2Il0.9Qp3Vv1sKdN0yTbXmR7cLh
        expiresAt: 1787581980000
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
      example:
        error: invalid_instrument
    ResolvedExitLeg:
      type: object
      description: >-
        WireResolvedExitLeg (@trdrs/contracts): one leg as the engine will place
        it. Both the tick distance and the absolute price are served because a
        client renders one and the venue takes the other; neither is recomputed
        anywhere else.
      properties:
        seq:
          type: integer
        quantity:
          type: number
        stopTicks:
          type: integer
        stopPrice:
          type: number
        targetTicks:
          type:
            - integer
            - 'null'
        targetPrice:
          type:
            - number
            - 'null'
        breakevenTriggerTicks:
          type:
            - integer
            - 'null'
        breakevenPlusTicks:
          type:
            - integer
            - 'null'
        trailSteps:
          type: array
          items:
            type: object
            properties:
              stepSeq:
                type: integer
              triggerTicks:
                type: integer
              trailDistanceTicks:
                type: integer
              frequencyTicks:
                type: integer
            required:
              - stepSeq
              - triggerTicks
              - trailDistanceTicks
              - frequencyTicks
      required:
        - seq
        - quantity
        - stopTicks
        - stopPrice
        - trailSteps
      example:
        seq: 1
        quantity: 1
        stopTicks: 12
        stopPrice: 6477.5
        targetTicks: 20
        targetPrice: 6485.5
        breakevenTriggerTicks: null
        breakevenPlusTicks: null
        trailSteps: []
  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.

````