Close a routed position across both legs of a market link
Sells the holdings on each leg of an approved market link, at a per-leg floor price derived from that leg’s best bid minus slippage_cents (never below 0.01). Holdings are rounded down to the venue’s share precision, and a leg with less than 0.01 sellable is skipped.
leg_caps is fail-closed: if you send it, a leg with no matching entry is excluded from the close entirely rather than closed in full.
Like route-buy, this is a 200 with status: submitting and per-leg error strings; it is gated by ROUTED_EXECUTION_ENABLED.
Auth & scope. Requires the mutation gate; per-leg trade:execute and provider checks happen on each child order.
curl --request POST \
--url https://execution.kairos.trade/orders/route-close \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-Secret: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"provider": "<string>",
"market_id": "<string>",
"outcome": "<string>",
"slippage_cents": 5,
"leg_caps": [
{
"provider": "<string>",
"quantity": "<string>"
}
]
}
'import requests
url = "https://execution.kairos.trade/orders/route-close"
payload = {
"provider": "<string>",
"market_id": "<string>",
"outcome": "<string>",
"slippage_cents": 5,
"leg_caps": [
{
"provider": "<string>",
"quantity": "<string>"
}
]
}
headers = {
"X-Client-Id": "<api-key>",
"X-Api-Key": "<api-key>",
"X-Api-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, 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>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
provider: '<string>',
market_id: '<string>',
outcome: '<string>',
slippage_cents: 5,
leg_caps: [{provider: '<string>', quantity: '<string>'}]
})
};
fetch('https://execution.kairos.trade/orders/route-close', 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/route-close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => '<string>',
'market_id' => '<string>',
'outcome' => '<string>',
'slippage_cents' => 5,
'leg_caps' => [
[
'provider' => '<string>',
'quantity' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://execution.kairos.trade/orders/route-close"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"market_id\": \"<string>\",\n \"outcome\": \"<string>\",\n \"slippage_cents\": 5,\n \"leg_caps\": [\n {\n \"provider\": \"<string>\",\n \"quantity\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("X-Api-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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/route-close")
.header("X-Client-Id", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("X-Api-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"market_id\": \"<string>\",\n \"outcome\": \"<string>\",\n \"slippage_cents\": 5,\n \"leg_caps\": [\n {\n \"provider\": \"<string>\",\n \"quantity\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://execution.kairos.trade/orders/route-close")
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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"market_id\": \"<string>\",\n \"outcome\": \"<string>\",\n \"slippage_cents\": 5,\n \"leg_caps\": [\n {\n \"provider\": \"<string>\",\n \"quantity\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"route_order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "submitting",
"closing": "<string>",
"legs": [
{
"provider": "<string>",
"holdings": "<string>",
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"floor_price": "<string>",
"error": "<string>"
}
],
"notes": [
"<string>"
]
}{
"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.
Body
Body for POST /orders/route-close.
yes, no Defaults to 5. Must be in [1, 99] if provided.
Per-venue size caps. FAIL-CLOSED: when leg_caps is present, any leg with no matching entry is EXCLUDED from the close entirely rather than closed in full.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://execution.kairos.trade/orders/route-close \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-Secret: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"provider": "<string>",
"market_id": "<string>",
"outcome": "<string>",
"slippage_cents": 5,
"leg_caps": [
{
"provider": "<string>",
"quantity": "<string>"
}
]
}
'import requests
url = "https://execution.kairos.trade/orders/route-close"
payload = {
"provider": "<string>",
"market_id": "<string>",
"outcome": "<string>",
"slippage_cents": 5,
"leg_caps": [
{
"provider": "<string>",
"quantity": "<string>"
}
]
}
headers = {
"X-Client-Id": "<api-key>",
"X-Api-Key": "<api-key>",
"X-Api-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, 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>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
provider: '<string>',
market_id: '<string>',
outcome: '<string>',
slippage_cents: 5,
leg_caps: [{provider: '<string>', quantity: '<string>'}]
})
};
fetch('https://execution.kairos.trade/orders/route-close', 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/route-close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'provider' => '<string>',
'market_id' => '<string>',
'outcome' => '<string>',
'slippage_cents' => 5,
'leg_caps' => [
[
'provider' => '<string>',
'quantity' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://execution.kairos.trade/orders/route-close"
payload := strings.NewReader("{\n \"provider\": \"<string>\",\n \"market_id\": \"<string>\",\n \"outcome\": \"<string>\",\n \"slippage_cents\": 5,\n \"leg_caps\": [\n {\n \"provider\": \"<string>\",\n \"quantity\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("X-Api-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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/route-close")
.header("X-Client-Id", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("X-Api-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"<string>\",\n \"market_id\": \"<string>\",\n \"outcome\": \"<string>\",\n \"slippage_cents\": 5,\n \"leg_caps\": [\n {\n \"provider\": \"<string>\",\n \"quantity\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://execution.kairos.trade/orders/route-close")
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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"<string>\",\n \"market_id\": \"<string>\",\n \"outcome\": \"<string>\",\n \"slippage_cents\": 5,\n \"leg_caps\": [\n {\n \"provider\": \"<string>\",\n \"quantity\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"route_order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "submitting",
"closing": "<string>",
"legs": [
{
"provider": "<string>",
"holdings": "<string>",
"order_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"floor_price": "<string>",
"error": "<string>"
}
],
"notes": [
"<string>"
]
}{
"error": "Unauthorized"
}
