curl --request POST \
--url https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend \
--header 'Content-Type: application/json' \
--header 'KALSHI-ACCESS-KEY: <api-key>' \
--header 'KALSHI-ACCESS-SIGNATURE: <api-key>' \
--header 'KALSHI-ACCESS-TIMESTAMP: <api-key>' \
--data '
{
"price": "0.5600",
"count": "10.00",
"ticker": "<string>",
"market_id": "<string>",
"client_order_id": "<string>",
"updated_client_order_id": "<string>",
"expiration_time": 1
}
'import requests
url = "https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend"
payload = {
"price": "0.5600",
"count": "10.00",
"ticker": "<string>",
"market_id": "<string>",
"client_order_id": "<string>",
"updated_client_order_id": "<string>",
"expiration_time": 1
}
headers = {
"KALSHI-ACCESS-KEY": "<api-key>",
"KALSHI-ACCESS-SIGNATURE": "<api-key>",
"KALSHI-ACCESS-TIMESTAMP": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'KALSHI-ACCESS-KEY': '<api-key>',
'KALSHI-ACCESS-SIGNATURE': '<api-key>',
'KALSHI-ACCESS-TIMESTAMP': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
price: '0.5600',
count: '10.00',
ticker: '<string>',
market_id: '<string>',
client_order_id: '<string>',
updated_client_order_id: '<string>',
expiration_time: 1
})
};
fetch('https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend', 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/orders/{order_id}/amend",
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([
'price' => '0.5600',
'count' => '10.00',
'ticker' => '<string>',
'market_id' => '<string>',
'client_order_id' => '<string>',
'updated_client_order_id' => '<string>',
'expiration_time' => 1
]),
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/orders/{order_id}/amend"
payload := strings.NewReader("{\n \"price\": \"0.5600\",\n \"count\": \"10.00\",\n \"ticker\": \"<string>\",\n \"market_id\": \"<string>\",\n \"client_order_id\": \"<string>\",\n \"updated_client_order_id\": \"<string>\",\n \"expiration_time\": 1\n}")
req, _ := http.NewRequest("POST", 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.post("https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend")
.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 \"price\": \"0.5600\",\n \"count\": \"10.00\",\n \"ticker\": \"<string>\",\n \"market_id\": \"<string>\",\n \"client_order_id\": \"<string>\",\n \"updated_client_order_id\": \"<string>\",\n \"expiration_time\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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 \"price\": \"0.5600\",\n \"count\": \"10.00\",\n \"ticker\": \"<string>\",\n \"market_id\": \"<string>\",\n \"client_order_id\": \"<string>\",\n \"updated_client_order_id\": \"<string>\",\n \"expiration_time\": 1\n}"
response = http.request(request)
puts response.read_body{
"order_id": "<string>",
"client_order_id": "<string>",
"remaining_count": "10.00",
"fill_count": "10.00",
"average_fill_price": "0.5600",
"average_fee_paid": "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>"
}Amend Order
Endpoint for amending the price, max number of fillable contracts, and/or expiration time of an existing margin order.
curl --request POST \
--url https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend \
--header 'Content-Type: application/json' \
--header 'KALSHI-ACCESS-KEY: <api-key>' \
--header 'KALSHI-ACCESS-SIGNATURE: <api-key>' \
--header 'KALSHI-ACCESS-TIMESTAMP: <api-key>' \
--data '
{
"price": "0.5600",
"count": "10.00",
"ticker": "<string>",
"market_id": "<string>",
"client_order_id": "<string>",
"updated_client_order_id": "<string>",
"expiration_time": 1
}
'import requests
url = "https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend"
payload = {
"price": "0.5600",
"count": "10.00",
"ticker": "<string>",
"market_id": "<string>",
"client_order_id": "<string>",
"updated_client_order_id": "<string>",
"expiration_time": 1
}
headers = {
"KALSHI-ACCESS-KEY": "<api-key>",
"KALSHI-ACCESS-SIGNATURE": "<api-key>",
"KALSHI-ACCESS-TIMESTAMP": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'KALSHI-ACCESS-KEY': '<api-key>',
'KALSHI-ACCESS-SIGNATURE': '<api-key>',
'KALSHI-ACCESS-TIMESTAMP': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
price: '0.5600',
count: '10.00',
ticker: '<string>',
market_id: '<string>',
client_order_id: '<string>',
updated_client_order_id: '<string>',
expiration_time: 1
})
};
fetch('https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend', 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/orders/{order_id}/amend",
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([
'price' => '0.5600',
'count' => '10.00',
'ticker' => '<string>',
'market_id' => '<string>',
'client_order_id' => '<string>',
'updated_client_order_id' => '<string>',
'expiration_time' => 1
]),
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/orders/{order_id}/amend"
payload := strings.NewReader("{\n \"price\": \"0.5600\",\n \"count\": \"10.00\",\n \"ticker\": \"<string>\",\n \"market_id\": \"<string>\",\n \"client_order_id\": \"<string>\",\n \"updated_client_order_id\": \"<string>\",\n \"expiration_time\": 1\n}")
req, _ := http.NewRequest("POST", 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.post("https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend")
.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 \"price\": \"0.5600\",\n \"count\": \"10.00\",\n \"ticker\": \"<string>\",\n \"market_id\": \"<string>\",\n \"client_order_id\": \"<string>\",\n \"updated_client_order_id\": \"<string>\",\n \"expiration_time\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://external-api.kalshi.com/trade-api/v2/margin/orders/{order_id}/amend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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 \"price\": \"0.5600\",\n \"count\": \"10.00\",\n \"ticker\": \"<string>\",\n \"market_id\": \"<string>\",\n \"client_order_id\": \"<string>\",\n \"updated_client_order_id\": \"<string>\",\n \"expiration_time\": 1\n}"
response = http.request(request)
puts response.read_body{
"order_id": "<string>",
"client_order_id": "<string>",
"remaining_count": "10.00",
"fill_count": "10.00",
"average_fill_price": "0.5600",
"average_fee_paid": "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>"
}Authorizations
Your API key ID
Base64 signature of the pre-sign text (timestamp + method + path) made with the API key's algorithm - RSA-PSS with SHA-256 for RSA keys, Ed25519 for Ed25519 keys
Request timestamp in milliseconds
Path Parameters
Order ID
Query Parameters
Subaccount number (0 for primary, 1-63 for subaccounts). Defaults to 0. Subaccount-restricted API keys default to their locked subaccount and must omit this parameter or pass their locked subaccount.
x >= 0Body
Side of the order
bid, ask Updated price for the order in fixed-point dollars.
"0.5600"
String representation of the updated quantity for the order.
"10.00"
Market ticker. Supply ticker or market_id; ticker takes precedence when both are provided.
Stable exchange market UUID. May be supplied instead of ticker.
The original client-specified order ID to be amended
The new client-specified order ID after amendment
New Unix expiration timestamp in seconds. Omit to preserve the current expiry, or use 0 to remove it (good-till-canceled). A nonzero expiry must be in the future. Send the current price and total quantity for an expiry-only amendment; this preserves queue position.
x >= 0Response
Order amended successfully
Number of contracts remaining after the amend. Only present when the amend caused a fill or changed the resting size.
"10.00"
Number of contracts filled as a result of the amend crossing the book. Only present when fills occurred or remaining size changed.
"10.00"
Volume-weighted average fill price for fills resulting from the amend. Only present when fills occurred.
"0.5600"
Volume-weighted average fee paid per contract for fills resulting from the amend. Only present when fills occurred.
"0.5600"