Skip to content

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

Request body

FieldTypeRequiredDescription
toolName"cancel_trade"YesSelects the cancellation operation.
params.trade_idinteger or stringYesID of the draft or submitted trade to cancel.

Example request

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

Example response

200 OK

json
{
  "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
}

Cancellation is not guaranteed if an order fills while the brokerage is processing the request. Treat the returned object 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.