Cancel Orders
Cancel a single open order by id, or cancel several open orders in one request.
For all transactions related to the private endpoint, you must authorize before sending your request.
For more information you can check our Authentication V1 article. Both endpoints require the Trade API key permission.
A 200 OK response means the cancellation was accepted for processing, not necessarily finalized. An authenticated WebSocket connection receives an order-cancelled message (type 452) once it is applied; without one, poll Get Single Order or All Orders to confirm the final status.
Cancel Order
DELETE /api/v1/order/{id}
Path Parameters
| Name | Type | Description |
|---|---|---|
| id* | long | id of the order |
Headers
| Name | Type | Description |
|---|---|---|
| X-PCK* | string | API public key. |
| X-Stamp* | integer | Current time in milliseconds since the Unix epoch (UTC). |
| X-Signature* | string | HMAC-SHA256 signature. See Authentication V1. |
| X-Nonce | integer | Optional. Backward tolerance for X-Stamp in milliseconds. Default 5000, maximum 60000. |
Request example:
/api/v1/order/123456789
- 200
- 400: not found
{"success": true, "message": "SUCCESS", "code": 0}
{"success": false, "message": "NO_ORDER_MATCHES_YOUR_REQUEST", "code": 1052}
Cancel Multiple Orders
DELETE /api/v1/order
Cancels every order id listed in the request body. Orders are cancelled one by one, not atomically — some ids can succeed while others fail.
Request Body
| Name | Type | Description |
|---|---|---|
| id* | long[] | Order ids to cancel. Must contain at least one id. |
{ "id": [123456789, 123456790, 123456791] }
Read success before uncancelledOrders. A partial failure still returns 200 OK with success: false and one entry in uncancelledOrders per id that could not be cancelled. success is true only when every id was cancelled, in which case uncancelledOrders is an empty array.
- 200: all cancelled
- 200: partial failure
- 400: empty body
{
"success": true,
"message": null,
"code": 0,
"data": {
"uncancelledOrders": []
}
}
{
"success": false,
"message": null,
"code": 0,
"data": {
"uncancelledOrders": [
{
"id": 123456790,
"code": 1052,
"message": "NO_ORDER_MATCHES_YOUR_REQUEST"
}
]
}
}
{"success": false, "message": "INVALID_REQUEST_ERROR", "code": 1038}
A missing body, an empty id array, or id: null all return the 400 above.
Code Example
- curl
- C#
# Cancel a single order
curl -X DELETE "https://api.global.btcturk.com/api/v1/order/123456789" \
-H "X-PCK: YOUR_API_PUBLIC_KEY" \
-H "X-Stamp: 1735866257711" \
-H "X-Signature: COMPUTED_SIGNATURE"
# Cancel several orders
curl -X DELETE "https://api.global.btcturk.com/api/v1/order" \
-H "X-PCK: YOUR_API_PUBLIC_KEY" \
-H "X-Stamp: 1735866257711" \
-H "X-Signature: COMPUTED_SIGNATURE" \
-H "Content-Type: application/json" \
-d '{ "id": [123456789, 123456790] }'
using var client = new HttpClient { BaseAddress = new Uri("https://api.global.btcturk.com") };
client.DefaultRequestHeaders.Add("X-PCK", apiKey);
client.DefaultRequestHeaders.Add("X-Stamp", stamp);
client.DefaultRequestHeaders.Add("X-Signature", signature);
// Cancel a single order
var single = await client.DeleteAsync("/api/v1/order/123456789");
Console.WriteLine(await single.Content.ReadAsStringAsync());
// Cancel several orders — DELETE with a body needs an explicit HttpRequestMessage
var payload = new { id = new[] { 123456789L, 123456790L } };
var request = new HttpRequestMessage(HttpMethod.Delete, "/api/v1/order")
{
Content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json")
};
var many = await client.SendAsync(request);
Console.WriteLine(await many.Content.ReadAsStringAsync());