Overview
Cancels an order.
Description

This API marks an order as cancelled, if the order has not already been successfully executed. The order continues to appear in responses to the List Orders API for the rest of that day (Eastern time). Note that no order record is deleted.

For timely updates on order status, including cancellation status, use the streaming order status API, detailed elsewhere in this documentation.

URL
https://etws.etrade.com/order/rest/cancelorder
HTTP Method: POST

Since this is a POST request, the parameters are included in the request as XML or JSON.

Request Parameters
Parameter Type Description
accountId integer Numeric account ID
orderNum integer Numeric ID for this order in the E*TRADE system
Response Properties
Property Type Description
accountId integer Numeric account ID
orderNum integer Numeric ID for this order in the E*TRADE system
cancelTime long The time the cancel request was submitted, in epoch time
resultMessage string Result message
Sample Request
Request URL
POST https://etwssandbox.etrade.com/order/sandbox/rest/cancelorder
Request Parameters - XML
<cancelOrder xmlns="http://order.etws.etrade.com">
  <cancelOrderRequest>
    <accountId>83405188</accountId>
    <orderNum>262</orderNum>
  </cancelOrderRequest>
</cancelOrder>
Request Parameters - JSON
{
  "cancelOrder": {
    "-xmlns": "http://order.etws.etrade.com",
    "cancelOrderRequest": {
      "accountId": "83405188",
      "orderNum": "262"
    }
  }
}
Sample Response - XML
<CancelOrderResponse>
  <cancelResponse>
    <accountId>83405188</accountId>
    <orderNum>262</orderNum>
    <cancelTime>1269434848649</cancelTime>
    <resultMessage>Cancel Request Placed Successfully</resultMessage>
  </cancelResponse>
</CancelOrderResponse>
Sample response – JSON
 {
  "CancelOrderResponse": {
    "cancelResponse": {
      "accountId": "83405188",
      "orderNum": "262",
      "cancelTime": "1269434848649",
      "resultMessage": "Cancel Request Placed Successfully"
    }
  }
}
Sample use cases
Some possible use-cases and workflows are described below.
Purpose Workflow Related APIs
Delete order,
List current orders
Use the List Orders API to display orders of any desired status. For open orders, display current market price and an option to cancel the order. Display the account name in the page header. List Orders, Get Quote, List Accounts
Sandbox Samples

The following is an example of a request and response in the sandbox environment. Note that the HTTP POST method is used.

Request URL
POST https://etwssandbox.etrade.com/order/sandbox/rest/cancelorder
Request XML
<cancelOrder xmlns="http://order.etws.etrade.com">
  <cancelOrderRequest>
    <accountId>83550325</accountId>
    <orderNum>262</orderNum>
  </cancelOrderRequest>
</cancelOrder>
Response
<CancelOrderResponse>
  <cancelResponse>
    <accountId>83550325</accountId>
    <orderNum>262</orderNum>
    <cancelTime>1342492932659</cancelTime>
    <resultMessage>Cancel Request Placed Successfully</resultMessage>
  </cancelResponse>
</CancelOrderResponse>
Related APIs
PLEASE READ THE IMPORTANT DISCLOSURES BELOW

By using E*TRADE API ("API") and accepting the terms of the Application Programming Interface License Agreement and the Application Programming Interface User Agreement, you agree that API may employ security policies, procedures and systems of Third Party providers which may or may not be less stringent and secure than the policies, procedures and systems of E*TRADE Securities LLC ("E*TRADE") or its affiliates. Material provided on API may have been produced by independent third parties not affiliated or endorsed by E*TRADE or its affiliates ("Third Party"). To the extent that API or Third Party providers express opinions or make recommendations, you understand that such opinions or recommendations are expressed by the Third Party provider and are not the opinions or recommendations of E*TRADE or its affiliates. E*TRADE is not responsible for the accuracy of market data displayed on API or made available by Third Party providers. There may be latency between the time an order (or other information) is submitted from API and the time the order is received by E*TRADE. The E*TRADE Two Second Execution Guarantee or any similar guarantee does not apply for orders placed through API and Third Party provider web sites. The E*TRADE CompleteTM Protection Guarantee does not apply. Orders created and submitted through API are not vetted until they are received by E*TRADE. It is possible that E*TRADE may reject an order placed through API. Please see the Application Programming Interface License Agreement and the Application Programming Interface User Agreement for more information.


The E*TRADE family of companies provides financial services including trading, investing, and related banking products and services to retail investors.


Securities products and services offered by E*TRADE Securities LLC, Member FINRA/SIPC.


System response and account access times may vary due to a variety of factors, including trading volumes, market conditions, system performance, and other factors.