---
title: "Place complex order"
method: POST
path: "/accounts/{accountId}/trading/complex"
tags: ["Trading"]
---

# Place complex order

`POST /accounts/{accountId}/trading/complex`

Places a complex conditional order (OCO, OTO, or OTOCO).
Only supported on certain brokerages.
Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for details on which brokerages support complex orders and which types they support.

- **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled.
- **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order.
- **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.

## Path parameters

- `accountId` string, uuid, required — Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.

## Query parameters

- `userId` string, required — SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
- `userSecret` string, required — SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).

## Request body

- ManualTradeFormComplex — Request body for placing a complex conditional order (OCO, OTO, or OTOCO).
  - `type` 'OCO' | 'OTO' | 'OTOCO', required — The complex order type. - `OCO`: One Cancels the Other — two peer orders. - `OTO`: One Triggers the Other — a trigger order and a conditional order. - `OTOCO`: One Triggers a One Cancels the Other — a trigger order and two peer orders.
  - `orders` ComplexOrderLeg[], required — The orders that make up the complex order. Required counts and roles per type: - `OCO`: exactly 2 orders, both `PEER` - `OTO`: exactly 2 orders, one `TRIGGER` and one `CONDITIONAL` - `OTOCO`: exactly 3 orders, one `TRIGGER` and two `PEER`
    - `order_role` 'TRIGGER' | 'CONDITIONAL' | 'PEER', required — The role of this leg within the complex order.
    - `action` 'BUY' | 'SELL', required — The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
    - `instrument` TradingInstrument, required
      - `symbol` string, required — The instrument's trading ticker symbol. This currently supports stock symbols and Options symbols in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
      - `type` 'EQUITY' | 'OPTION' | 'CRYPTOCURRENCY' | 'CRYPTOCURRENCY_PAIR', required — The instrument's type
    - `order_type` 'Limit' | 'Market' | 'StopLimit' | 'Stop', required — The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
    - `units` number, required — Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
    - `time_in_force` 'FOK' | 'Day' | 'GTC' | 'IOC', required — The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
    - `price` number, nullable — The limit price. Required when `order_type` is `Limit` or `StopLimit`.
    - `stop` number, nullable — The stop trigger price. Required when `order_type` is `Stop` or `StopLimit`.
  - `client_order_id` string, uuid, nullable — Optional caller-supplied identifier passed through to the brokerage for idempotent order placement. Must be a canonical 36-character UUID. Idempotency enforcement is brokerage-specific - SnapTrade forwards this value to the broker but does not enforce uniqueness server-side. Refer to per-brokerage documentation for behavior on duplicate submission.

## Response `200`

OK

- ComplexOrderResponse — Response returned after successfully placing a complex order. AccountOrderRecord rows for the legs are not created synchronously — they're hydrated by the next brokerage sync, and can be queried later using the returned `brokerage_group_order_id`.
  - `type` 'OCO' | 'OTO' | 'OTOCO' — The complex order type that was placed.
  - `brokerage_group_order_id` string, nullable — The brokerage-assigned identifier that links all legs of this complex order together. Each leg will eventually appear as a separate AccountOrderRecord sharing this value. May be null if the brokerage does not return a group identifier.

## Other responses

- `400` — Trade could not be placed
- `403` — User does not have permissions to place trades
- `500` — Unexpected Error

---

[API](https://skmtc.net/passiv/apis/snaptrade.md) · [All operations](https://skmtc.net/passiv/apis/snaptrade/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/passiv/snaptrade/revisions/259274f1e845/schema)
