List Complex Orders
getAccountsAccountNumberComplexOrders/accounts/{account_number}/complex-ordersBase URL: https://api.cert.tastyworks.com (Sandbox) · https://api.tastyworks.com (Production)
Returns a paginated list of all complex (bracket) orders for the account, such as OTOCO, OCO, OTO, and PAIRS strategies. Each complex order wraps one or more component orders and, where applicable, a trigger order. Use the `page-offset` and `per-page` query parameters to page through results.
Code samples
curl -X GET 'https://api.cert.tastyworks.com/accounts/5WX01234/complex-orders?page-offset=10&per-page=10' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'User-Agent: tastytrade-docs-example/1.0'import requests
url = "https://api.cert.tastyworks.com/accounts/5WX01234/complex-orders?page-offset=10&per-page=10"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
}
resp = requests.get(url, headers=headers)
print(resp.status_code, resp.json())const resp = await fetch("https://api.cert.tastyworks.com/accounts/5WX01234/complex-orders?page-offset=10&per-page=10", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
},
})
const data = await resp.json()
console.log(resp.status, data)package main
import (
"net/http"
"io"
"fmt"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.cert.tastyworks.com/accounts/5WX01234/complex-orders?page-offset=10&per-page=10", nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("User-Agent", "tastytrade-docs-example/1.0")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(out))
}import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.cert.tastyworks.com/accounts/5WX01234/complex-orders?page-offset=10&per-page=10"))
.header("Authorization", "Bearer YOUR_ACCESS_TOKEN")
.header("User-Agent", "tastytrade-docs-example/1.0")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());Parameters
| Name | In | Type | Description |
|---|---|---|---|
| account_number* | path | string | e.g. "5WX01234" |
| page-offset | query | integer | e.g. 10 |
| per-page | query | integer | e.g. 10 |
Responses
Example response
{
"data": {
"items": [
{
"id": "2000010530",
"account-number": "5WX01234",
"ratio-price-comparator": "lte",
"ratio-price-is-threshold-based-on-notional": false,
"ratio-price-threshold": "1.25",
"terminal-at": "2024-07-31T16:50:23.417+00:00",
"type": "OTOCO",
"related-orders": [
{
"id": "abc123",
"complex-order-id": "abc123",
"complex-order-tag": "string",
"replaces-order-id": "abc123",
"replacing-order-id": "abc123",
"status": "string"
}
],
"orders": [
{
"id": "abc123",
"account-number": "5WX01234",
"cancel-user-id": "abc123",
"cancel-username": "string",
"cancellable": true,
"cancelled-at": "2024-01-15T14:30:00.000Z",
"complex-order-id": "abc123",
"complex-order-tag": "string",
"confirmation-status": "string",
"contingent-status": "string",
"editable": true,
"edited": true,
"external-identifier": "string",
"global-request-id": "abc123",
"gtc-date": "2024-01-15",
"in-flight-at": "2024-01-15T14:30:00.000Z",
"liquidity-pool-instrument-type": "Equity",
"live-at": "2024-01-15T14:30:00.000Z",
"max-value-per-liquidity-allocation-fill": "100.00",
"order-type": "string",
"preflight-id": "abc123",
"price": "100.00",
"price-effect": "100.00",
"received-at": "2024-01-15T14:30:00.000Z",
"reject-reason": "string",
"replaces-order-id": "abc123",
"replacing-order-id": "abc123",
"size": "string",
"source": "string",
"status": "string",
"stop-trigger": "string",
"terminal-at": "2024-01-15T14:30:00.000Z",
"time-in-force": "string",
"underlying-instrument-type": "Equity",
"underlying-symbol": "AAPL",
"updated-at": "2024-01-15T14:30:00.000Z",
"user-id": "abc123",
"username": "string",
"value": "100.00",
"value-effect": "100.00",
"legs": [],
"order-rule": {}
}
],
"trigger-order": {
"id": "abc123",
"account-number": "5WX01234",
"cancel-user-id": "abc123",
"cancel-username": "string",
"cancellable": true,
"cancelled-at": "2024-01-15T14:30:00.000Z",
"complex-order-id": "abc123",
"complex-order-tag": "string",
"confirmation-status": "string",
"contingent-status": "string",
"editable": true,
"edited": true,
"external-identifier": "string",
"global-request-id": "abc123",
"gtc-date": "2024-01-15",
"in-flight-at": "2024-01-15T14:30:00.000Z",
"liquidity-pool-instrument-type": "Equity",
"live-at": "2024-01-15T14:30:00.000Z",
"max-value-per-liquidity-allocation-fill": "100.00",
"order-type": "string",
"preflight-id": "abc123",
"price": "100.00",
"price-effect": "100.00",
"received-at": "2024-01-15T14:30:00.000Z",
"reject-reason": "string",
"replaces-order-id": "abc123",
"replacing-order-id": "abc123",
"size": "string",
"source": "string",
"status": "string",
"stop-trigger": "string",
"terminal-at": "2024-01-15T14:30:00.000Z",
"time-in-force": "string",
"underlying-instrument-type": "Equity",
"underlying-symbol": "AAPL",
"updated-at": "2024-01-15T14:30:00.000Z",
"user-id": "abc123",
"username": "string",
"value": "100.00",
"value-effect": "100.00",
"legs": [
{}
],
"order-rule": {
"cancel-at": "2024-01-15T14:30:00.000Z",
"cancelled-at": "2024-01-15T14:30:00.000Z",
"route-after": "2024-01-15T14:30:00.000Z",
"routed-at": "2024-01-15T14:30:00.000Z",
"order-conditions": []
}
}
}
]
},
"context": "/accounts/{account_number}/complex-orders",
"pagination": {
"per-page": 0,
"page-offset": 0,
"item-offset": 0,
"total-items": 0,
"total-pages": 0,
"current-item-count": 0
}
}Schema
datarequiredobjectitemsrequiredarray<object>{10 fields}
contextrequiredstringexample:
"/accounts/{account_number}/complex-orders"paginationobjectPaging metadata, present on paginated list responses.
per-pageintegerpage-offsetintegeritem-offsetintegertotal-itemsintegertotal-pagesintegercurrent-item-countinteger
Example response
{
"error": {
"code": "unauthorized",
"message": "No valid access token was provided; access tokens expire after 15 minutes."
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "not_permitted",
"message": "User not permitted access"
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "string",
"message": "string",
"errors": [
{
"code": "string",
"message": "string",
"domain": "string"
}
]
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "string",
"message": "string",
"errors": [
{
"code": "string",
"message": "string",
"domain": "string"
}
]
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Related
- Rate-limit class:
read· idempotent — Rate limits & backoff - Error reference — codes, causes, and fixes
Agents: this page is also Markdown (with the embedded OpenAPI definition) — append .md or send Accept: text/markdown. Index at /llms.txt.