Kill Switch Status
API to fetch the current Kill Switch status and segment status for all trading segments associated with the user's account. The segment status represents the account-level state of the segment and is independent of the Kill Switch. While toggling the Kill Switch restricts trading activity as a risk management feature to help traders avoid impulsive decisions, it does not change the segment's underlying ACTIVE or INACTIVE designation.
Request
curl --location 'https://api.upstox.com/v2/user/kill-switch' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your_access_token}'
Additional samples in various languages are available in the Sample Code section on this page.
Responses
- 200
- 4XX
Response Body
{
"status": "success",
"data": [
{
"segment": "MCX_FO",
"segment_status": "INACTIVE",
"kill_switch_enabled": false
},
{
"segment": "NCD_FO",
"segment_status": "ACTIVE",
"kill_switch_enabled": false
},
{
"segment": "NSE_EQ",
"segment_status": "ACTIVE",
"kill_switch_enabled": true
},
{
"segment": "BCD_FO",
"segment_status": "ACTIVE",
"kill_switch_enabled": false
},
{
"segment": "BSE_FO",
"segment_status": "ACTIVE",
"kill_switch_enabled": false
},
{
"segment": "NSE_FO",
"segment_status": "ACTIVE",
"kill_switch_enabled": true
},
{
"segment": "BSE_EQ",
"segment_status": "ACTIVE",
"kill_switch_enabled": true
},
{
"segment": "NSE_COM",
"segment_status": "INACTIVE",
"kill_switch_enabled": false
}
]
}
| Name | Type | Description |
|---|---|---|
| status | string | Outcome of the request. Possible values: success, error |
| data | array | List of kill switch status entries for each trading segment |
| data[].segment | string | Exchange segment identifier (e.g. NSE_EQ, BSE_FO, MCX_FO) |
| data[].segment_status | string | Whether the segment is currently enabled for the user. Possible values: ACTIVE, INACTIVE |
| data[].kill_switch_enabled | boolean | true if the kill switch is currently engaged for this segment, halting trading activity |
Error codes
| Error code | Description |
|---|---|
| UDAPI1181 | The specified segment does not exist. - The segment value provided is not a valid trading segment. |
Sample Code
Get kill switch status for all trading segments
- Python
- Node.js
- Java
- PHP
import requests
url = 'https://api.upstox.com/v2/user/kill-switch'
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
const axios = require('axios');
const url = 'https://api.upstox.com/v2/user/kill-switch';
const headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {your_access_token}'
};
axios.get(url, { headers })
.then(response => {
console.log(response.status);
console.log(response.data);
})
.catch(error => {
console.error(error);
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) {
try {
String url = "https://api.upstox.com/v2/user/kill-switch";
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Accept", "application/json")
.header("Authorization", "Bearer {your_access_token}")
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Response Code: " + response.statusCode());
System.out.println("Response Body: " + response.body());
} catch (Exception e) {
e.printStackTrace();
}
}
}
<?php
$url = 'https://api.upstox.com/v2/user/kill-switch';
$headers = array(
'Accept: application/json',
'Authorization: Bearer {your_access_token}'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Response Code: $httpCode\n";
echo "Response Body: $response\n";
?>
Loading...