Cancel a single order
Cancels one order by internal id. Polymarket cancellation is an L2 API-key (HMAC) operation on the venue side, so no EOA/wallet signature is required — this works identically for custodial and external-signing orders.
This endpoint almost always returns 200, even on failure to cancel. success: false with a message covers: the order is already terminal (filled/cancelled/expired/failed), or the venue currently refuses the cancel (still live — retry). Non-2xx status codes are reserved for auth/ownership/not-found/infrastructure failures, not “the cancel didn’t happen.”
Cancel-before-submit race. If the order hasn’t reached the exchange yet (still pending/queued), it is cancelled locally via an atomic conditional update that races safely against the in-flight submission. If the submission wins that race (order mid-submission), the response is success: false asking the caller to retry shortly.
Fill-during-cancel. A venue acknowledgement is followed by terminal fill verification. Until the response carries terminal_fill_verification.state: complete, it returns success: false and consumers must keep protection active. The completed receipt’s final_filled_quantity is the authoritative venue cumulative (never the latest fill delta), including explicit zero, and is published only after the corresponding Trade/Position fold. Kalshi may complete this barrier synchronously; other venues normally complete through the polling worker and expose the retained receipt on retry or GET /orders/{order_id}.
Auth & scope. Requires trade:execute and ownership of the order (403 otherwise).
curl --request POST \
--url https://execution.kairos.trade/orders/{order_id}/cancel \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-Secret: <api-key>' \
--header 'X-Client-Id: <api-key>'import requests
url = "https://execution.kairos.trade/orders/{order_id}/cancel"
headers = {
"X-Client-Id": "<api-key>",
"X-Api-Key": "<api-key>",
"X-Api-Secret": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'X-Api-Secret': '<api-key>'
}
};
fetch('https://execution.kairos.trade/orders/{order_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://execution.kairos.trade/orders/{order_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>",
"X-Api-Secret: <api-key>",
"X-Client-Id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://execution.kairos.trade/orders/{order_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("X-Api-Secret", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://execution.kairos.trade/orders/{order_id}/cancel")
.header("X-Client-Id", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("X-Api-Secret", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://execution.kairos.trade/orders/{order_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["X-Api-Secret"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"venue_reconciled": true,
"message": "<string>",
"filled_quantity": "<string>",
"avg_fill_price": "<string>",
"reconciled_position": {
"exchange_id": "kalshi",
"market_id": "<string>",
"token_id": "<string>",
"outcome": "<string>",
"net_size": "<string>",
"base_established": true,
"market_resolved": true
},
"terminal_fill_verification": {
"state": "pending",
"exchange_order_id": "<string>",
"reason": "explicit_cancel",
"target_status": "cancelled",
"started_at": "2023-11-07T05:31:56Z",
"final_filled_quantity": "<string>",
"verified_at": "2023-11-07T05:31:56Z"
}
}{
"error": "Unauthorized"
}Authorizations
Credential client id (kairos_ck_...). Must be sent together with X-Api-Key and X-Api-Secret.
64-char hex API key.
64-char hex API secret.
Path Parameters
Internal Kairos order id.
Response
Cancel outcome. Check success — a 200 does not guarantee the order was actually cancelled (see description).
Response for POST /orders/{order_id}/cancel. Returned with HTTP 200 even when success is false.
Whether cancellation and terminal fill verification are both complete. A venue DELETE acknowledgement alone still returns false while verification is pending.
True only when a venue-final snapshot was observed and its exact cumulative fill has passed through Kairos' position fold. Currently authoritative for Kalshi.
Human-readable outcome detail, e.g. "Order cancelled on exchange" or "Order is being submitted to exchange. Please try again in a moment."
Total cumulative filled quantity, decimal string, when terminal verification is complete. Omitted while pending or unknown; do not infer omitted as zero. The durable receipt repeats this exact cumulative in final_filled_quantity.
Average fill price (decimal, 0..1) of any portion that filled before the cancel landed. Omitted when nothing filled or unknown.
Exact post-fold position authority. A reconciled order may omit this object, either because nothing filled or because the durable position projection could not be proven within the cancel budget; the cancel itself is still confirmed. Omission is never proof that the portfolio is flat.
Show child attributes
Show child attributes
Pending or completed durable receipt for the exact venue-order generation. A pending response is not a confirmed cancellation even when the venue acknowledged DELETE.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://execution.kairos.trade/orders/{order_id}/cancel \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-Secret: <api-key>' \
--header 'X-Client-Id: <api-key>'import requests
url = "https://execution.kairos.trade/orders/{order_id}/cancel"
headers = {
"X-Client-Id": "<api-key>",
"X-Api-Key": "<api-key>",
"X-Api-Secret": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'X-Api-Secret': '<api-key>'
}
};
fetch('https://execution.kairos.trade/orders/{order_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://execution.kairos.trade/orders/{order_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>",
"X-Api-Secret: <api-key>",
"X-Client-Id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://execution.kairos.trade/orders/{order_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("X-Api-Secret", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://execution.kairos.trade/orders/{order_id}/cancel")
.header("X-Client-Id", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("X-Api-Secret", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://execution.kairos.trade/orders/{order_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["X-Api-Secret"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"venue_reconciled": true,
"message": "<string>",
"filled_quantity": "<string>",
"avg_fill_price": "<string>",
"reconciled_position": {
"exchange_id": "kalshi",
"market_id": "<string>",
"token_id": "<string>",
"outcome": "<string>",
"net_size": "<string>",
"base_established": true,
"market_resolved": true
},
"terminal_fill_verification": {
"state": "pending",
"exchange_order_id": "<string>",
"reason": "explicit_cancel",
"target_status": "cancelled",
"started_at": "2023-11-07T05:31:56Z",
"final_filled_quantity": "<string>",
"verified_at": "2023-11-07T05:31:56Z"
}
}{
"error": "Unauthorized"
}
