Cancel multiple orders [Private]

Cancel several open orders at once. Returns confirmation upon success.

📘

To call any private endpoint, headers should include authorization key(s).

You may use a single API key or a public-private key pair based on your current tasks. Here you may find typical Header configurations for both options.

Method name:/v4/order/private/cancel/multi
Request type:POST

Data dictionary

NameTypeParameter typeRequiredRangeDescription
orderIdsstringBODYYES-Should be a unique order id (UUID format). For example, c7fc5b2b-bd9d-48c1-a458-a83412669cf4.

📘

If one or several orders from the batch have been traded or closed, the system will notify of this while still closing the remaining open orders.

Exemplary request

You should receive an order id in the response when creating orders or you can get its id using Get private orders history or Get active client orders. Pack all the id of orders to cancel in an orderIds array in the body of the request::

const apiKey = "YOUR_API_KEY"; // put here your Api key

const url = "https://api.kuna.io";
const path = "/v4/order/private/cancel";
const body = {
    "orderIds": [
        "4a930fa5-a1dc-446e-8d52-59a27264ae98",
        "8256e662-a02c-4249-aa81-12d098c2dc2f",
        "9195d574-1692-44b0-b621-33c53edb4d87"
    ],
};

const options = {
    method: "POST",
    headers: {
        accept: "application/json",
        "Content-Type": "application/json",
        "api-key": apiKey,
    },
    body: JSON.stringify(body),
};

fetch(url + path, options)
    .then((response) => response.json())
    .then((showResponse) => console.log(showResponse));
import requests

api_key = "YOUR_API_KEY"  # put here your Api key

url = "https://api.kuna.io"
path = "/v4/order/private/cancel"
headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "api-key": api_key,
}
body = {
    "orderIds": [
        "4a930fa5-a1dc-446e-8d52-59a27264ae98",
        "8256e662-a02c-4249-aa81-12d098c2dc2f",
        "9195d574-1692-44b0-b621-33c53edb4d87"
    ],
}

request = requests.post(url + path, headers=headers, json=body)
print(request.json())

How to call private endpoints here

Swagger here

Response

[
   {
       "id": "c7fc5b2b-bd9d-48c1-a458-a83412669fe2",   // Unique identifier of a canceled order
       "success": true                                 // Status for this order
   },
   {
       "id": "a3ec5b2b-bd9d-48c1-a458-a83412669ra4",
       "success": true              
  }
]