tastytradeDeveloper Docs
Legacy ↗

API Reference / Orders

Submit Order

postAccountsAccountNumberOrders
post/accounts/{account_number}/ordersMoney-moving

Money-moving. Dry-run first, send an ext-client-order-id, and confirm before submitting. See Idempotency & retries.

Base URL: https://api.cert.tastyworks.com (Sandbox) · https://api.tastyworks.com (Production)

Submits an order for the account and routes it to an exchange. The response includes the new order id, its status (often `Routed`), and the buying-power and fee impact. Run the same body through the dry-run endpoint first to confirm it will be accepted.

Code samples

curl -X POST 'https://api.cert.tastyworks.com/accounts/5WX01234/orders' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'User-Agent: tastytrade-docs-example/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
  "gtc-date": "2025-12-01",
  "order-type": "Limit",
  "time-in-force": "Day",
  "stop-trigger": "145.0",
  "price": "150.25",
  "price-effect": "Debit",
  "value": "10.0",
  "value-effect": "Debit",
  "automated-source": true,
  "external-identifier": "string",
  "max-value-per-liquidity-allocation-fill": "100.00",
  "partition-key": "string",
  "preflight-id": "abc123",
  "source": "my-api-code",
  "legs": [
    {
      "action": "Allocate",
      "instrument-type": "Cryptocurrency",
      "quantity": "1",
      "symbol": "AAPL"
    }
  ],
  "rules": {
    "cancel-at": "2024-01-15T14:30:00.000Z",
    "conditions": [
      {
        "action": "cancel",
        "instrument-type": "Equity",
        "symbol": "AAPL",
        "comparator": "gte",
        "indicator": "last",
        "threshold": "string",
        "price-components": [
          {
            "instrument-type": "Bond",
            "quantity": "1",
            "quantity-direction": "Long",
            "symbol": "AAPL"
          }
        ]
      }
    ],
    "route-after": "2024-01-15T14:30:00.000Z"
  },
  "advanced-instructions": {
    "strict-position-effect-validation": true
  }
}'

Parameters

NameInTypeDescription
account_number*pathstring
e.g. "5WX01234"

Request bodyrequiredapplication/json

Example

{
  "gtc-date": "2025-12-01",
  "order-type": "Limit",
  "time-in-force": "Day",
  "stop-trigger": "145.0",
  "price": "150.25",
  "price-effect": "Debit",
  "value": "10.0",
  "value-effect": "Debit",
  "automated-source": true,
  "external-identifier": "string",
  "max-value-per-liquidity-allocation-fill": "100.00",
  "partition-key": "string",
  "preflight-id": "abc123",
  "source": "my-api-code",
  "legs": [
    {
      "action": "Allocate",
      "instrument-type": "Cryptocurrency",
      "quantity": "1",
      "symbol": "AAPL"
    }
  ],
  "rules": {
    "cancel-at": "2024-01-15T14:30:00.000Z",
    "conditions": [
      {
        "action": "cancel",
        "instrument-type": "Equity",
        "symbol": "AAPL",
        "comparator": "gte",
        "indicator": "last",
        "threshold": "string",
        "price-components": [
          {
            "instrument-type": "Bond",
            "quantity": "1",
            "quantity-direction": "Long",
            "symbol": "AAPL"
          }
        ]
      }
    ],
    "route-after": "2024-01-15T14:30:00.000Z"
  },
  "advanced-instructions": {
    "strict-position-effect-validation": true
  }
}

Schema

  • gtc-datestring <date>

    The date in which a GTD order will expire. Can only be provided if time-in-force is GTD.

    example: "2025-12-01"

  • order-typerequiredstring

    The type of order in regards to the price. i.e. `Limit`, `Liquidity Allocation`, `Market`, `Marketable Limit`, `Notional Market`, `Stop` or `Stop Limit`

    enum: Limit, Liquidity Allocation, Market, Marketable Limit, Notional Market, Stop, Stop Limit

    example: "Limit"

  • time-in-forcerequiredstring

    The length in time before the order expires. i.e. `Day`, `Ext`, `Ext Overnight`, `GTC`, `GTC Ext`, `GTC Ext Overnight`, `GTD` or `IOC`

    enum: Day, Ext, Ext Overnight, GTC, GTC Ext, GTC Ext Overnight, GTD, IOC

    example: "Day"

  • stop-triggerstring <decimal>

    The price trigger at which a stop or stop-limit order becomes valid. Decimal value serialized as a JSON string (e.g. "150.25").

    example: "145.0"

  • pricestring <decimal>

    The price of the Order. Required for limit and stop-limit orders. Decimal value serialized as a JSON string (e.g. "150.25").

    example: "150.25"

  • price-effectstring

    If pay or receive payment for placing the order. i.e. `Credit` or `Debit`

    enum: Credit, Debit

    example: "Debit"

  • valuestring <decimal>

    The notional value of the Order, required for notional market orders. Decimal value serialized as a JSON string (e.g. "150.25").

    example: "10.0"

  • value-effectstring

    If pay or receive payment for placing the notional market order. i.e. `Credit` or `Debit`

    enum: Credit, Debit

    example: "Debit"

  • automated-sourceboolean

    If the order was placed from an automated source

  • external-identifierstring

    External identifier for the order

  • max-value-per-liquidity-allocation-fillstring <decimal>

    Max value per liquidity allocation fill Decimal value serialized as a JSON string (e.g. "150.25").

  • partition-keystring

    Account partition key

  • preflight-idstring

    Transient order identifier used for matching preflight errors to an individual order

  • sourcestring

    The source the order is coming from

    example: "my-api-code"

  • legsrequiredarray<object>
    • actionrequiredstring

      The directional action of the leg. i.e. `Allocate`, `Buy`, `Buy to Close`, `Buy to Open`, `Sell`, `Sell to Close` or `Sell to Open`. Note: `Buy` and `Sell` are only applicable to Futures orders.

      enum: Allocate, Buy, Buy to Close, Buy to Open, Sell, Sell to Close, Sell to Open

    • instrument-typerequiredstring

      The type of Instrument. i.e. `Cryptocurrency`, `Equity`, `Equity Offering`, `Equity Option`, `Fixed Income Security`, `Future`, `Future Option` or `Liquidity Pool`

      enum: Cryptocurrency, Equity, Equity Offering, Equity Option, Fixed Income Security, Future, Future Option, Liquidity Pool

    • quantitystring <decimal>

      The size of the contract. Required for all orders but notional market. Decimal value serialized as a JSON string (e.g. "150.25").

    • symbolrequiredstring

      The Stock Ticker Symbol `AAPL`, OCC Option Symbol `AAPL 191004P00275000`, \ TW Future Symbol `/ESZ9`, or TW Future Option Symbol `./ESZ9 EW4U9 190927P2975`

  • rulesobject
    • cancel-atstring <date-time>

      Latest time an order should be canceled at

    • conditionsarray<object>{7 fields}
    • route-afterstring <date-time>

      Earliest time an order should route at

  • advanced-instructionsobject
    • strict-position-effect-validationboolean

      If the order should be rejected the open/close position effect is not valid

Responses

201The order was accepted and routed. The response wraps the order plus its buying-power effect and fee calculation.application/json

Example response

{
  "data": {
    "buying-power-effect": {
      "change-in-margin-requirement": "300.0",
      "change-in-margin-requirement-effect": "Debit",
      "change-in-buying-power": "102.302",
      "change-in-buying-power-effect": "Debit",
      "current-buying-power": "8995981.2613",
      "current-buying-power-effect": "Credit",
      "new-buying-power": "8995878.9593",
      "new-buying-power-effect": "Credit",
      "isolated-order-margin-requirement": "300.0",
      "isolated-order-margin-requirement-effect": "Debit",
      "is-spread": true,
      "impact": "102.302",
      "effect": "Debit"
    },
    "closing-fee-calculation": "string",
    "complex-order": {
      "id": "abc123",
      "account-number": "5WX01234",
      "ratio-price-comparator": "100.00",
      "ratio-price-is-threshold-based-on-notional": true,
      "ratio-price-threshold": "100.00",
      "terminal-at": "2024-01-15T14:30:00.000Z",
      "type": "string",
      "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": {
            "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": []
          }
        }
      ],
      "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": [
          {
            "action": "string",
            "instrument-type": "Equity",
            "quantity": "1",
            "remaining-quantity": "1",
            "symbol": "AAPL",
            "fills": []
          }
        ],
        "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": [
            {}
          ]
        }
      }
    },
    "errors": [
      {
        "code": "string",
        "message": "string",
        "preflight-id": "abc123"
      }
    ],
    "fee-calculation": {
      "regulatory-fees": "0.102",
      "regulatory-fees-effect": "Debit",
      "clearing-fees": "0.2",
      "clearing-fees-effect": "Debit",
      "commission": "2.0",
      "commission-effect": "Debit",
      "proprietary-index-option-fees": "0.0",
      "proprietary-index-option-fees-effect": "Debit",
      "total-fees": "2.302",
      "total-fees-effect": "Debit"
    },
    "notes": [
      {
        "code": "string",
        "message": "string",
        "preflight-id": "abc123",
        "url": "string"
      }
    ],
    "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": [
        {
          "action": "string",
          "instrument-type": "Equity",
          "quantity": "1",
          "remaining-quantity": "1",
          "symbol": "AAPL",
          "fills": [
            {}
          ]
        }
      ],
      "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": [
          {
            "id": "abc123",
            "action": "string",
            "comparator": "string",
            "indicator": "string",
            "instrument-type": "Equity",
            "is-threshold-based-on-notional": true,
            "symbol": "AAPL",
            "threshold": "string",
            "triggered-at": "2024-01-15T14:30:00.000Z",
            "triggered-value": "100.00",
            "price-components": []
          }
        ]
      }
    },
    "warnings": [
      {
        "code": "string",
        "message": "string",
        "preflight-id": "abc123"
      }
    ]
  },
  "context": "/accounts/{account_number}/orders"
}

Schema

  • datarequiredobject (PlacedOrderResponse)

    The response returned when placing, editing, or dry-running an order or complex order. Contains the resulting `order` (or `complex-order`), the `buying-power-effect`, the `fee-calculation`, and any `warnings`, `errors`, or `notes` produced by the preflight checks.

    • buying-power-effectobject{13 fields}

      Details of the order's impact on the account's buying power, including the change in buying power and its direction. A JSON object (upstream types this field as a string; attested responses return this object, with decimal values serialized as JSON strings).

    • closing-fee-calculationstring

      An estimate of the fees to expect when later closing the position this order would open. Provided as a convenience; not applied to this order.

    • complex-orderobject{10 fields}
    • errorsarray<object>{3 fields}

      Preflight errors explaining why the order failed validation, each with a `code`, `message`, and `preflight-id`.

    • fee-calculationobject{10 fields}

      An estimate of the fees the order would incur if filled, broken into regulatory, clearing, commission, and other categories and totaled at the end. A JSON object (upstream types this field as a string; attested responses return this object, with decimal values serialized as JSON strings).

    • notesarray<object>{4 fields}

      Informational notes about the order, each optionally including a `url` for more detail.

    • orderobject{42 fields}
    • warningsarray<object>{3 fields}

      Informational warnings produced by a dry-run or submission. A warning may indicate the order would be rejected if routed, or that the market is closed.

  • contextrequiredstring

    example: "/accounts/{account_number}/orders"

401Missing or expired access token, or a missing/malformed `User-Agent` header.application/json

Example response

{
  "error": {
    "code": "unauthorized",
    "message": "No valid access token was provided; access tokens expire after 15 minutes."
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

403The token's scope or the account authority does not permit placing orders on this account.application/json

Example response

{
  "error": {
    "code": "not_permitted",
    "message": "User not permitted access"
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

404The account number does not exist or is not accessible with this token.application/json

Example response

{
  "error": {
    "code": "string",
    "message": "string",
    "errors": [
      {
        "code": "string",
        "message": "string",
        "domain": "string"
      }
    ]
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

422The order failed one or more preflight checks (for example `cant_buy_for_credit`, an invalid symbol, or insufficient buying power). The reason is in the response JSON's `error.message` and `error.errors[]`.application/json

Example response

{
  "error": {
    "code": "preflight_check_failure",
    "message": "One or more preflight checks failed",
    "errors": [
      {
        "code": "preflight_check_failure",
        "message": "A specific validation failed for this order."
      }
    ]
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

429Request rate exceeded. Back off exponentially and reduce your request rate.application/json

Example response

{
  "error": {
    "code": "string",
    "message": "string",
    "errors": [
      {
        "code": "string",
        "message": "string",
        "domain": "string"
      }
    ]
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

Related

Agents: this page is also Markdown (with the embedded OpenAPI definition) — append .md or send Accept: text/markdown. Index at /llms.txt.