POST Cancel Orders
- NT8
- Tradovate
Cancel orders by account and/or instrument NT8
Cancels working orders for one account, optionally limited to a specific instrument.
Endpoint
POST /v1/api/accounts/{account}/orders/cancel
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Name of account in NT8 |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Optional | Optional name of instrument |
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/accounts/Sim101/orders/cancel"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
data = {
# "instrument": "MES 12-25"
}
try:
response = requests.post(url, headers=headers, json=data)
print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
print(f"An error occurred: {e}")
const token = 'my-secret-token';
const url = "https://app.crosstrade.io/v1/api/accounts/Sim101/orders/cancel";
const data = {
// instrument: "MES 12-25"
};
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://app.crosstrade.io/v1/api/accounts/Sim101/orders/cancel" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Response
- 200
- 400
- 401
- 403
- 408
- 429
- 500
{
"orderIds": [
"adb3868865de4b59b0e147b8300e4a29",
"2141df9fc0254ba9b34c8a5e38722249",
"16f6774e302748ce962f2d60b58b2eb1"
],
"success": true
}
{
"error": "The request timed out, please check connection to NT8 Add-On."
}
{
"error": "Invalid bearer token"
}
{
"error": "Endpoint not available"
}
{
"error": "Client not ready to receive requests, disconnected."
}
// retryAfter is integer seconds; also sent as Retry-After.
{
"error": "Rate limit exceeded",
"retryAfter": 1
}
{
"success": false,
"error": "internal_error"
}
Success field types
| Field | Type | Description |
|---|---|---|
success | boolean | Request outcome. |
orderIds | array of strings | Orders submitted for cancellation; may be empty. |
Platform nuances
When instrument is omitted, all working orders across the entire account are cancelled. When instrument is provided, only orders for that instrument are affected. Use the instrument filter when you want to cancel protective orders on a specific position without touching orders on other instruments in the same account.
WebSocket API
This request can also be made over the WebSocket API. The account path parameter and request body fields are all passed inside args.
{
"action": "rpc",
"id": "my-request-id",
"api": "CancelOrders",
"args": {
"account": "Sim101",
"instrument": "ES 12-26"
}
}
Cancel orders by account and/or instrument Tradovate
Cancels working orders on one linked Tradovate account, optionally narrowed to one instrument. No NinjaTrader add-on is involved: the command runs server-side with the same validation, Account Manager locks, and Trade Copier fan-out as a webhook signal.
Endpoint
POST /v1/api/tv/accounts/{account}/orders/cancel
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Tradovate account name, for example DEMO12345678. |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Optional | Limits cancellation to one instrument. Accepts continuous (ES1!), NT8 (ES 12-26), or Tradovate (ESZ6) forms. |
Send {} to cancel every working order on the account.
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/orders/cancel"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
data = {
# "instrument": "ES1!"
}
try:
response = requests.post(url, headers=headers, json=data)
print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
print(f"An error occurred: {e}")
const token = 'my-secret-token';
const url = "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/orders/cancel";
const data = {
// instrument: "ES1!"
};
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/orders/cancel" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Response
The response is the response envelope with api set to cancel_orders_scoped. Its response reports the cancellation count, cancelled order ids, and per-order results.
- 200
- 400
- 401
- 403
- 429
- 500
- 502
- 503
{
"success": true,
"destination": "tradovate",
"api": "cancel_orders_scoped",
"account": "DEMO12345678",
"instrument": "ESZ6",
"response": {
"cancelled": 1,
"orders": [
123456789
],
"results": [
{
"orderId": 123456789,
"success": true
}
]
},
"durationMs": 214
}
{
"error": "Invalid request"
}
{
"success": false,
"error": "inactive_subscription"
}
{
"success": false,
"error": "tradovate_not_linked"
}
// retryAfter is integer seconds; also sent as Retry-After.
{
"success": false,
"error": "rate_limited",
"detail": "CrossTrade API rate limit exceeded (180 requests/min per user). Retry after 1s.",
"retryAfter": 1
}
{
"success": false,
"error": "internal_error"
}
{
"success": false,
"error": "tradovate_unavailable",
"detail": "Tradovate is temporarily unavailable. Please try again shortly."
}
{
"success": false,
"error": "temporarily_disabled"
}
Success field types
| Field | Type | Description |
|---|---|---|
success | boolean | Overall cancellation outcome. |
destination, api, account | string | Dispatcher and account identity. |
instrument | string or null | Optional instrument filter. |
durationMs | integer | Duration in milliseconds. |
response | object | Cancellation result. |
response.cancelled | integer | Cancellation count. |
response.orders | array of integers | Matched order IDs. |
response.detail | string | Optional no-match explanation. |
response.results | array of objects | Per-order outcomes, when present. |
response.results[].orderId | integer | Broker order ID. |
response.results[].success | boolean | Per-order outcome. |
Platform nuances
- Omitting
instrumentaffects every working order on the account. Include it to avoid touching orders on other contracts. - Successfully cancelled copied leader orders are replayed to mapped follower orders.
- Partial cancellation failures are surfaced rather than reported as a clean sweep.
- Account Manager locks apply. On failure, the response envelope has
success: falseand anerrormessage.
See the Tradovate API overview for the full field grammar, mutation safety guarantees, and error table.