curl --request PUT \
--url https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger \
--header 'Content-Type: application/json' \
--header 'KALSHI-ACCESS-KEY: <api-key>' \
--header 'KALSHI-ACCESS-SIGNATURE: <api-key>' \
--header 'KALSHI-ACCESS-TIMESTAMP: <api-key>' \
--data '
{
"kind": "bracket",
"stop_loss_price": "0.5600",
"take_profit_price": "0.5600",
"trail_amount": "0.5600",
"trail_bps": 5000
}
'import requests
url = "https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger"
payload = {
"kind": "bracket",
"stop_loss_price": "0.5600",
"take_profit_price": "0.5600",
"trail_amount": "0.5600",
"trail_bps": 5000
}
headers = {
"KALSHI-ACCESS-KEY": "<api-key>",
"KALSHI-ACCESS-SIGNATURE": "<api-key>",
"KALSHI-ACCESS-TIMESTAMP": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'KALSHI-ACCESS-KEY': '<api-key>',
'KALSHI-ACCESS-SIGNATURE': '<api-key>',
'KALSHI-ACCESS-TIMESTAMP': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
kind: 'bracket',
stop_loss_price: '0.5600',
take_profit_price: '0.5600',
trail_amount: '0.5600',
trail_bps: 5000
})
};
fetch('https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger', 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://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'kind' => 'bracket',
'stop_loss_price' => '0.5600',
'take_profit_price' => '0.5600',
'trail_amount' => '0.5600',
'trail_bps' => 5000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"KALSHI-ACCESS-KEY: <api-key>",
"KALSHI-ACCESS-SIGNATURE: <api-key>",
"KALSHI-ACCESS-TIMESTAMP: <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://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger"
payload := strings.NewReader("{\n \"kind\": \"bracket\",\n \"stop_loss_price\": \"0.5600\",\n \"take_profit_price\": \"0.5600\",\n \"trail_amount\": \"0.5600\",\n \"trail_bps\": 5000\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("KALSHI-ACCESS-KEY", "<api-key>")
req.Header.Add("KALSHI-ACCESS-SIGNATURE", "<api-key>")
req.Header.Add("KALSHI-ACCESS-TIMESTAMP", "<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.put("https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger")
.header("KALSHI-ACCESS-KEY", "<api-key>")
.header("KALSHI-ACCESS-SIGNATURE", "<api-key>")
.header("KALSHI-ACCESS-TIMESTAMP", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"kind\": \"bracket\",\n \"stop_loss_price\": \"0.5600\",\n \"take_profit_price\": \"0.5600\",\n \"trail_amount\": \"0.5600\",\n \"trail_bps\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["KALSHI-ACCESS-KEY"] = '<api-key>'
request["KALSHI-ACCESS-SIGNATURE"] = '<api-key>'
request["KALSHI-ACCESS-TIMESTAMP"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"kind\": \"bracket\",\n \"stop_loss_price\": \"0.5600\",\n \"take_profit_price\": \"0.5600\",\n \"trail_amount\": \"0.5600\",\n \"trail_bps\": 5000\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"ticker": "<string>",
"kind": "bracket",
"status": "pending_on_entry",
"count": "10.00",
"filled_count": "10.00",
"created_time": "2023-11-07T05:31:56Z",
"updated_time": "2023-11-07T05:31:56Z",
"status_reason": "user_canceled",
"triggered_leg": "stop_loss",
"triggered_order_id": "<string>",
"anchor_order_id": "<string>",
"client_trigger_id": "<string>",
"stop_loss_price": "0.5600",
"take_profit_price": "0.5600",
"trail_amount": "0.5600",
"trail_bps": 123,
"watermark_price": "0.5600",
"effective_stop_price": "0.5600"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}Set Isolated Exit Trigger
Endpoint for setting a stop-loss / take-profit bracket or a trailing stop on the isolated margin position for a market. Requires an open position, closes it in full, and fires reduce-only orders.
curl --request PUT \
--url https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger \
--header 'Content-Type: application/json' \
--header 'KALSHI-ACCESS-KEY: <api-key>' \
--header 'KALSHI-ACCESS-SIGNATURE: <api-key>' \
--header 'KALSHI-ACCESS-TIMESTAMP: <api-key>' \
--data '
{
"kind": "bracket",
"stop_loss_price": "0.5600",
"take_profit_price": "0.5600",
"trail_amount": "0.5600",
"trail_bps": 5000
}
'import requests
url = "https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger"
payload = {
"kind": "bracket",
"stop_loss_price": "0.5600",
"take_profit_price": "0.5600",
"trail_amount": "0.5600",
"trail_bps": 5000
}
headers = {
"KALSHI-ACCESS-KEY": "<api-key>",
"KALSHI-ACCESS-SIGNATURE": "<api-key>",
"KALSHI-ACCESS-TIMESTAMP": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'KALSHI-ACCESS-KEY': '<api-key>',
'KALSHI-ACCESS-SIGNATURE': '<api-key>',
'KALSHI-ACCESS-TIMESTAMP': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
kind: 'bracket',
stop_loss_price: '0.5600',
take_profit_price: '0.5600',
trail_amount: '0.5600',
trail_bps: 5000
})
};
fetch('https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger', 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://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'kind' => 'bracket',
'stop_loss_price' => '0.5600',
'take_profit_price' => '0.5600',
'trail_amount' => '0.5600',
'trail_bps' => 5000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"KALSHI-ACCESS-KEY: <api-key>",
"KALSHI-ACCESS-SIGNATURE: <api-key>",
"KALSHI-ACCESS-TIMESTAMP: <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://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger"
payload := strings.NewReader("{\n \"kind\": \"bracket\",\n \"stop_loss_price\": \"0.5600\",\n \"take_profit_price\": \"0.5600\",\n \"trail_amount\": \"0.5600\",\n \"trail_bps\": 5000\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("KALSHI-ACCESS-KEY", "<api-key>")
req.Header.Add("KALSHI-ACCESS-SIGNATURE", "<api-key>")
req.Header.Add("KALSHI-ACCESS-TIMESTAMP", "<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.put("https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger")
.header("KALSHI-ACCESS-KEY", "<api-key>")
.header("KALSHI-ACCESS-SIGNATURE", "<api-key>")
.header("KALSHI-ACCESS-TIMESTAMP", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"kind\": \"bracket\",\n \"stop_loss_price\": \"0.5600\",\n \"take_profit_price\": \"0.5600\",\n \"trail_amount\": \"0.5600\",\n \"trail_bps\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external-api.kalshi.com/trade-api/v2/margin/isolated/positions/{ticker}/exit_trigger")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["KALSHI-ACCESS-KEY"] = '<api-key>'
request["KALSHI-ACCESS-SIGNATURE"] = '<api-key>'
request["KALSHI-ACCESS-TIMESTAMP"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"kind\": \"bracket\",\n \"stop_loss_price\": \"0.5600\",\n \"take_profit_price\": \"0.5600\",\n \"trail_amount\": \"0.5600\",\n \"trail_bps\": 5000\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"ticker": "<string>",
"kind": "bracket",
"status": "pending_on_entry",
"count": "10.00",
"filled_count": "10.00",
"created_time": "2023-11-07T05:31:56Z",
"updated_time": "2023-11-07T05:31:56Z",
"status_reason": "user_canceled",
"triggered_leg": "stop_loss",
"triggered_order_id": "<string>",
"anchor_order_id": "<string>",
"client_trigger_id": "<string>",
"stop_loss_price": "0.5600",
"take_profit_price": "0.5600",
"trail_amount": "0.5600",
"trail_bps": 123,
"watermark_price": "0.5600",
"effective_stop_price": "0.5600"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>"
}Authorizations
Body
For bracket, supply stop_loss_price and/or take_profit_price. For trailing, supply exactly one of trail_amount or trail_bps. Fields belonging to the other kind are rejected, as is a body that sets neither — cancel with DELETE. A leg you omit is cleared.
Response
Exit trigger set successfully
pending_on_entry awaits an initial or further fill from the anchor order before arming — an order-anchored trigger returns here after closing its current quantity, so this status can follow active and carries a non-zero filled_count when it does. active is live and evaluated against the mark each tick. filled, failed, and canceled are terminal.
pending_on_entry, active, filled, failed, canceled, unknown