Cancel order by id [Private]

Cancel an open order. Returns a success message if the target order was canceled as a result.

📘

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
Request type:POST

Data dictionary

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

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. Send the id of the created order in the body of the cancel 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 = {
    "orderId": "95722a86-1fde-417a-bf7a-10b348b36d45",
};

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.data));
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 = {
    "orderId": "95722a86-1fde-417a-bf7a-10b348b36d45",
}

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

How to call private endpoints here

Swagger here

Response

{
    "success": true
}