Cancel order
Cancels an existing order identified by its internal order ID.
DELETE
/v1/broker/orders/cancel/{order-id}Request
Headers
| Field | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Access token in Bearer ACCESS_TOKEN format |
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
order-id | integer | Yes | Internal identifier of the order to cancel. |
Not applicable: Query Parameters, Body.
Response
2XX Success
| Field | Type | Description |
|---|---|---|
status_code | string | Result of the cancellation. Possible value: CANCELLED. |
message | string | Human-readable description of the result. |
Error Codes
| Status | Description |
|---|---|
400 | Bad Request — no order exists with the given order-id, the order is already processed and cannot be cancelled, or the cancellation was rejected by the market |
401 | Unauthorized — invalid or missing access token |
403 | Forbidden — the token does not have permission to access this resource |
500 | Internal Server Error |
Error structure:
{
"code": "invalid_request",
"description": "Order with ID: 984512 is already processed and has the following state: FILLED"
}
Code Example
- cURL
- JavaScript
- Python
- Node.js
curl -X DELETE https://b2b.allaria.dev/v1/broker/orders/cancel/984512 \
-H "Authorization: Bearer ACCESS_TOKEN"
const orderId = 984512;
const response = await fetch(
`https://b2b.allaria.dev/v1/broker/orders/cancel/${orderId}`,
{
method: 'DELETE',
headers: { 'Authorization': 'Bearer ACCESS_TOKEN' }
}
);
const data = await response.json();
console.log(data);
import requests
order_id = 984512
response = requests.delete(
f'https://b2b.allaria.dev/v1/broker/orders/cancel/{order_id}',
headers={ 'Authorization': 'Bearer ACCESS_TOKEN' }
)
data = response.json()
print(data)
const axios = require('axios');
const orderId = 984512;
const response = await axios.delete(
`https://b2b.allaria.dev/v1/broker/orders/cancel/${orderId}`,
{ headers: { Authorization: 'Bearer ACCESS_TOKEN' } }
);
console.log(response.data);
2XX Success
{
"status_code": "CANCELLED",
"message": "The order was cancelled successfully."
}