Build with the AI Skill
Trade ItTrade ItDocs
Trades

Cancel trade

POST /api/tool/execute

Cancels a draft immediately or requests cancellation of an eligible submitted order from the brokerage.

OAuth scopes: trade:write, tool:execute

Returns: Trade

Request body

tool_name*string

Selects this API operation.

cancel_trade

Parameters for this operation.

trade_id*number | string

ID of the trade to cancel, from create_trade, create_options_trade, or get_trades.

Example request

curl https://api.tradeit.app/api/tool/execute \
  --request POST \
  --header "Authorization: Bearer $TRADE_IT_ACCESS_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "tool_name": "cancel_trade",
    "params": {
      "trade_id": 842
    }
  }'

Example response

200 OK

{
  "id": 842,
  "created_at": "2026-03-17T14:14:31.112Z",
  "updated_at": "2026-03-17T14:24:08.502Z",
  "user_id": 1,
  "asset_id": 88,
  "account_id": 304,
  "source": null,
  "image_url": null,
  "external_id": "114",
  "type": 0,
  "action": "buy",
  "direction": null,
  "total_units": 4,
  "filled_units": 0,
  "canceled_units": 0,
  "notional_amount": { "amount": 1000, "currency": "USD" },
  "execution_price": null,
  "status": "canceled",
  "order_type": "limit",
  "limit_price": { "amount": 250, "currency": "USD" },
  "stop_price": null,
  "time_in_force": "day",
  "placed_at": "2026-03-17T14:21:54.937Z",
  "executed_at": null,
  "error_message": null,
  "fee": null,
  "legs": null,
  "event": null,
  "analysis": null
}

Treat the returned trade as the latest known state and use get_trades with refresh: true when the final state matters. A non-cancelable trade returns 400 with an explanation of its current status.

Note

Cancellation is not guaranteed if an order fills while the brokerage is processing the request.

On this page