• Introduction

    SmartAPI is an API marketplace which provides a set of REST-like HTTP APIs that provide several required capabilities to build a complete stock market investment and trading platform. It allows you execute orders in real time (equities, commodities, mutual funds), manage user portfolios, stream live market data over WebSockets, and more.

    All inputs request and response are in JSON format. Standard HTTP codes are used to indicate success and error states accompanied with JSON data. The API endpoints are cross site request enabled, hence can be called directly from browsers.

    An api_key is issued and you have to register a redirect url where a user is sent after the login flow.

    Note: If you do not have a SmartAPI developer account, read more about it and signup here.

    Libraries and SDKs

    Below is a list of pre-built client libraries for SmartAPI written in various programming languages that can be used to interact with the APIs without having to make raw HTTP calls.

    The 1.0 version of the following given libraries are on Github.

    Officially supported SDKs

    Open Source SDKs



    Version and API endpoint

    The current major stable version of the API is 1. All requests go to it by default.

    Root API endpoint

    https://apiconnect.angelone.in

    Response structure

    All POST request parameters as application/json parameters, responses from the API are always JSON.

    Successful request

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{}
    }

    All responses from the API server are JSON with the content-type application/json unless explicitly stated otherwise. A successful 200 OK response always has a JSON response body with a status key with the value success. The data key contains the full response payload.

    Failed request

    {
    "status":"false",
    "message":"Login Id or password is invalid",
    "errorcode":"AB1007",
    "data":"null"
    }

    The status key in the response envelope contains the value false. The errorcode contains the error-code of the error or exception and message key contains a textual description of the error.

    Header Parameters

    Each and every post method must contain the headers as below table.

    ParamValueDescription
    Content -Type application/json application/json
    X-ClientLocalI P CLIENT_LOCAL_IP System Local IP Address
    X-ClientPublic IP CLIENT_PUBLIC_IP Public IP Address
    X-MACAddress MAC_ADDRESS System Mac Address
    Accept application/json application/json
    X-PrivateKey api_keyAPI KEY generated by SmartAPI app
    X-UserType USER Must be USER
    X-SourceID WEB Must be WEB
    AuthorizationBearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6IkQ4OD MiLCJyb2xlcyI6MCwidXNlcnR5cGUiOiJVU0VSIiwia WF0IjoxNTk5NzEyNjk4LCJleHAiOjE1OTk3MjE2OTh 9.qHZEkOMokMktybarQO3m4NMRVQlF0vvN7rh2lC Rkjd2sCYBq3JnOq0yWWOS5Ux_H0pvvt4-ibSmb5H JoKJHOUw It is used in all API’s excluding loginByPassword API. It is JWT token always start with “Bearer ”

    Error Codes

    Error responses come with the name of the exception generated internally by the API server. You can define corresponding exceptions in your language or library, and raise them by doing a switch on the returned exception name.

    Error Codes and Description:

    Sr. NoError CodeDescription
    1AG8001Invalid Token
    2AG8002Token Expired
    3AG8003Token missing
    4AB8050Invalid Refresh Token
    5AB8051Refresh Token Expired
    6AB1000Invalid Email Or Password
    7AB1001Invalid Email
    8AB1002Invalid Password Length
    9AB1003Client Already Exists
    10AB1004Something Went Wrong, Please Try After Sometime
    11AB1005User Type Must Be USER
    12AB1006Client Is Block For Trading
    13AB1007AMX Error
    14AB1008Invalid Order Variety
    15AB1009Symbol Not Found
    16AB1010AMX Session Expired
    17AB1011Client not login
    18AB1012Invalid Product Type
    19AB1013Order not found
    20AB1014Trade not found
    21AB1015Holding not found
    22AB1016Position not found
    23AB1017Position conversion failed
    24AB1018Failed to get symbol details
    25AB2000Error not specified
    26AB2001Internal Error, Please try after sometime
    27AB1031Old Password Mismatch
    28AB1032User Not Found
    29AB2002ROBO order is block
    30AB4008ordertag length should be less than 20 characters

    User


    Login Flow

    The login flow starts by navigating to the public SmartAPI login endpoint:

    https://smartapi.angelone.in/publisher-login?api_key=xxx&state=statevariable

    After successful login, user gets redirected to the URL specified under MyApps. With the URL we pass auth_token & feed_token as query parameters.

    Request TypeAPIsEndpointDescription
    POSTAuthenticate with Angel https://apiconnect.angelone.in/rest/auth/angelbroking/user/v1/loginByPassword Authenticate with Angel Login Credential
    POSTGenerate Tokenhttps://apiconnect.angelone.in/rest/auth/angelbroking/jwt/v1/generateTokens Generate jwt token on expire
    GETGet Profilehttps://apiconnect.angelone.in/rest/secure/angelbroking/user/v1/getProfileRetrieve the user profile

    Authentication with Angel (Login Services)

    You can authenticate to get open APIs trading access using AngelOne Ltd. Account Id. In order to login, you need a client code, valid pin and TOTP. The session established via SmartAPI remains active for upto 28 hours after login, unless the user chooses to log out.

    Login Request

    {
    "clientcode":"Your_client_code",
    "password":"Your_pin",
    "totp":"enter_the_code_displayed_on_your_authenticator_app",
    "state":"state_or_environment_variable"
    }

    Note: State variable is an optional parameter that is used in specific use cases. It is either passed in the request body of the login API as a key value pair or as a query parameter in the publisher login URL. It accepts a string and returns the same string in response. It is particularly useful for developers who develop external applications on top of SmartAPI.

    Login Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
    "jwtToken":"eyJhbGciOiJIUzUxMiJ9.eyJzdWI...",
    "refreshToken":"eyJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1OTk0ODkwMz...",
    "feedToken":"eyJhbGciOiJIUzUxMiJ9.eyJ1c2Vy…"
    "state":"live"
      }

    }

    Note:- As a best practice we suggest the user to logout everyday after their activity.

    
    var axios = require('axios');
    var data = JSON.stringify({
        "clientcode":"CLIENT_ID",
        "password":"CLIENT_PIN",
    	"totp":"TOTP_CODE",
      "state":"STATE_VARIABLE"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/
        /rest/auth/angelbroking/user/
      v1/loginByPassword',
    
      headers : {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType,
         "{\n
            \"clientcode\":\"CLIENT_ID\",\n
            \"password\":\"CLIENT_PIN\",\n
    		\"totp\":\"TOTP_CODE\",\n
        \"state\":\"STATE_VARIABLE\"\n
        }"
         );
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/auth/angelbroking/user/
      v1/loginByPassword")
    
      .method("POST", body)
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        "apiconnect.angelone.in"
        )
    payload = "{\n\"clientcode\":\"CLIENT_ID\"
                ,\n\"password\":\"CLIENT_PIN\"\n
    		,\n\"totp\":\"TOTP_CODE\"\n
        ,\n\"state\":\"STATE_VARIABLE\"\n}"
    headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    conn.request(
        "POST", 
        "/rest/auth/angelbroking/user/
        v1/loginByPassword",
         payload,
         headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/auth/angelbroking/user/
    v1/loginByPassword"
    
    json_body <- jsonlite::toJSON(list(
        "clientcode":"CLIENT_ID",
        "password":"CLIENT_PIN",
    	"totp":"TOTP_CODE",
      "state":"STATE_VARIABLE"
        ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/auth/angelbroking/user/v1/loginByPassword"
      method := "POST"
    
      payload := strings.NewReader({
        "clientcode": "Your_client_code",
        "password": "Your_Pin",
    	"totp":"TOTP_CODE",
      "state":"STATE_VARIABLE"
    })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Generate Token

    Generate token helps to obtain the token after the login flow. After successful login, you get a JWT token and a Refresh token. You can use JWT token to make any transaction.

    Generate Token Request

    {
    "refreshToken":"eyJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1OTk0OD..."
    }

    Generate Token Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
    "jwtToken":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIi...",
    "refreshToken":"eyJhbGciOiJIUzUxMiJ9.e...",
    "feedToken":"eyJhbGciOiJIUzUxMiJ9.eyJ1c2Vy…"
      }

    }
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        "apiconnect.angelone.in"
        )
    payload = "{\n
        \"refreshToken\":\"REFRESH_TOKEN\"
        \n}"
    headers = {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    conn.request("POST",
     "/rest/auth/angelbroking/jwt/
     v1/generateTokens",
      payload,
      headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType,
         "{\n\"refreshToken\":\"REFRESH_TOKEN\"\n}"
         );
    
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/auth/angelbroking/jwt/
      v1/generateTokens")
    
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    var axios = require('axios');
    var data = JSON.stringify({
        "refreshToken":"REFRESH_TOKEN"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/
      rest/auth/angelbroking/jwt/
      v1/generateTokens',
    
      headers: {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/auth/angelbroking/jwt/
    v1/generateTokens"
    
    json_body <- jsonlite::toJSON(list(
        "refreshToken":"REFRESH_TOKEN"
        ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/auth/angelbroking/jwt/v1/generateTokens"
      method := "POST"
    
      payload := strings.NewReader({
        "refreshToken": "eyJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1OTk0OD..."
    })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Get Profile

    This allows to fetch the complete information of the user who is logged in.

    Get Profile Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
    "clientcode":"YOUR_CLIENT_CODE",
    "name":"YOUR_NAME",
    "email":"YOUR_EMAIL",
    "mobileno":"YOUR_PHONE_NUMBER",
    "exchanges":"[ "NSE", "BSE", "MCX", "CDS", "NCDEX", "NFO" ]",
    "products":"[ "DELIVERY", "INTRADAY", "MARGIN"]",
    "lastlogintime":"",
    "brokerid":"B2C",
      }

    }
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = headers = {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    conn.request("GET",
     "/rest/secure/angelbroking/user/
     v1/getProfile", 
     payload,
     headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/
      v1/getProfile")
    
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    var axios = require('axios');
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/
      v1/getProfile',
    
      headers : {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/user/
    v1/getProfile"
    
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/v1/getProfile"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Funds and Margins

    The GET Request to RMS returns fund, cash and margin information of the user for equity and commodity segments.

    Request TypeAPIsEndpointDescription
    GETGet RMS Limit https://apiconnect.angelone.in/rest/secure/angelbroking/user/v1/getRMS To retrieve RMS limit

    RMS (Risk Management System)

    The RMS Limit defines margin rules to ensure that traders don't default on payments & delivery of their orders.

    Get RMS Limit Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
    "net":"9999999999999",
    "availablecash":"9999999999999",
    "availableintradaypayin":"0",
    "availablelimitmargin":"0",
    "collateral":"0",
    "m2munrealized":"0",
    "m2mrealized":"0",
    "utiliseddebits":"0",
    "utilisedspan":"0",
    "utilisedoptionpremium":"0",
    "utilisedholdingsales":"0",
    "utilisedexposure":"0",
    "utilisedturnover":"0",
    "utilisedpayout":"0",
     }
    }
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    conn.request("GET", 
    "/rest/secure/angelbroking/user/
    v1/getRMS", 
    payload, 
    headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/v1/getRMS")
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    var axios = require('axios');
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/
      v1/getRMS',
    
      headers : {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/user/
    v1/getRMS"
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/v1/getRMS"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Logout

    The API session is destroyed by this call and it invalidates the access_token. The user will be sent through a new login flow after this. User is not logged out of the official SmartAPI web.

    Request TypeAPIsEndpointDescription
    POSTLogouthttps://apiconnect.angelone.in/rest/secure/angelbroking/user/v1/logoutTo logout

    Logout Request

    {
         "clientcode": "CLIENT_CODE"
    }

    Logout Response

    {
         "status": true,
         "message": "SUCCESS",
         "errorcode": "",
         "data": ""
    }
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = "{\n     
        \"clientcode\": \"CLIENT_CODE\"\n
    }"
    headers = {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      }
    conn.request("POST",
    "/rest/secure/angelbroking/user/v1/logout", 
    payload, 
    headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType,
         "{\n     \"clientcode\": \"CLIENT_CODE\"\n}"
         );
    
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/
      v1/logout")
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    var axios = require('axios');
    var data = JSON.stringify({
        "clientcode":"CLIENT_CODE"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/
      v1/logout',
      headers : {
        'Authorization': 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'X-UserType': 'USER',
        'X-SourceID': 'WEB',
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
        'X-MACAddress': 'MAC_ADDRESS',
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/user/
    v1/logout"
    
    json_body <- jsonlite::toJSON(list(
        "clientcode":"CLIENT_CODE"
        ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/user/v1/logout"
      method := "POST"
    
      payload := strings.NewReader({
        "clientcode": "CLIENT_CODE"
    })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Orders

    The order APIs allows you to place orders of different varieties like normal orders, after market orders & stoploss orders.

    Request TypeAPIsEndpointDescription
    POSTPlace Order https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/placeOrder To place an order
    POSTModify Order https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/modifyOrder To modify an order
    POSTCancel Orderhttps://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/cancelOrder To cancel an order
    GETGet Order Book https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/getOrderBook To retrieve Order book
    GETGet Trade Book https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/getTradeBook To retrieve trade book
    POSTGet LTP Data https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/getLtpData To retrieve LTP data
    GETGet Individual Order Datahttps://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/details/{UniqueOrderID}To retrieve individual order data

    See the list of constants in below given table.

    Order Constants

    Here are several of the constant enum values used for placing orders.

    ParamValueDescription
    variety

    NORMAL

    STOPLOSS

    AMO

    ROBO

    Normal Order (Regular)

    Stop loss order

    After Market Order

    ROBO (Bracket Order)

    transactiontype

    BUY

    SELL

    Buy

    Sell

    ordertype

    MARKET

    LIMIT

    STOPLOSS_LIMIT

    STOPLOSS_MARKET

    Market Order(MKT)

    Limit Order(L)

    Stop Loss Limit Order(SL)

    Stop Loss Market Order(SL-M)

    producttype

    DELIVERY

    CARRYFORWARD

    MARGIN

    INTRADAY

    BO

    Cash & Carry for equity (CNC)

    Normal for futures and options (NRML)

    Margin Delivery

    Margin Intraday Squareoff (MIS)

    Bracket Order (Only for ROBO)

    Duration

    DAY

    IOC

    Regular Order

    Immediate or Cancel

    exchange

    BSE

    NSE

    NFO

    MCX

    BFO

    CDS

    BSE Equity

    NSE Equity

    NSE Future and Options

    MCX Commodity

    BSE Futures and Options

    Currency Derivate Segment

    Order Parameters

    These parameters are common across different order varieties.

    ParamDescription
    tradingsymbolTrading Symbol of the instrument
    symboltokenSymbol Token is unique identifier
    ExchangeName of the exchange
    transactiontypeBUY or SELL
    ordertype Order type (MARKET, LIMIT etc.)
    quantity Quantity to transact
    producttypeProduct type (CNC,MIS)
    price The min or max price to execute the order at (for LIMIT orders)
    triggerpriceThe price at which an order should be triggered (SL, SL-M)
    squareoffOnly For ROBO (Bracket Order)
    stoplossOnly For ROBO (Bracket Order)
    trailingStopLossOnly For ROBO (Bracket Order)
    disclosedquantityQuantity to disclose publicly (for equity trades)
    durationOrder duration (DAY,IOC)
    ordertagIt is optional to apply to an order to identify. The length of the tag should be less than 20 characters.

    Place Orders

    When an order is successfully placed, the API returns an order_id. The status of the order is not known at the moment of placing because of the aforementioned reasons.

    All requests and its response structure is as below.

    Place Order Request

    {
    "variety":"NORMAL",
    "tradingsymbol":"SBIN-EQ",
    "symboltoken":"3045",
    "transactiontype":"BUY",
    "exchange":"NSE",
    "ordertype":"MARKET",
    "producttype":"INTRADAY",
    "duration":"DAY",
    "price":"194.50",
    "squareoff":"0",
    "stoploss":"0",
    "quantity":"1"
    }

    Place Order Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
     "script":"SBIN-EQ",
     "orderid":"200910000000111"
     "uniqueorderid":"34reqfachdfih"
     }
    }
    
    var axios = require('axios');
    var data = JSON.stringify({
        "exchange":"NSE",
        "tradingsymbol":"INFY-EQ",
        "quantity":5,
        "disclosedquantity":3,
        "transactiontype":"BUY",
        "ordertype":"MARKET",
        "variety":"NORMAL",
        "producttype":"INTRADAY"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/
       rest/secure/angelbroking/order/
       v1/placeOrder',
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\n
            \"exchange\": \"NSE\",\n    
            \"tradingsymbol\": \"INFY-EQ\",\n    
            \"quantity\": 5,\n    
            \"disclosedquantity\": 3,\n    
            \"transactiontype\": \"BUY\",\n   
            \"ordertype\": \"MARKET\",\n    
            \"variety\": \"NORMAL\",\n    
            \"producttype\": \"INTRADAY\"\n
        }");
    
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/placeOrder")
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        "apiconnect.angelone.in"
        )
    payload = "{\n 
           \"exchange\": \"NSE\",
           \n    \"tradingsymbol\": \"INFY-EQ\",
           \n    \"quantity\": 5,
           \n    \"disclosedquantity\": 3,
           \n    \"transactiontype\": \"BUY\",
           \n    \"ordertype\": \"MARKET\",
           \n    \"variety\": \"STOPLOSS\",
           \n    \"producttype\": \"INTRADAY\"
           \n}"
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("POST", 
    "/rest/secure/angelbroking/order/
    v1/placeOrder", 
    payload, 
    headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/ 
    rest/secure/angelbroking/order/
    v1/placeOrder"
    json_body <- jsonlite::toJSON(list(
        "exchange":"NSE",
        "tradingsymbol":"INFY-EQ",
        "quantity":5,
        "disclosedquantity":3,
        "transactiontype":"BUY",
        "ordertype":"MARKET",
        "variety":"NORMAL",
        "producttype":"INTRADAY"
        ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/placeOrder"
      method := "POST"
    
      payload := strings.NewReader({
        "variety":"NORMAL",
        "tradingsymbol":"SBIN-EQ",
        "symboltoken":"3045",
        "transactiontype":"BUY",
        "exchange":"NSE",
        "ordertype":"MARKET",
        "producttype":"INTRADAY",
        "duration":"DAY",
        "price":"194.50",
        "squareoff":"0",
        "stoploss":"0",
        "quantity":"1"
        })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Modify Order

    As long as on order is open or pending in the system, certain attributes of it may be modified. It is important to sent the right value for :variety in the URL.

    Modify Order Request

    {
    "variety":"NORMAL",
    "orderid":"201020000000080",
    "ordertype":"LIMIT",
    "producttype":"INTRADAY",
    "duration":"DAY",
    "price":"194.00",
    "quantity":"1",
    "tradingsymbol":"SBIN-EQ",
    "symboltoken":"3045",
    "exchange":"NSE"
    }

    Modify Order Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
     "orderid":"201020000000080"
     "uniqueorderid":"34reqfachdfih"
      }
    }
    
    var axios = require('axios');
    var data = JSON.stringify({
        "variety":"NORMAL",
        "orderid":"201020000000080",
        "ordertype":"LIMIT",
        "producttype":"INTRADAY",
        "duration":"DAY",
        "price":"194.00",
        "quantity":"1"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/modifyOrder',
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\n
            \"variety\": \"NORMAL\",\n    
            \"orderid\": \"201020000000080\",\n    
            \"ordertype\": \"LIMIT\",\n    
            \"producttype\": \"INTRADAY\",\n    
            \"duration\": \"DAY\",\n    
            \"price\": \"194.00\",\n    
            \"quantity\": \"1\"\n
        }");
    
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/modifyOrder")
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        "apiconnect.angelone.in"
        )
    payload = "{\n    
        \"variety\": \"NORMAL\",\n    
        \"orderid\": \"201020000000080\",\n    
        \"ordertype\": \"LIMIT\",\n    
        \"producttype\": \"INTRADAY\",\n    
        \"duration\": \"DAY\",\n    
        \"price\": \"194.00\",\n    
        \"quantity\": \"1\"\n
    }"
    
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("POST", 
    "/rest/secure/angelbroking/order/
    v1/modifyOrder",
     payload, 
     headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/ 
    rest/secure/angelbroking/order/
    v1/modifyOrder"
    json_body <- jsonlite::toJSON(list(
        "variety":"NORMAL",
        "orderid":"201020000000080",
        "ordertype":"LIMIT",
        "producttype":"INTRADAY",
        "duration":"DAY",
        "price":"194.00",
        "quantity":"1"
        ))
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/modifyOrder"
      method := "POST"
    
      payload := strings.NewReader({
        "variety":"NORMAL",
        "orderid":"201020000000080",
        "ordertype":"LIMIT",
        "producttype":"INTRADAY",
        "duration":"DAY",
        "price":"194.00",
        "quantity":"1"
        })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Cancel Order

    As long as on order is open or pending in the system, it can be cancelled.

    Cancel Order Request

    {
    "variety":"NORMAL",
    "orderid":"201020000000080",
    }

    Cancel Order Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
     "orderid":"201020000000080"
     "uniqueorderid":"34reqfachdfih"
      }
    }
    
    var axios = require('axios');
    var data = JSON.stringify({
        "variety":"NORMAL",
        "orderid":"201020000000080"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/cancelOrder',
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\n   
         \"variety\": \"NORMAL\",\n    
         \"orderid\": \"201020000000080\"\n
        }");
    
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/cancelOrder")
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        "apiconnect.angelone.in"
        )
    payload = "{\n    
        \"variety\": \"NORMAL\",\n    
        \"orderid\": \"201020000000080\"\n
    }"
    
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("POST",
     "/rest/secure/angelbroking/order/
     v1/cancelOrder",
      payload,
       headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/ 
    rest/secure/angelbroking/order/
    v1/cancelOrder"
    json_body <- jsonlite::toJSON(list(
        "variety":"NORMAL",
        "orderid":"201020000000080"
        ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/cancelOrder"
      method := "POST"
    
      payload := strings.NewReader({
        "variety":"NORMAL",
        "orderid":"201020000000080",
        })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Get Order Book

    Get Order Status Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":[{
    "variety":NORMAL,
    "ordertype":LIMIT,
    "producttype":INTRADAY,
    "duration":DAY,
    "price":"194.00",
    "triggerprice":"0",
    "quantity":"1",
    "disclosedquantity":"0",
    "squareoff":"0",
    "stoploss":"0",
    "trailingstoploss":"0",
    "tradingsymbol":"SBIN-EQ",
    "transactiontype":BUY,
    "exchange":NSE,
    "symboltoken":null,
    "instrumenttype":"",
    "strikeprice":"-1",
    "optiontype":"",
    "expirydate":"",
    "lotsize":"1",
    "cancelsize":"1",
    "averageprice":"0",
    "filledshares":"0",
    "unfilledshares":"1",
    "orderid":201020000000080,
    "text":"",
    "status":"cancelled",
    "orderstatus":"cancelled",
    "updatetime":"20-Oct-2020 13:10:59",
    "exchtime":"20-Oct-2020 13:10:59",
    "exchorderupdatetime":"20-Oct-2020 13:10:59",
    "fillid":"",
    "filltime":"",
    "parentorderid":"",
    "uniqueorderid":"34reqfachdfih",
    "exchangeorderid":"1100000000048358"
     }]
    }
    
    var axios = require('axios');
    var data = '';
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in
      /rest/secure/angelbroking/order/
      v1/getOrderBook',
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/getOrderBook")
    
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("GET", 
    "/rest/secure/angelbroking/order/
    v1/getOrderBook", 
    payload, 
    headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/order/
    v1/getOrderBook"
    
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/getOrderBook"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Get Trade Book

    It provides the trades for the current day

    Get Trade Book Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":[{
    "exchange":NSE,
    "producttype":DELIVERY,
    "tradingsymbol":"ITC-EQ",
    "instrumenttype":"",
    "symbolgroup":"EQ",
    "strikeprice":"-1",
    "optiontype":"",
    "expirydate":"",
    "marketlot":"1",
    "precision":"2",
    "multiplier":"-1",
    "tradevalue":"175.00",
    "transactiontype":"BUY",
    "fillprice":"175.00",
    "fillsize":"1",
    "orderid":"201020000000095",
    "fillid":"50005750",
    "filltime":"13:27:53",
     }]
    }
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("GET", 
    "/rest/secure/angelbroking/order/
    v1/getTradeBook", 
    payload, 
    headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/getTradeBook")
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    var axios = require('axios');
    var data = '';
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/getTradeBook',
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/order/
    v1/getTradeBook"
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/getTradeBook"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Get LTP Data

    Get LTP Data Request

    {
    "exchange":"NSE",
    "tradingsymbol":"SBIN-EQ"
    "symboltoken":"3045"
    }

    Get LTP Data Response

    {
    "status":true,
    "message":"SUCCESS",
    "errorcode":"",
    "data":{
    "exchange":"NSE",
    "tradingsymbol":"SBIN-EQ",
    "symboltoken":"3045",
    "open":"186",
    "high":"191.25",
    "low":"185",
    "close":"187.80",
    "ltp":"191",
     }
    }
    
    var axios = require('axios');
    var data = JSON.stringify({
        "exchange":"NSE",
        "tradingsymbol":"SBIN-EQ",
        "symboltoken":"3045"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/getLtpData',
    
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\n
            \"exchange\": \"NSE\",\n    
            \"tradingsymbol\": \"SBIN-EQ\",\n     
            \"symboltoken\":\"3045\"\n
        }");
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/ 
      rest/secure/angelbroking/order/
      v1/getLtpData")
    
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        "apiconnect.angelone.in"
        )
    payload = "{\n    
        \"exchange\": \"NSE\",\n    
        \"tradingsymbol\": \"SBIN-EQ\",\n     
        \"symboltoken\":\"3045\"\n
    }"
    
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("POST", 
    "/rest/secure/angelbroking/order/
    v1/getLtpData", 
    payload, 
    headers
    )
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/ 
    rest/secure/angelbroking/order/
    v1/getLtpData"
    
    json_body <- jsonlite::toJSON(list(
        "exchange":"NSE",
        "tradingsymbol":"SBIN-EQ",
        "symboltoken":"3045"
        ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/getLtpData"
      method := "POST"
    
      payload := strings.NewReader({
        "exchange":"NSE",
        "tradingsymbol":"SBIN-EQ"
        "symboltoken":"3045"
        })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Individual Order Status

    This API allows you to retrieve the status of individual orders using the "uniqueorderid" you receive in the response when placing, modifying, or canceling orders.

    Individual Order Status Request

    https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/details/05ebf91b-bea4-4a1d-b0f2-4259606570e3

    Individual Order Status Response

    {
         "status": true,
         "message": "SUCCESS",
         "errorcode": "",
         "data": {
              "variety": "NORMAL",
              "ordertype": "LIMIT",
              "producttype": "DELIVERY",
              "duration": "DAY",
              "price": 2298.25,
              "triggerprice": 0,
              "quantity": "1",
              "disclosedquantity": "0",
              "squareoff": 0,
              "stoploss": 0,
              "trailingstoploss": 0,
              "tradingsymbol": "RELIANCE-EQ",
              "transactiontype": "BUY",
              "exchange": "NSE",
              "symboltoken": "2885",
              "instrumenttype": "",
              "strikeprice": -1,
              "optiontype": "",
              "expirydate": "",
              "lotsize": "1",
              "cancelsize": "0",
              "averageprice": 0,
              "filledshares": "0",
              "unfilledshares": "1",
              "orderid": "231010000000970",
              "text": "Your order has been rejected due to Insufficient Funds. Available funds - Rs. 937.00 . You require Rs. 2298.25 funds to execute this order.",
              "status": "rejected",
              "orderstatus": "rejected",
              "updatetime": "10-Oct-2023 09:00:16",
              "exchtime": "",
              "exchorderupdatetime": "",
              "fillid": "",
              "filltime": "",
              "parentorderid": "",
              "ordertag": "",
              "uniqueorderid": "05ebf91b-bea4-4a1d-b0f2-4259606570e3"
         }
    }

    NOTE:

    1. Unique Order ID - This identifier will be included in the response every time you interact with our APIs, whether you're placing an order, modifying it, canceling it, or checking your order book. This unique identifier simplifies the process of tracking and managing your orders with precision.


    
    import http.client
    
    conn = http.client.HTTPSConnection("apiconnect.angelone.in")
    
    headers = {
      'X-PrivateKey': 'API_KEY',
      'Accept': 'application/json',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-UserType': 'USER',
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Accept': 'application/json',
      'X-SourceID': 'WEB',
      'Content-Type': 'application/json'
    }
    
    conn.request("GET", "/rest/secure/angelbroking/
    order/v1/details/05ebf91b-bea4-4a1d-b0f2-4259606570e3", "", headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
     
    
    OkHttpClient client = new OkHttpClient().newBuilder().build();
    
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/rest
      /secure/angelbroking/order/v1/details/05ebf91b-bea4-4a1d-b0f2-4259606570e3")
      .method("GET", null)
      .addHeader("X-PrivateKey", "API_KEY")
      .addHeader("Accept", "application/json")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-UserType", "USER")
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .build();
    
    Response response = client.newCall(request).execute();
     
    
     var axios = require('axios');
    
      var config = {
        method: 'get',
        url: "https://apiconnect.angelone.in/rest
        /secure/angelbroking/order/v1/details/05ebf91b-bea4-4a1d-b0f2-4259606570e3",
        headers: { 
          'X-PrivateKey': 'API_KEY', 
          'Accept': 'application/json, application/json', 
          'X-SourceID': 'WEB, WEB', 
          'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
          'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
          'X-MACAddress': 'MAC_ADDRESS', 
          'X-UserType': 'USER', 
          'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
          'Content-Type': 'application/json'
        },
      };
    
      axios(config)
        .then(function (response) {
          console.log(JSON.stringify(response.data));
        })
        .catch(function (error) {
          console.log(error);
        });
    
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/order/
    v1/details/05ebf91b-bea4-4a1d-b0f2-4259606570e3"
    
    response <- GET(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
     
    
    package main
    
     import (
       "fmt"
       "strings"
       "net/http"
       "io/ioutil"
     )
     
     func main() {
     
       url := "https://apiconnect.angelone.in/
        rest/secure/angelbroking/order/
        v1/details/05ebf91b-bea4-4a1d-b0f2-4259606570e3"
       method := "GET"
     
       client := &http.Client {
       }
       req, err := http.NewRequest(method, url)
     
       if err != nil {
         fmt.Println(err)
         return
       }
       req.Header.Add("X-PrivateKey", "API_KEY")
       req.Header.Add("Accept", "application/json")
       req.Header.Add("X-SourceID", "WEB")
       req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
       req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
       req.Header.Add("X-MACAddress", "MAC_ADDRESS")
       req.Header.Add("X-UserType", "USER")
       req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
       req.Header.Add("X-PrivateKey", "API_KEY")
       req.Header.Add("Accept", "application/json")
       req.Header.Add("X-SourceID", "WEB")
       req.Header.Add("Content-Type", "application/json")
     
       res, err := client.Do(req)
       if err != nil {
         fmt.Println(err)
         return
       }
       defer res.Body.Close()
     
       body, err := ioutil.ReadAll(res.Body)
       if err != nil {
         fmt.Println(err)
         return
       }
       fmt.Println(string(body))
     }
    
        
     

    Brokerage Calculator

    Brokerage Calculator API is used to calculate Brokerage charges and taxes et. al. that will be incurred by the user for placing the trade.

    The API endpoint is:

    https://apiconnect.angelone.in/rest/secure/angelbroking/brokerage/v1/estimateCharges
    HTTP Method: POST

    Headers are same as other requests.

    The request body is :

    
    {
        "orders": [
            {
                "product_type": "DELIVERY",
                "transaction_type": "BUY",
                "quantity": "10",
                "price": "800",
                "exchange": "NSE",
                "symbol_name": "745AS33",
                "token": "17117"
            },{
                "product_type": "DELIVERY",
                "transaction_type": "BUY",
                "quantity": "10",
                "price": "800",
                "exchange": "BSE",
                "symbol_name": "PIICL151223",
                "token": "726131"
            }
        ]
    } 
    

    Response Structure:

    
    {
        "status": true,
        "message": "SUCCESS",
        "errorcode": "",
        "data": {
            "summary": {
                "total_charges": 3.0796,
                "trade_value": 16000,
                "breakup": [
                    {
                        "name": "Angel One Brokerage",
                        "amount": 0.0,
                        "msg": "",
                        "breakup": []
                    },
                    {
                        "name": "External Charges",
                        "amount": 2.976,
                        "msg": "",
                        "breakup": [
                            {
                                "name": "Exchange Transaction Charges",
                                "amount": 0.56,
                                "msg": "",
                                "breakup": []
                            },
                            {
                                "name": "Stamp Duty",
                                "amount": 2.4,
                                "msg": "",
                                "breakup": []
                            },
                            {
                                "name": "SEBI Fees",
                                "amount": 0.016,
                                "msg": "",
                                "breakup": []
                            }
                        ]
                    },
                    {
                        "name": "Taxes",
                        "amount": 0.1036,
                        "msg": "",
                        "breakup": [
                            {
                                "name": "Security Transaction Tax",
                                "amount": 0.0,
                                "msg": "",
                                "breakup": []
                            },
                            {
                                "name": "GST",
                                "amount": 0.1036,
                                "msg": "",
                                "breakup": []
                            }
                        ]
                    }
                ]
            },
            "charges": [
                {
                    "total_charges": 1.5162,
                    "trade_value": 8000,
                    "breakup": [
                        {
                            "name": "Angel One Brokerage",
                            "amount": 0.0,
                            "msg": "",
                            "breakup": []
                        },
                        {
                            "name": "External Charges",
                            "amount": 1.468,
                            "msg": "",
                            "breakup": [
                                {
                                    "name": "Exchange Transaction Charges",
                                    "amount": 0.26,
                                    "msg": "",
                                    "breakup": []
                                },
                                {
                                    "name": "Stamp Duty",
                                    "amount": 1.2,
                                    "msg": "",
                                    "breakup": []
                                },
                                {
                                    "name": "SEBI Fees",
                                    "amount": 0.008,
                                    "msg": "",
                                    "breakup": []
                                }
                            ]
                        },
                        {
                            "name": "Taxes",
                            "amount": 0.0482,
                            "msg": "",
                            "breakup": [
                                {
                                    "name": "Security Transaction Tax",
                                    "amount": 0.0,
                                    "msg": "",
                                    "breakup": []
                                },
                                {
                                    "name": "GST",
                                    "amount": 0.0482,
                                    "msg": "",
                                    "breakup": []
                                }
                            ]
                        }
                    ]
                },
                {
                    "total_charges": 1.5634,
                    "trade_value": 8000,
                    "breakup": [
                        {
                            "name": "Angel One Brokerage",
                            "amount": 0.0,
                            "msg": "",
                            "breakup": []
                        },
                        {
                            "name": "External Charges",
                            "amount": 1.508,
                            "msg": "",
                            "breakup": [
                                {
                                    "name": "Exchange Transaction Charges",
                                    "amount": 0.3,
                                    "msg": "",
                                    "breakup": []
                                },
                                {
                                    "name": "Stamp Duty",
                                    "amount": 1.2,
                                    "msg": "",
                                    "breakup": []
                                },
                                {
                                    "name": "SEBI Fees",
                                    "amount": 0.008,
                                    "msg": "",
                                    "breakup": []
                                }
                            ]
                        },
                        {
                            "name": "Taxes",
                            "amount": 0.0554,
                            "msg": "",
                            "breakup": [
                                {
                                    "name": "Security Transaction Tax",
                                    "amount": 0.0,
                                    "msg": "",
                                    "breakup": []
                                },
                                {
                                    "name": "GST",
                                    "amount": 0.0554,
                                    "msg": "",
                                    "breakup": []
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
    

    Portfolio

    A portfolio is a collection of financial investments like stocks, bonds, commodities, cash, and cash equivalents, including long-term equity holdings and short-term positions. The portfolio APIs return instruments in a portfolio with updated profit and loss computations.

    Request TypeAPIsEndpointDescription
    GETGet Holding https://apiconnect.angelone.in/rest/secure/angelbroking/portfolio/v1/getHolding To retrieve holding
    GETGet All Holding https://apiconnect.angelone.in/rest/secure/angelbroking/portfolio/v1/getAllHoldingTo retrieve all holding
    GETGet Position https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/getPosition To retrieve positIon
    POSTConvert Position https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/convertPosition To convert position

    Get Holdings

    Holdings comprises of the user's portfolio of long-term equity delivery stocks. An instrument in a holding's portfolio remains there indefinitely until its sold or is delisted or changed by the exchanges. Underneath it all, instruments in the holdings reside in the user's DEMAT account, as settled by exchanges and clearing institutions.

    Get Holding Response

    {
         "tradingsymbol": "TATASTEEL-EQ",
         "exchange": "NSE",
         "isin": "INE081A01020",
         "t1quantity": 0,
         "realisedquantity": 2,
         "quantity": 2,
         "authorisedquantity": 0,
         "product": "DELIVERY",
         "collateralquantity": null,
         "collateraltype": null,
         "haircut": 0,
         "averageprice": 111.87,
         "ltp": 130.15,
         "symboltoken": "3499",
         "close": 129.6,
         "profitandloss": 37,
         "pnlpercentage": 16.34
    }
    
    var axios = require('axios');
    var data = '';
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/portfolio/
      v1/getHolding',
    
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/portfolio/
      v1/getHolding")
    
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("GET", 
    "/rest/secure/angelbroking/portfolio/
    v1/getHolding", 
    payload, 
    headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/portfolio/
    v1/getHolding"
    
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/portfolio/v1/getHolding"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Get All Holdings

    This endpoint offers a more comprehensive view of your entire investments, including individual stock holdings and a summary of your total investments. In addition to the updates for individual stock holdings, we have introduced a new section in the response called "totalholding," which provides a summary of your entire investments, including:

    • totalholdingvalue: The total value of all your holdings.
    • totalinvvalue: The total investment value.
    • totalprofitandloss: The total profit and loss across all holdings.
    • totalpnlpercentage: The total profit and loss percentage for your entire portfolio.

    Get Holding Response

    {
         "status": true,
         "message": "SUCCESS",
         "errorcode": "",
         "data": {
              "holdings": [
                   {
                        "tradingsymbol": "TATASTEEL-EQ",
                        "exchange": "NSE",
                        "isin": "INE081A01020",
                        "t1quantity": 0,
                        "realisedquantity": 2,
                        "quantity": 2,
                        "authorisedquantity": 0,
                        "product": "DELIVERY",
                        "collateralquantity": null,
                        "collateraltype": null,
                        "haircut": 0,
                        "averageprice": 111.87,
                        "ltp": 130.15,
                        "symboltoken": "3499",
                        "close": 129.6,
                        "profitandloss": 37,
                        "pnlpercentage": 16.34
                   },
                   {
                        "tradingsymbol": "PARAGMILK-EQ",
                        "exchange": "NSE",
                        "isin": "INE883N01014",
                        "t1quantity": 0,
                        "realisedquantity": 2,
                        "quantity": 2,
                        "authorisedquantity": 0,
                        "product": "DELIVERY",
                        "collateralquantity": null,
                        "collateraltype": null,
                        "haircut": 0,
                        "averageprice": 154.03,
                        "ltp": 201,
                        "symboltoken": "17130",
                        "close": 192.1,
                        "profitandloss": 94,
                        "pnlpercentage": 30.49
                   },
                   {
                        "tradingsymbol": "SBIN-EQ",
                        "exchange": "NSE",
                        "isin": "INE062A01020",
                        "t1quantity": 0,
                        "realisedquantity": 8,
                        "quantity": 8,
                        "authorisedquantity": 0,
                        "product": "DELIVERY",
                        "collateralquantity": null,
                        "collateraltype": null,
                        "haircut": 0,
                        "averageprice": 573.1,
                        "ltp": 579.05,
                        "symboltoken": "3045",
                        "close": 570.5,
                        "profitandloss": 48,
                        "pnlpercentage": 1.04
                   }
              ],
              "totalholding": {
                   "totalholdingvalue": 5294,
                   "totalinvvalue": 5116,
                   "totalprofitandloss": 178.14,
                   "totalpnlpercentage": 3.48
              }
         }
    }
    
    var axios = require('axios');
    var data = '';
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/portfolio/v1/getAllHolding',
    
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/portfolio/v1/getAllHolding")
    
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("GET", 
    "/rest/secure/angelbroking/portfolio/v1/getAllHolding", 
    payload, 
    headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/portfolio/v1/getAllHolding"
    
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/portfolio/v1/getAllHolding"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Get Position

    This API returns two sets of positions, net and day. net is the actual, current net position portfolio, while day is a snapshot of the buying and selling activity for that particular day.

    Get Position Response

    {
         "status": true,
         "message": "SUCCESS",
         "errorcode": "",
         "data": [
              {
                   "exchange": "NSE",
                   "symboltoken": "2885",
                   "producttype": "DELIVERY",
                   "tradingsymbol": "RELIANCE-EQ",
                   "symbolname": "RELIANCE",
                   "instrumenttype": "",
                   "priceden": "1",
                   "pricenum": "1",
                   "genden": "1",
                   "gennum": "1",
                   "precision": "2",
                   "multiplier": "-1",
                   "boardlotsize": "1",
                   "buyqty": "1",
                   "sellqty": "0",
                   "buyamount": "2235.80",
                   "sellamount": "0",
                   "symbolgroup": "EQ",
                   "strikeprice": "-1",
                   "optiontype": "",
                   "expirydate": "",
                   "lotsize": "1",
                   "cfbuyqty": "0",
                   "cfsellqty": "0",
                   "cfbuyamount": "0",
                   "cfsellamount": "0",
                   "buyavgprice": "2235.80",
                   "sellavgprice": "0",
                   "avgnetprice": "2235.80",
                   "netvalue": "- 2235.80",
                   "netqty": "1",
                   "totalbuyvalue": "2235.80",
                   "totalsellvalue": "0",
                   "cfbuyavgprice": "0",
                   "cfsellavgprice": "0",
                   "totalbuyavgprice": "2235.80",
                   "totalsellavgprice": "0",
                   "netprice": "2235.80"
              }
         ]
    }
    
    var axios = require('axios');
    var data = '';
    
    var config = {
      method: 'get',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/getPosition',
    
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/getPosition")
    
      .method("GET", null)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = ''
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("GET", 
    "/rest/secure/angelbroking/order/
    v1/getPosition", 
    payload, 
    headers)
    
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/order/
    v1/getPosition"
    
    response <- GET(url, add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/getPosition"
      method := "GET"
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, nil)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    Convert Position

    Each position has one margin product. These products affect how the user's margin usage and free cash values are computed, and a user may wish to convert or change a position's margin product on timely basis.

    Position Conversion Request

    {
         "exchange": "NSE",
         "symboltoken": "2885",
         "oldproducttype": "DELIVERY",
         "newproducttype": "INTRADAY",
         "tradingsymbol": "RELIANCE-EQ",
         "symbolname": "RELIANCE",
         "instrumenttype": "",
         "priceden": "1",
         "pricenum": "1",
         "genden": "1",
         "gennum": "1",
         "precision": "2",
         "multiplier": "-1",
         "boardlotsize": "1",
         "buyqty": "1",
         "sellqty": "0",
         "buyamount": "2235.80",
         "sellamount": "0",
         "transactiontype": "BUY",
         "quantity": 1,
         "type": "DAY"
    }

    Position Conversion Response

    {
         "status": true,
         "message": "SUCCESS",
         "errorcode": "",
         "data": null
    }
    
    var axios = require('axios');
    var data = JSON.stringify({
        "exchange":"NSE",
        "symboltoken":"2885",
        "oldproducttype":"DELIVERY",
        "newproducttype":"INTRADAY",
        "tradingsymbol":"RELIANCE-EQ",
        "symbolname":"RELIANCE",
        "instrumenttype":"",
        "priceden":"1",
        "pricenum":"1",
        "genden":"1",
        "gennum":"1",
        "precision":"2",
        "multiplier":"-1",
        "boardlotsize":"1",
        "buyqty":"1",
        "sellqty":"0",
        "buyamount":"2235.80",
        "sellamount":"0",
        "transactiontype":"BUY",
        "quantity":1,
        "type":"DAY"
    });
    
    var config = {
      method: 'post',
      url: 'https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/convertPosition',
      headers: { 
        'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
        'Content-Type': 'application/json', 
        'Accept': 'application/json', 
        'X-UserType': 'USER', 
        'X-SourceID': 'WEB', 
        'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
        'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
        'X-MACAddress': 'MAC_ADDRESS', 
        'X-PrivateKey': 'API_KEY'
      },
      data : data
    };
    
    axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
    
    
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, 
        "{\n    
        \"exchange\": \"NSE\",\n    
        \"symboltoken\": \"2885\",\n    
        \"oldproducttype\": \"DELIVERY\",\n    
        \"newproducttype\": \"INTRADAY\",\n    
        \"tradingsymbol\": \"RELIANCE-EQ\",\n    
        \"symbolname\": \"RELIANCE\",\n    
        \"instrumenttype\": \"\",\n    
        \"priceden\": \"1\",\n    
        \"pricenum\": \"1\",\n   
        \"genden\": \"1\",\n   
        \"gennum\": \"1\",\n    
        \"precision\": \"2\",\n    
        \"multiplier\": \"-1\",\n    
        \"boardlotsize\": \"1\",\n    
        \"buyqty\": \"1\",\n    
        \"sellqty\": \"0\",\n    
        \"buyamount\": \"2235.80\",\n    
        \"sellamount\": \"0\",\n    
        \"transactiontype\": \"BUY\",\n    
        \"quantity\": 1,\n    
        \"type\": \"DAY\"\n
    }");
    Request request = new Request.Builder()
      .url("https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/
      v1/convertPosition")
    
      .method("POST", body)
      .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
      .addHeader("Content-Type", "application/json")
      .addHeader("Accept", "application/json")
      .addHeader("X-UserType", "USER")
      .addHeader("X-SourceID", "WEB")
      .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      .addHeader("X-MACAddress", "MAC_ADDRESS")
      .addHeader("X-PrivateKey", "API_KEY")
      .build();
    Response response = client.newCall(request).execute();
    
    import http.client
    import mimetypes
    conn = http.client.HTTPSConnection(
        " apiconnect.angelone.in "
        )
    payload = "{\n    
        \"exchange\": \"NSE\",\n    
        \"symboltoken\": \"2885\",\n    
        \"oldproducttype\": \"DELIVERY\",\n    
        \"newproducttype\": \"INTRADAY\",\n    
        \"tradingsymbol\": \"RELIANCE-EQ\",\n    
        \"symbolname\": \"RELIANCE\",\n    
        \"instrumenttype\": \"\",\n    
        \"priceden\": \"1\",\n    
        \"pricenum\": \"1\",\n   
        \"genden\": \"1\",\n   
        \"gennum\": \"1\",\n    
        \"precision\": \"2\",\n    
        \"multiplier\": \"-1\",\n    
        \"boardlotsize\": \"1\",\n    
        \"buyqty\": \"1\",\n    
        \"sellqty\": \"0\",\n    
        \"buyamount\": \"2235.80\",\n    
        \"sellamount\": \"0\",\n    
        \"transactiontype\": \"BUY\",\n    
        \"quantity\": 1,\n    
        \"type\": \"DAY\"\n
    }"
    
    headers = {
      'Authorization': 'Bearer AUTHORIZATION_TOKEN',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'X-UserType': 'USER',
      'X-SourceID': 'WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-PrivateKey': 'API_KEY'
    }
    conn.request("POST",
     "/rest/secure/angelbroking/order/
     v1/convertPosition", 
     payload, 
     headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    
    library(httr)
    
    url <- "https://apiconnect.angelone.in/
    rest/secure/angelbroking/order/
    v1/convertPosition"
    json_body <- jsonlite::toJSON(list(
        "exchange":"NSE",
        "symboltoken":"2885",
        "oldproducttype":"DELIVERY",
        "newproducttype":"INTRADAY",
        "tradingsymbol":"RELIANCE-EQ",
        "symbolname":"RELIANCE",
        "instrumenttype":"",
        "priceden":"1",
        "pricenum":"1",
        "genden":"1",
        "gennum":"1",
        "precision":"2",
        "multiplier":"-1",
        "boardlotsize":"1",
        "buyqty":"1",
        "sellqty":"0",
        "buyamount":"2235.80",
        "sellamount":"0",
        "transactiontype":"BUY",
        "quantity":1,
        "type":"DAY"
    ))
    
    response <- POST(url, 
        config = list(
        add_headers(
        'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
        'Content-Type'= 'application/json',
        'Accept'= 'application/json',
        'X-UserType'= 'USER',
        'X-SourceID'= 'WEB',
        'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
        'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
        'X-MACAddress'= 'MAC_ADDRESS',
        'X-PrivateKey'= 'API_KEY'
        ))
        ),
        body = json_body,
        encode = "raw"
    
    print(response)
    
    
    package main
    
    import (
      "fmt"
      "strings"
      "net/http"
      "io/ioutil"
    )
    
    func main() {
    
      url := "https://apiconnect.angelone.in/
      rest/secure/angelbroking/order/v1/convertPosition"
      method := "POST"
    
      payload := strings.NewReader({
        "exchange":"NSE",
        "symboltoken":"2885",
        "oldproducttype":"DELIVERY",
        "newproducttype":"INTRADAY",
        "tradingsymbol":"RELIANCE-EQ",
        "symbolname":"RELIANCE",
        "instrumenttype":"",
        "priceden":"1",
        "pricenum":"1",
        "genden":"1",
        "gennum":"1",
        "precision":"2",
        "multiplier":"-1",
        "boardlotsize":"1",
        "buyqty":"1",
        "sellqty":"0",
        "buyamount":"2235.80",
        "sellamount":"0",
        "transactiontype":"BUY",
        "quantity":1,
        "type":"DAY"
    })
    
      client := &http.Client {
      }
      req, err := http.NewRequest(method, url, payload)
    
      if err != nil {
        fmt.Println(err)
        return
      }
      req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
      req.Header.Add("Content-Type", "application/json")
      req.Header.Add("Accept", "application/json")
      req.Header.Add("X-UserType", "USER")
      req.Header.Add("X-SourceID", "WEB")
      req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
      req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
      req.Header.Add("X-MACAddress", "MAC_ADDRESS")
      req.Header.Add("X-PrivateKey", "API_KEY")
    
      res, err := client.Do(req)
      if err != nil {
        fmt.Println(err)
        return
      }
      defer res.Body.Close()
    
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
        fmt.Println(err)
        return
      }
      fmt.Println(string(body))
    }

    EDIS APIs

    Using this API, users who have not submitted POA with us can do CDSL authorisation to sell their holdings. Earlier This process was done via Mobile App/Web. This can be now done via API as well. Please note that you need to provide authorisation once in a day for selling.

    The API endpoint for the same is :

    https://apiconnect.angelone.in/rest/secure/angelbroking/edis/v1/verifyDis

    The request body is :

    
    {
        "isin":"INE528G01035",
        "quantity":"1"
    }  
    

    The Header parameters are same as other requests.

    Response Structure:

    For first time registration in a day:

    
    {
        "status": true,
        "message": "SUCCESS",
        "errorcode": "",
        "data": {
            "ReqId": "8180722758077144",
            "ReturnURL": "https://trade.angelbroking.com/cdslpoa/response",
            "DPId": "33200",
            "BOID": "1203320015222472",
            "TransDtls": "fZ6jlmt9GosSO0kFdI9S9FCD+IYFvjUN94Bph46YMC1BzexE1hDuCwjSUzXVoEgV3mTP5aXnwxJDikFm1xymcjfhEgtWm7ykrpxaDXSuQF25Fg5olDgXy/Suu916VNg9XID0GHy1CT5E9WBP0gocixvOFrCPFmRMmY+7Nqbb3cNfqPZ8uHfX0un5tFnQXV3AXK0g2exwRf3EINSTHSv66/inPArtDko70vuc1pb5e0tRXa14FN2hzklop2UyrcIiDmkmzcHvjdGGomCM4PU90S28xHze5/dAlTv7ywIzrQOA4N2LW7n7M9atFExQTC2tczdwhKkVzScYmpVdRvtY+Lqo8o/OSVQ8Gd3Guz7ZRpqV5073lZ/BnPN8FtJW6shfOwgbYgqmhV2jik0uw57eQ7f+SI0pYYC8noOwKncJ3/umtVY2NVgLjdZq2yxZh7wTQKC2WYaYl/MnZLpgF9yYlBAtZ6trgLG6kcmtlbibtkimi2TecMGN3KrAETsWY07fZCc9Ks/RetFzD1qNIGWZ/4WnpWyW5XTxSxlQILCz7Qwk5f+dKcXVe5CS/7DMB7aa9KQ4t1ru1xo7jM4GmUdwcGVwUqb2pfNSEUX+I10INA0TwXkWdUAAQYO0++q6mYpN59G3IW9vV/dW0/bHh4xcsPg9ysDBZ8bLlk4C3hL6RiVrxcF2AgxjJgLSxL2YerAKkgivk22KULtEDpOpE7IcwxjuWjRxOPGfnSGbc4Ii1avte50WZFh6EKIP6E16sZgKaOh/r5CSnysEtDetvhn8siIWDQbhInAoExMpsuewIthg4QVWvx0EzQL6LqNO74Hc9/JicH+cGFtn6nHjwHgquzbCZx6W6XlzHJVV04Pd0m4kXC27RrnoraFj3KpXcfmdSr0GK3HtUKYV2QgSM8COvEEuL++oxjD4PKi40JmTv2I=",
            "version": "1.1"
        }
    }  
    

    If User has already registered for the Day:

    
    {
        "status": false,
        "message": "You have alreday been registered with CDSL for today.",
        "errorcode": "AG1000",
        "data": {
            "ReqId": "0390624715013748",
            "ReturnURL": null,
            "DPId": null,
            "BOID": null,
            "TransDtls": null,
            "version": "1.1"
        }
    }
    

    If there is an error:

    
    {
        "status": false,
        "message": "Something went wrong. Please try again",
        "errorcode": "AG2001",
        "data": null
    }
    

    Generate TPIN

    API end point:

    https://apiconnect.angelone.in/rest/secure/angelbroking/edis/v1/generateTPIN

    Request type- POST

    Request Body:

    
    {
        "dpId":"...",
        "ReqId":"...",
        "boid":"...",
        "pan":"..."
    }  
    

    The Above operation needs to be done in an HTML page which will open a browser window with CDSL website wherein the user can verify their TPIN

    Below is an example of the HTML code which can be used for this purpose:

    
    <!DOCTYPE html>
    <html>
    <script>window.onload= function()
            {submit()};function submit(){ document.getElementById("submitbtn").click();    }
    </script>
    <body onload="submit()">
    <form name="frmDIS" method="post"
          action="https://edis.cdslindia.com/eDIS/VerifyDIS/" style="
                                                  text-align: center; margin-top: 35px; /* margin-bottom: 15px; */ ">
        <input type="hidden" name="DPId" value="33200">
        <input type="hidden" name="ReqId" value="0908782441429760">
        <input type="hidden" name="Version" value="1.1">
        <input type="hidden" name="TransDtls"
               value="fZ6jlmt9GosSO0kFdI9S9FCD+IYFvjUN94Bph46YMC0Ge77DG084EWriKaa/Rga9Zqz3e8N/tCvI/yM8j1mZr1peOPMRVd0R861x1nbgRtewDwCg/I3GoW8slgXzHu3do6QBAYsAYrvlkBhNQR+b363o1Z8eRo3YzaDNwmRuqJDPXmEX1MOdc3gkxaAMQBJ22LvFseXinSJ0HR/ugNRAKwmR6sKBtTj4xIQR63EyDkKjpP6OKSKQhMmhuT+cbUsswdgj6Em85NqmNY6palQZJjGaI6zyyBs7ZG5zL3mIxeC7qkuS8mgaWlJnZJTJ7ON0Fn/ayxiF5wFmmxJPH0E+T5yrpkmLVuKfFvHGpgnlHFxFYO7neYezy9N+2u3QMhKFoq+hlGC30c1EY0bscVzIrLKB4daTK82wRTWX6doBPOSCmAyN4/Jvvob2vbyb5ialKAVUHRQwmzxD8QxEdkvFX/syGXhech9RhnYRWMB3CXQLDE4VWJH1GGgK/lNdWSjJS0FQ4VlGGnfR+rUeTochRDiv/T3SlPMDT6dUNc0Ca4xURaTnpLOGBVXieVlDjvtUpjCQAYBqeKQg/TfGFl57tA7uI6LHg95b+g8xSc7+iWxWv2c0I3nSHmnOz/XQBGxllq/ZSzU6yFqT+66RM6mmF+/jqucmCQC2IoT/QP4GxaHUmhslP/yRPsWhgSnybhfK7wEfGN+xvTSzSfxJznIAMo6w1RZ1X7ZtlCWeODn0gCpF5ZY9Ly8/bCWPzgiqyAsCMhoZAtJk/VMMX0AcWr6HBWHh3EjPAh1R+JVjx25HSZEa+kus8CQmPnzC2wgJweRkOveXM3pb1MwYl8fkRfeWyRR6FTG9jgfGUXdQH8xFjnYd635n2RK+JPFlCeMRaKMLWYtXReigQX72UokicT7BRL39djJCQW2nj6//gu2YpNdgIFGLxmsLyBB1ptIafHod8DXl7v0aKKBpe3mdPdOjqwt0SqJcT1ffrDlYGcqgrfzI8aGZX+gOSaDFAVCej7AFQRh1Ij/nqyJcTE73FPcCn77IyP7W66CVQOiLIImordxIF+Iucvu5Y7/FrL0n7Yltg3E0/YIDLz1KUa5egxW5mSCLsLZuYuCN8R1DhLh3Ha/yjDRfDABW4758qCTU+peP2lkUIoq/m+VZIqAzBGhJBnA4MU60TawWUOFcj5tRxI2Hhmhk+ExLhUnIsuzvlz3MXqRqne1IVOujjvrVi6VbOaYEoIj/OalDCOiNoOwcGf1uqTqK2ZsNBg+/qQ0vRPa1lK57bo9rCAj+UvIFqBx76Xn52Y7BgnqShwYquGl5jj9YXUiPXZUs0k97MF9mVVfKAt/f6EMprBev2lU7HP4CzCjcfTK1Y+pt2Sf0ih1JdNo0p8UtpWKjAdENMWJtRtpUnz7lwF2M0iIDbvmhkYTZIDPNsa2QwoanxhSyyL3nLwbAz0DzU1IEyYaPuXPnJ3WBC8x9VImL67tCYzJcvlege6YnrYJmY1/qIEdXKksleFcWElAz66PCvNFxYcUflo0AHnCTyWni/6Ngp1LJTG/zVnAUs6p8PM2p3uVeK7JZ4+tWkPR3wh46EXGxe8rABqutBcZy4DUKqNA3zFtn81V1cY77kDnbdeSB9RUp5rN1Upz5XzTrsekjwM3iBFaJFwxKrXjyagaJ/A/r75AKAmVRUWMtNqxN3NOs20FOO4zoUCC6H6EYkHjXTqfOpkzgQW53ORDuyweIkNY75X2mXTaNxsVZJPLA7gZ36XHNcRaLK0n9bx4K7tzieSiCCJU81jPlZDHnBoOFz0wZvIT3bTAJaiTysFEzjH37Z5IfLAW0avHcFhNUiNhxZtXDwYI5OEO4Q3NDPLYQ5nhOkT/phqtBmSxtbA4HWDitzAmPAfpxRLO+DUgxOKNkmRRuPWsefO9ic3aFg0oSxeCDwFD2+zL2KK6RDzdyvnsY60vqK8GwAuAy+j4i1oLlp1lXpLRZZZ0+CXOELmE9aI+PjizDazBCAY7r9+mP8v3mp3JQVruTUDLDlXg4yF3KqMICuO4cccZ1K3RWSqcQMdEPRTgKkQ4fodla+nUvA7y9saz0+UNrOuTZAL7JBkwz/+2AxlCPRV2Ut0iok0GopkIHNJPedn12NQqFVmqSKZ3GtghbpNN6nwbn6LRE38bzmGJr3TooeXSZPvc4efHSq6GYinprgK3WCsphPam9yTJezmv8jsX42OHwXr7R01M1KH7sWhjLRqQeRgnPJ6vEeV8btzIGTVrlKY6ufubig8XUmwRU05vVIxzaFyQNaPu67VbjF3q/SY87UYRnQCNUHeMoaRmxRbiyp0zo4GNI7pGME66djvVCq07DxBWCiXGuSwgWDGM/qpY7pWBFxzPJyl7aWGD0Ds/NtibMfAod3NsvOmaXGT4i8edZGcqSGGP6r01FegQGOYC4THUlyMSbmppcdKcFMrHWraeon77AgtgR5+HvDep4eHM=">
        <input style="display: none;" id="submitbtn" type="submit" value="Submit">
    </form>
    </body>
    </html>
    

    The value for the params ReqId, DPId and TransDtls is received in the response of verifyDis API.

    The response for this will be:

    Success

    
    {
        "status": true,
        "message": "SUCCESS",
        "errorcode": "",
        "data": null
    }
    

    Failure

    
    {
        "status": false,
        "message": "Something went wrong. Please try again",
        "errorcode": "AG2001",
        "data": null
    }
    

    Get Transaction Status API:

    To check whether you have authorised a particular security for selling or not, you can use transaction status API.

    API end point:

    https://apiconnect.angelone.in/rest/secure/angelbroking/edis/v1/getTranStatus

    Request type- POST

    Request Body:

    
    {
        "ReqId":"7650687246435520"
    }
    

    The value for the params ReqId, DPId and TransDtls is received in the response of verifyDis API.

    Response Body:

    
    {
        "status": true,
        "message": "SUCCESS",
        "errorcode": "",
        "data": {
        "TransResDtls": {
          "ReqId": "1278983622820067",
          "ReqType": "D",
          "ResId": "1603202259241073",
          "ResStatus": "0",
          "ResTime": "17032022000022",
          "ResError": "",
          "Remarks": "",
          "RecordResDtls": [
            {
              "TxnReqId": "7659729424908225",
              "TxnId": "1603202275616752",
              "Status": "0",
              "Errorcode": ""
            }
          ]
        }
      }
    }
    

    The status key in the response indicates whether the authorization has been received or not. status = 0 implies that you’re not allowed to sell that particular security, whereas status = 1 implies that the authorisation to sell has been received.

    Postback/Webhook

    Postback URL provides real time order updates for the orders placed via APIs. The Postback URL can be specified while creating the API Key. Updates will be sent to the mapped url against the API key used to execute the orders.

    Sample Response

    
    {
        "variety": "NORMAL",
        "ordertype": "MARKET",
        "producttype": "DELIVERY",
        "duration": "DAY",
        "price": 0.0,
        "triggerprice": 0.0,
        "quantity": "1000",
        "disclosedquantity": "0",
        "squareoff": 0.0,
        "stoploss": 0.0,
        "trailingstoploss": 0.0,
        "tradingsymbol": "SBIN-EQ",
        "transactiontype": "BUY",
        "exchange": "NSE",
        "symboltoken": "3045",
        "ordertag": "10007712",
        "instrumenttype": "",
        "strikeprice": -1.0,
        "optiontype": "",
        "expirydate": "",
        "lotsize": "1",
        "cancelsize": "0",
        "averageprice": 584.7,
        "filledshares": "74",
        "unfilledshares": "926",
        "orderid": "111111111111111",
        "text": "",
        "status": "open",
        "orderstatus": "open",
        "updatetime": "09-Oct-2023 18:22:02",
        "exchtime": "09-Oct-2023 18:21:12",
        "exchorderupdatetime": "09-Oct-2023 18:21:12",
        "fillid": "",
        "filltime": "",
        "parentorderid": "",
        "clientcode": "DUMMY123"
    }
    

    NOTE:

    1. Postback service only allows the updates on HTTPS port 443
    2. For AMO orders, postback notifications will not be sent immediately at the time of placing the order after market hours. These notifications will be sent at 9:00 AM when those orders are sent to the exchange for processing.
    3. We are providing order status such as open, pending, executed, cancelled, partially executed and so on the postback call for the orders placed during market hours.

    Publisher JS plugin

    You can add one-click trade buttons to your webpage using the SmartAPI Publisher JavaScript plugin. It has a payment gateway, where an inline popup opens on your webpage, guides the user through a trade, and lands the user back on your page.

    The JavaScript plugin, or embed simple static buttons plain HTML can be used to add one or more stocks to the basket not more than 10.

    Getting Started

    <script src="https://smartapi.angelone.in/common/v1.js"></script>

    Include SmartAPI Publisher on your webpage by passing the following script tag at the end of your webpage, just before the closing </body> tag. You only need to include this once to render any number of buttons on a page.

    Branded HTML5 buttons

    You can use the custom <smartapi-button > HTML5 tag to use branded SmartAPI buttons. You can initiate a trade with a single click using these buttons. The branded buttons work in a similar fashion to social media buttons, and you can include as many as you want on a page.

    
    <!--  A link that initiates a buy (market) of the RELAINCE-EQ stock //--> 
    
    <smartapi-button href="#" data-smartapi="smartapi_key"  
    
                     data-exchange="NSE" 
    
                     data-tradingsymbol="RELIANCE-EQ"  
    
                     data-transactiontype="BUY"  
    
                     data-quantity="1"  
    
                     data-price="100" 
    
                     data-producttype="DELIVERY"  
    
                     data-ordertype="LIMIT">Buy Reliance stock</smartapi-button> 

    Custom HTML5 buttons

    You can use the HTML5 data attributes on any HTML element and turn it into a trade button which gets invoked with a single click.

    
    <!--  A link that initiates a buy (market) of the RELAINCE-EQ stock //--> 
    
    <a href="#" data-smartapi="smartapi_key"  
    
                     data-exchange="NSE" 
    
                     data-tradingsymbol="RELIANCE-EQ"  
    
                     data-transactiontype="BUY"  
    
                     data-quantity="1"  
    
                     data-price="100" 
    
                     data-producttype="DELIVERY"  
    
                     data-ordertype="LIMIT">Buy Reliance stock</a> 
    
     
    
    <!--  A button that initiates a sell (LIMIT) of the RELAINCE-EQ stock //--> 
    
    <button data-smartapi="smartapi_key"  
    
                     data-exchange="NSE" 
    
                     data-tradingsymbol="RELIANCE-EQ"  
    
                     data-transactiontype="SELL"  
    
                     data-quantity="1"  
    
                     data-price="100" 
    
                     data-producttype="DELIVERY"  
    
                     data-ordertype="LIMIT">Buy Reliance stock</button> 
    
     
    
    <!--  A button that initiates a BO of the RELIANCE-EQ stock //--> 
    
    <button data-smartapi="smartapi_key"  
    
                     data-exchange="NSE" 
    
                     data-tradingsymbol="RELIANCE-EQ"  
    
                     data-transactiontype="BUY"  
    
                     data-quantity="1"  
    
                     data-price="100" 
    
                     data-producttype="DELIVERY"  
    
                     data-ordertype="LIMIT">Buy Reliance stock (Bracket Order)</button> 
    
     

    Generating dynamic buttons with JavaScript

    You can create a basket of stocks and get the plugin to use a SmartAPI button that executes it, or link the basket to your own button (or any HTML element).

    The plugin loads it's assets asynchronously, so it's important that you initialise your custom SmartApiConnect calls after it has fully loaded. You need to use the SmartApiConnect.ready() function to achieve this.

    Parameters

    ParameterDescription
    varietyOrder variety (NORMAL & STOPLOSS . Defaults to NORMAL).
    tradingsymbolTrading symbol of the instrument
    exchangeName of the exchange (BSE, NSE or NFO)
    transactiontypeBUY or SELL
    ordertype Order type (MARKET, LIMIT, STOPLOSS_MARKET, & STOPLOSS_LIMIT)
    quantityQuantity to transact
    producttype For BSE & NSE, product type can be INTRADAY, MARGIN, DELIVERY, AMO_DELIVERY or AMO_MARGIN.For NFO type, product type can be CARRYFORWARD, AMO_CARRYFORWARD or INTRADAY.
    priceFor LIMIT orders.
    triggerpriceFor STOPLOSS_MARKET & STOPLOSS_LIMIT ordertype only.
    stoploss (TBA later) Stoploss price (for ROBO).
    squareoff (TBA later) Squareoff price / target price (for ROBO)
    trailingstoploss (TBA later) Trailing stoploss price (for ROBO)
    disclosequantity Quantity to disclose publicly (for equity trades)
    validityOrder validity (DAY or IOC)
    readonlyDefault is false. If set to true, the UI does not allow the user to edit values such as quantity, price etc., and they can only review and execute.

    Methods

    MethodArgumentsDescription
    SmartApiConnect.ready() function() Safe wrapper for all API calls that waits asynchronously for all assets to load.
    add() entry Adds an object literal {} with the parameters mentioned in the previous section represeting a single trading entry to the basket.
    get() Returns an array[] of all added entries.
    count() Returns the number of added entries.
    setOption() key, value Sets the value for certain supported keys.
    redirect_url A redirect URL to override the registered SmartApi Connect redirect URL (using setOption()). The value can be a single '#', a 127.0.0.1 url for testing, or a fully qualified URL belonging to the same domain as the registered URL.
    renderButton() element_selector Renders a branded SmartApi button in the given target element, which when clicked, will start the transaction in an overlay popup. element_selector is an HTML selector, for example, #buy-button, .buttons etc.
    link() element_selector Links the basket to the given HTML element, which when clicked, will start the transaction in an overlay popup. element_selector is an HTML selector, for example, #buy-button, .buttons etc.
    finished()function(status, acess_token) Register a callback which is triggered after order placement is finished.
    
    <!-- A SmartAPI button will be generated inside this container //--> 
    
    <p id="default-button"> </p> 
    
     
    
    <!-- The basket will be linked to this element's onClick //--> 
    
    <button id="custom-button">Buy the basket</button> 
    
     
    
    <!-- Include the plugin //--> 
    
    <script src="https://smartapi.angelone.in/common/v1.js"></script>  
    
     
    
    <script> 
    
    // Only run your custom code once SmartApiConnect has fully initialised. 
    
    // Use SmartApiConnect.ready() to achieve this. 
    
    SmartApiConnect.ready(function () { 
    
    // Initialize a new SmartAPI instance. 
    
          // You can initialize multiple instances if you need. 
    
    var smartApi = new SmartApiConnect("your_api_key"); 
    
    // Add a stock to the basket 
    
    smartApi.add({ 
    
    "exchange": "NSE", 
    
    "tradingsymbol": "INFY-EQ", 
    
    "quantity": 5, 
    
    "disclosedquantity": 3, 
    
    "transactiontype": "BUY", 
    
    "ordertype": "STOPLOSS_MARKET", 
    
    "variety": "STOPLOSS", 
    
    "producttype": "AMO_MARGIN", 
    
    }); 
    
    // Add another stock 
    
    smartApi.add({ 
    
    "exchange": "NSE", 
    
    "tradingsymbol": "SBIN-EQ", 
    
    "quantity": 1, 
    
    "ordertype": "LIMIT", 
    
    "transactiontype": "SELL", 
    
    "price": 105, 
    
    "producttype": "MARGIN", 
    
    }); 
    
     
    
    smartApi.add({ 
    
    "tradingsymbol": "RELIANCE-EQ", 
    
    "exchange": "NSE", 
    
    "transactiontype": "BUY", 
    
    "ordertype": "LIMIT", 
    
    "producttype": "AMO_DELIVERY", 
    
    "price": 915.15, 
    
    "quantity": 1, 
    
    "variety": "NORMAL", 
    
    "readonly": true 
    
    }); 
    
    smartApi.link("#type-one"); 
    
    smartApi.finished(function (status,acess_token) {
        console.log('smartApi.finished  Status',status);
        console.log('smartApi.finished  Tokens',acess_token);
    });
    
    }); 
    
    </script> 

    WebSocket Streaming 2.0


    • Web Socket URL

    • Features

    • Request Headers for Authentication

    • Response Headers for Authentication Errors

    • Heartbeat message

      • Request Contract

      • JSON Request

      • Smaple

      • Field Description

        Response Contract

      • Section-1) Payload

      • Section-2) Best Five Data

        Error Response

      • Sample

      • Error Code

    WebSocket URL

    wss://smartapisocket.angelone.in/smart-stream

    Features


  • Simplified and consistent request (JSON) and response (binary) structure.

  • Simplified heartbeat message and response.

  • Each client code (Angel One trading account id) can have up to three concurrent WebSocket connection

  • No need to kill the connection and reconnect for subscribing and unsubscribing. The existing open connection can be used to subs and unsubs in real-time

  • Any failure in subscription requests will not impact existing subscriptions and the client will continue to get the feed.

  • If the client sends an unsubs request for the tokens which are not subscribed then the system will gracefully ignore the request without impacting the feed for currently subscribed tokens

  • The total limit/quota of token subscriptions is 1000 per WebSocket session.

  • For example: If the client subscribes to Infosys NSE with LTP, Quote, and SnapQuote mode then this will be counted as 3 subscriptions.


    Duplicate subscriptions to the same token and mode will be gracefully ignored and will not be counted towards the quota


  • The client will receive one tick per token_mode combination

  • For example: If the client subscribes to Infosys NSE with LTP, Quote, and SnapQuote mode then 1 tick will be published for each mode, containing respective fields.


    The recommendation is to subscribe to one mode at a time for a token.


    Request Headers for Authentication

    FieldMandatoryDescription
    AuthorizationYesjwt auth token received from Login API
    x-api-key YesAPI key
    x-client-codeYesclient code (Angel Onetrading account id)
    x-feed-tokenYesfeed token received fromLogin API

    Response Headers for Authentication Errors


    FieldMandatoryDescriptionValid Values
    x-error-messageNo

      Along with HTTP status code 401, the responseheader will contain textual description of why auth failed.

      Invalid Header - Invalid Auth token

      Invalid Header - Invalid Client Code

      Invalid Header - Invalid API Key Invalid

      Header - Invalid Feed Token

    For Users using Browser Based clients for websocket

    For users using browser based clients for websocket streaming, please append the query params in the url in the given format to make connection

    wss://smartapisocket.angelone.in/smart-stream?clientCode=&feedToken=&apiKey=
    Query ParamMandatoryDescription
    clientCodeYesAngel One Client Code
    feedTokenYesfeedToken received in login response
    apiKeyYesYour API Key

    Note : Please note that all error handling and status codes will remain the same.


    Heartbeat message


  • The client must send a heartbeat message for each WebSocket connection every 30 sec to keep the connection alive.

  • Heartbeat request (text):

  • ping

  • Heartbeat response (text):

  • pong

    Request Contract


    JSON Request

    Sample

    {
         "correlationID": "abcde12345",
         "action": 1,
         "params": {
              "mode": 1,
              "tokenList": [
                   {
                        "exchangeType": 1,
                        "tokens": [
                             "10626",
                             "5290"
                        ]
                   },
                   {
                        "exchangeType": 5,
                        "tokens": [
                             "234230",
                             "234235",
                             "234219"
                        ]
                   }
              ]
         }
    }

    Field Description

    FieldTypeMandatory (M) / Optional(O)DescriptionValid Values
    correlationIDStringO

      A 10 character alphanumeric ID client may provide which will be returned by the server in error response to indicate which request generated error response.

      Clients can use this optional ID for tracking purposes between request and corresponding error response.
    actionIntegerM

      action

      1 (Subscribe)

      0 (Unsubscribe)
    paramsJSON ObjectM
    modeIntegerM

      Subscription Type as per this.

      1 (LTP)

      2 (Quote)

      3 (Snap Quote)

      4 (20-Depth)
    tokenList[]array of JSONObjectsM

      list of tokens per exchange
    tokenList[].exchangeTypeIntegerM

      exchange type

      1 (nse_cm)

      2 (nse_fo)

      3 (bse_cm)

      4 (bse_fo)

      5 (mcx_fo)

      7 (ncx_fo)

      13 (cde_fo)
    tokenList[].tokensList of StringsM

      tokens to subscribe.Refer Master Scrip for token by stock

    Response Contract for LTP, Quote and Snap Quote mode


    Response is in binary format with Little Endian byte order.


    Section-1) Payload


    FieldDataType Size (in bytes) Field Start Position(Index in Byte Array)DescriptionValid Values
    1Subscription Modebyte/int810

      Subscription Type such as LTP, Quote, Snap Quote

      1 (LTP)

      2 (Quote)

      3 (Snap Quote)

      4 (20-Depth)
    2Exchange Type byte/int8 11

      1 (nse_cm)

      2 (nse_fo)

      3 (bse_cm)

      4 (bse_fo)

      5 (mcx_fo)

      7 (ncx_fo)

      13 (cde_fo)
    3Tokenbyte array252

      Token Id in characters encoded as byte array. One byte represents one utf-8 encoded character.

      Null char signifies the end of characters i.e. \0000u in Java
    4Sequence Numberint64/long827
    5Exchange Timestampint64/long835

      Exchange feed timestamp in epoch milliseconds
    6Last Traded Price (LTP)(If mode is ltp, the packet ends here.packet size = 51 bytes)int32843

      All prices are in paise. For currencies, the int 32 price values should be divided by 10000000.0 to obtain four decimal places. For everything else, the price values should be divided by 100.
    7Last traded quantityint64/long851
    8Average traded priceint64/long859
    9Volume traded for the dayint64/long867
    10Total buy quantitydouble875
    11Total sell quantitydouble883
    12Open price of the dayint64/long891
    13High price of the dayint64/long899
    14Low price of the dayint64/long8107
    15Close price(If mode is quote,the packet ends here.packet size = 123 bytes)int64/long8115
    16Last traded timestampint64/long8123
    17Open Interestint64/long8131
    18Open Interest change % (this is a dummy field. contains garbage value)double8139
    19Best Five DataArray containing 10 packets. Each packet having 20 bytes.200147

      sequence of best five buys data,followed by best five sells.(refer Section-2) Best Five Data)
    20Upper circuit limit 8347
    21Lower circuit limit8355
    2252 week high price8363
    2352 week low price(If mode is snapquote, the packet ends here. packet size = 379 bytes)8371

    NOTE - Sequence number for index feed is not available. please ignore the sequence number for index feed in the websocket response.


    Section-2) Best Five Data


    FieldDataType Size (in bytes) Field Start Position(Index in Byte Array)DescriptionValid Values
    Buy/Sell Flag int1620Flag to indicate whether this packet is for buy or sell data

      1 (buy)

      0 (sell)
    Quantityint6482Buy/Sell Quantity
    Priceint64810Buy/Sell Price
    Number of Ordersint16218Buy/Sell Orders

    Section-3) Response Contract for 20-Depth Mode


    FieldDataType Size (in bytes) Field Start Position(Index in Byte Array)DescriptionValid Values
    Subscription Typebyte/int810Subscription Type such as LTP, Quote, Snap Quote

      4 (Depth20)
    Exchange Typebyte/int811

      1 (nse_cm)
    Tokenbyte array252Token Id in characters encoded as byte array. One byte represents one utf-8 encoded character. Null char signifies the end of characters i.e. \0000u in Java.

      Exchange Timestampint64/long827Exchange feed timestamp in epoch milliseconds

        <NA>
      dummyPlaceholder int64/long835A placeholder field for future use. Currently holds 0 as a default value.

        <NA>
      Best Twenty Buy DataArray containing 20 packets. Each packet having 10 bytes.20043sequence of best Twenty buys data (refer Section-4) Best Twenty Data)

        Best Twenty Sell DataArray containing 20 packets. Each packet having 10 bytes.200243sequence of best Twenty Sell data (refer Section-4) Best Twenty Data)


          Section-4) Best Twenty Data


          FieldDataType Size (in bytes) Field Start Position(Index in Byte Array)DescriptionValid Values
          Quantityint3240Buy/Sell Quantity
          Priceint3244Buy/Sell Price
          Number of Ordersint1628Buy/Sell Orders

          NOTE:

          1. For 20-Depth Mode, the maximum no of tokens/scrips that can be subscribed in a single websocket connection is 50.


          Error Response

          Sample


          {
               "correlationID": "abcde12345",
               "errorCode": "E1002",
               "errorMessage": "Invalid Request. Subscription Limit Exceeded"
          }

          Error Codes

          Error CodeError Message
          E1001Invalid Request Payload.
          E1002Invalid Request. Subscription Limit Exceeded.

          NOTE:

          1. 20-Depth Mode is available only for NSE_CM segment
          2. Packet Received Time is a dummy value and will be deprecated soon.

          Websocket Order Status

          Websocket Order Status API will function in providing order status updates through websocket server connection and provide Order responses similar to the one received in Postback/Webhook. The connection can be made to the Websocket Server API using below url and input parameters.

          To connect to the WebSocket, clients need to use the following URL:-

          wss://tns.angelone.in/smart-order-update

          In the WebSocket connection request, include the following Header key:-

          Authorization: Bearer AUTHORIZATION_TOKEN

          Please note that there is a connection limit for each user. Each client code is limited to 3 connections.

          Initial Response: Upon successfully connecting to the WebSocket, you will receive an initial response in the following format:

          {
               "user-id": "Your_client_code",
               "status-code": "200",
               "order-status": "AB00",
               "error-message": "",
               "orderData": {
                    "variety": "",
                    "ordertype": "",
                    "ordertag": "",
                    "producttype": "",
                    "price": 0,
                    "triggerprice": 0,
                    "quantity": "0",
                    "disclosedquantity": "0",
                    "duration": "",
                    "squareoff": 0,
                    "stoploss": 0,
                    "trailingstoploss": 0,
                    "tradingsymbol": "",
                    "transactiontype": "",
                    "exchange": "",
                    "symboltoken": "",
                    "instrumenttype": "",
                    "strikeprice": 0,
                    "optiontype": "",
                    "expirydate": "",
                    "lotsize": "0",
                    "cancelsize": "0",
                    "averageprice": 0,
                    "filledshares": "",
                    "unfilledshares": "",
                    "orderid": "",
                    "text": "",
                    "status": "",
                    "orderstatus": "",
                    "updatetime": "",
                    "exchtime": "",
                    "exchorderupdatetime": "",
                    "fillid": "",
                    "filltime": "",
                    "parentorderid": ""
               }
          }

          The order-status field can have values like:

          Sr. NoStatus CodeDescription
          1AB00after-successful connection
          2AB01open
          3AB02cancelled
          4AB03rejected
          5AB04modified
          6AB05complete
          7AB06after market order req received
          8AB07cancelled after market order
          9AB08modify after market order req received
          10AB09open pending
          11AB10trigger pending
          12AB11modify pending

          Client Interaction:

          The client application should periodically send a ping message to the server and expect a pong message from the server every 10 seconds. This helps check the liveliness of the WebSocket connection.

          Sample Response:

          Here's an example of a response you might receive from the WebSocket:

          {
               "user-id": "Your_client_code",
               "status-code": "200",
               "order-status": "AB03",
               "error-message": "",
               "orderData": {
                    "variety": "NORMAL",
                    "ordertype": "LIMIT",
                    "ordertag": "10007712",
                    "producttype": "DELIVERY",
                    "price": 551,
                    "triggerprice": 0,
                    "quantity": "1",
                    "disclosedquantity": "0",
                    "duration": "DAY",
                    "squareoff": 0,
                    "stoploss": 0,
                    "trailingstoploss": 0,
                    "tradingsymbol": "SBIN-EQ",
                    "transactiontype": "BUY",
                    "exchange": "NSE",
                    "symboltoken": "3045",
                    "instrumenttype": "",
                    "strikeprice": -1,
                    "optiontype": "",
                    "expirydate": "",
                    "lotsize": "1",
                    "cancelsize": "0",
                    "averageprice": 0,
                    "filledshares": "0",
                    "unfilledshares": "1",
                    "orderid": "111111111111111",
                    "text": "Adapter is Logged Off",
                    "status": "rejected",
                    "orderstatus": "rejected",
                    "updatetime": "25-Oct-2023 23:53:21",
                    "exchtime": "",
                    "exchorderupdatetime": "",
                    "fillid": "",
                    "filltime": "",
                    "parentorderid": ""
               }
          }

          Error Codes:

          Sr. NoError CodeDescription
          1401If the AUTHORIZATION_TOKEN is invalid, you will receive a 401 Response Code.
          2403If the AUTHORIZATION_TOKEN is expired, you will receive a 403 Response Code.
          3429If you breach the connection limit, you will receive a 429 Response Code.

          Instruments

          Request TypeEndpointDescription
          GEThttps://margincalculator.angelone.in/OpenAPI_File/files/OpenAPIScripMaster.jsonRetrieve the CSV dump of all tradable instruments
          POSThttps://apiconnect.angelone.in/order-service/rest/secure/angelbroking/order/v1/getLtpDataRetrieve LTP quotes for one or more instruments
          GEThttps://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/nseIntradayNSE Scrips Allowed for Intraday
          GEThttps://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/bseIntradayBSE Scrips Allowed for Intraday

          Various kinds of instruments exist between multiple exchanges and segments that trade. Any application that facilitates trading needs to have a master list of these instruments. The instruments API provides a consolidated, import-ready CSV list of instruments available for trading.

          Fetching the full instrument list

          The instrument list API returns a gzipped CSV dump of instruments across all exchanges that can be imported into a database. The dump is generated once every day and hence last_price is not real time.

          https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json

          This is the only URL for fetching instrument data as below:.

          [{“token":"2885","symbol":"RELIANCE-EQ","name":"RELIANCE","expiry":"","strike":"-1.000000","lotsize":"1","instrumenttype":"","exch_seg":"nse_cm","tick_size":"5.000000”}, …] 

          Fetching LTP quotes for instrument

          Note: Authorization header is mandatory here.

          Request:

          {
               "exchange": "NSE",
               "tradingsymbol": "SBIN-EQ",
               "symboltoken": "3045"
          }

          Response:

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "exchange": "NSE",
                    "tradingsymbol": "SBIN-EQ",
                    "symboltoken": "3045",
                    "open": "18600",
                    "high": "19125",
                    "low": "18500",
                    "close": "18780",
                    "ltp": "19100"
               }
          }

          Fetching Token for Individual Scrips

          Tokens of Individual scrips can be looked up by the use of Search Scrip API.

          https://apiconnect.angelone.in/rest/secure/angelbroking/order/v1/searchScrip

          Note: Please note that only one Scrip is permitted per request.

          Request:

          {
               "exchange": "NSE",
               "searchscrip": "SBIN"
          }

          Response:

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": [
                    {
                         "exchange": "NSE",
                         "tradingsymb{ol": "SBIN-AF",
                         "symboltoken": "11128"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-BE",
                         "symboltoken": "4884"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-BL",
                         "symboltoken": "12740"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-EQ",
                         "symboltoken": "3045"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-IQ",
                         "symboltoken": "28450"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-RL",
                         "symboltoken": "16382"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-U3",
                         "symboltoken": "22351"
                    },
                    {
                         "exchange": "NSE",
                         "tradingsymbol": "SBIN-U4",
                         "symboltoken": "22353"
                    }
               ]
          }

          CSV response columns

          ColumnDescription
          exchange_tokenstring The numerical identifier issued by the exchange representing the instrument.
          tradingsymbolstringExchange tradingsymbol of the instrument
          namestring Name of the company (for equity instruments)
          expirystring Expiry date (for derivatives)
          strikefloat Strike (for options)
          tick_sizefloat Value of a single price tick
          lot_sizeint Quantity of a single lot
          instrument_typestring EQ, FUT, CE, PE
          
          var axios = require('axios');
          var data = JSON.stringify({
              "exchange": "NSE",
              "tradingsymbol": "SBIN-EQ",
              "symboltoken": "3045"
          
          });
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            order-service/rest/secure/angelbroking/order/
            v1/getLtpData',
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType,
              "{\n     
                  \"symbol_token\": 11915\n
              }");
          
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            order-service/rest/secure/angelbroking/order/
            v1/getLtpData")
            .method("POST", body)
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("X-UserType", "USER")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-PrivateKey", "API_KEY")
            .build();
          Response response = client.newCall(request).execute();
          
          import http.client
          import mimetypes
          conn = http.client.HTTPSConnection(
              "apiconnect.angelone.in"
              )
          payload = "{\n     \"exchange\": \"NSE\",\n 
              \"tradingsymbol\": \"SBIN-EQ\",\n     
              \"symboltoken\": \"3045\"\n}"
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("POST", 
          "/order-service/rest/secure/angelbroking/order/
          v1/getLtpData", 
          payload, 
          headers)
          
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          order-service/rest/secure/angelbroking/order/
          v1/getLtpData"
          
          json_body <- jsonlite::toJSON(list(
              "exchange": "NSE",
              "tradingsymbol": "SBIN-EQ",
              "symboltoken": "3045"
          
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
          
          
          package main
          
          import (
            "fmt"
            "strings"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            order-service/rest/secure/angelbroking/order/v1/getLtpData"
            method := "POST"
          
            payload := strings.NewReader({
              "exchange": "NSE",
              "tradingsymbol": "SBIN-EQ",
              "symboltoken": "3045"
          
              })
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, payload)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }

          Scrips Allowed for Intraday trading

          To find out which of the scrips are allowed for Intraday trading along with their respective multipliers for margin trading, you can use the following APIs.

          For NSE

          https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/nseIntraday

          Response:

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": [
                    {
                         "Exchange": "NSE",
                         "SymbolName": "CHEMPLASTS",
                         "Multiplier": "5.0"
                    },
                    {
                         "Exchange": "NSE",
                         "SymbolName": "SANGHVIMOV",
                         "Multiplier": "5.0"
                    }
               ]
          }

          For BSE

          https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/bseIntraday

          Response:

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": [
                    {
                         "Exchange": "BSE",
                         "SymbolName": "TAALENT",
                         "Multiplier": "1.0"
                    },
                    {
                         "Exchange": "BSE",
                         "SymbolName": "ARE&M",
                         "Multiplier": "5.0"
                    }
               ]
          }

          
          var axios = require('axios');
          var data = '';
          
          var config = {
            method: 'get',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/marketData/
            v1/nseIntraday',
          
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
          rest/secure/angelbroking/marketData
          /v1/nseIntraday")
          
            .method("GET", null)
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("X-UserType", "USER")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-PrivateKey", "API_KEY")
            .build();
          Response response = client.newCall(request).execute();
          
          import http.client
          import mimetypes
          conn = http.client.HTTPSConnection(
              " apiconnect.angelone.in "
              )
          payload = ''
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("GET", 
          "/rest/secure/angelbroking/marketData/v1/nseIntraday", 
          payload, 
          headers)
          
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/marketData/
          v1/nseIntraday"
          
          response <- GET(url, add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
          
          print(response)
          
          
          package main
          
          import (
            "fmt"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            rest/secure/angelbroking/marketData/v1/nseIntraday"
            method := "GET"
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, nil)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }

          ChangeLog



          SmartAPI v1.0.0

          GTT calls added with GTT Error Codes

          GTT

          New GTT call added

          • Create Rule
          • Modify Rule
          • Cancel Rule
          • Rule Details
          • Rule List

          GTT

          The currently supported exchange types are NSE and BSE only and the product types supported are DELIVERY and MARGIN only for now

          Request TypeAPI'sEndpointDescription
          POSTCreate Rule https://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/createRule Create GTT Rule
          POSTModify Rule https://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/modifyRule Modify GTT Rule
          POSTCancel Rulehttps://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/cancelRule Cancel GTT Rule
          POSTRule Details https://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/ruleDetails Get GTT Rule Details
          POSTRule List https://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/ruleListGet GTT Rule List

          GTT Error Codes

          Sr. NoError CodeDescription
          1AB9000Internal Server Error
          2AB9001Invalid Parameters
          3AB9002Method Not Allowed
          4AB9003Invalid Client ID
          5AB9004Invalid Status Array Size
          6AB9005Invalid Session ID
          7AB9006Invalid Order Quantity
          8AB9007Invalid Disclosed Quantity
          9AB9008Invalid Price
          10AB9009Invalid Trigger Price
          11AB9010Invalid Exchange Segment
          12AB9011Invalid Symbol Token
          13AB9012Invalid Trading Symbol
          14AB9013Invalid Rule ID
          15AB9014Invalid Order Side
          16AB9015Invalid Product Type
          17AB9016Invalid Time Period
          18AB9017Invalid Page Value
          19AB9018Invalid Count Value

          Create Rule

          When a rule is successfully created, the API returns a rule id.

          All requests and its response structure is as below.

          Create Rule Request

          {
               "tradingsymbol": "SBIN-EQ",
               "symboltoken": "3045",
               "exchange": "NSE",
               "transactiontype": "BUY",
               "producttype": "DELIVERY",
               "price": "195",
               "qty": "1",
               "triggerprice": "196",
               "disclosedqty": "10"
          }

          Create Rule Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "id": "1"
               }
          }
          
          var axios = require('axios');
          var data = JSON.stringify({"tradingsymbol":"SBIN-EQ",
          "symboltoken":"3045","exchange":"NSE","transactiontype":"BUY",
          "producttype":"DELIVERY","price":"195","qty":"1",
          "triggerprice":"196","disclosedqty":"10"});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/v1/createRule',
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
          .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n  
                \"tradingsymbol\": \"SBIN-EQ\",\r\n   
                 \"symboltoken\": \"3045\",\r\n    \"exchange\": \"NSE\",\r\n   
                  \"transactiontype\": \"BUY\",\r\n    \"producttype\": \"DELIVERY\",\r\n   
                   \"price\": \"195\",\r\n    \"qty\": \"1\",\r\n  
                     \"triggerprice\": \"196\",\r\n    \"disclosedqty\": \"10\"\r\n   
                      }");
          Request request = new Request.Builder()
          .url("https://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/createRule")
          .method("POST", body)
          .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
          .addHeader("Content-Type", "application/json")
          .addHeader("Accept", "application/json")
          .addHeader("X-UserType", "USER")
          .addHeader("X-SourceID", "WEB")
          .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
          .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
          .addHeader("X-MACAddress", "MAC_ADDRESS")
          .addHeader("X-PrivateKey", "API_KEY")
          .build();
          Response response = client.newCall(request).execute();
              
           
          
           import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n    \"tradingsymbol\": \"SBIN-EQ\",\r\n   
           \"symboltoken\": \"3045\",\r\n    \"exchange\": \"NSE\",\r\n  
             \"transactiontype\": \"BUY\",\r\n    \"producttype\": \"DELIVERY\",\r\n   
              \"price\": \"195\",\r\n    \"qty\": \"1\",\r\n 
                 \"triggerprice\": \"196\",\r\n    \"disclosedqty\": \"10\"\r\n  
                   }"
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("POST", "/rest/secure/angelbroking/
          gtt/v1/createRule", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
              
           
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/
          gtt/v1/createRule"
          json_body <- jsonlite::toJSON(list(
              "tradingsymbol":"SBIN-EQ",
              "symboltoken":"3045",
              "exchange":"NSE",
              "transactiontype":"BUY",
              "producttype":"DELIVERY",
              "price":"195",
              "qty":"1",
              "triggerprice":"196",
              "disclosedqty":"10"
          
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
           
          
           package main
          
          import (
            "fmt"
            "strings"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/v1/createRule"
            method := "POST"
          
            payload := strings.NewReader({
              "tradingsymbol":"SBIN-EQ",
              "symboltoken":"3045",
              "exchange":"NSE",
              "transactiontype":"BUY",
              "producttype":"DELIVERY",
              "price":"195",
              "qty":"1",
              "triggerprice":"196",
              "disclosedqty":"10"
          
          })
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, payload)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }
              
           

          Modify Rule

          When a rule is successfully modified, the API returns a rule id.

          All requests and its response structure is as below.

          Modify Rule Request

          {
               "id": "1",
               "symboltoken": "3045",
               "exchange": "NSE",
               "price": "195",
               "qty": "1",
               "triggerprice": "196",
               "disclosedqty": "10"
          }

          Modify Rule Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "id": "1"
               }
          }
          
          var axios = require('axios');
          var data = JSON.stringify({"id":"1","symboltoken":"3045",
          "exchange":"NSE","price":"195","qty":"1",
          "triggerprice":"196","disclosedqty":"10"});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/v1/modifyRule',
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
             
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n    \"id\": \"1\",\r\n 
             \"symboltoken\": \"3045\",\r\n    \"exchange\": \"NSE\",\r\n    \"price\": \"195\",\r\n 
                \"qty\": \"1\",\r\n    \"triggerprice\": \"196\",\r\n   
                 \"disclosedqty\": \"10\",\r\n }");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/rest/secure/angelbroking/gtt/v1/modifyRule")
            .method("POST", body)
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("X-UserType", "USER")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-PrivateKey", "API_KEY")
            .build();
          Response response = client.newCall(request).execute();
             
          
          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n    \"id\": \"1\",\r\n 
             \"symboltoken\": \"3045\",\r\n    \"exchange\": \"NSE\",\r\n   
              \"price\": \"195\",\r\n    \"qty\": \"1\",\r\n   
               \"triggerprice\": \"196\",\r\n    \"disclosedqty\": \"10\",\r\n 
                  }"
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("POST", "/rest/secure/angelbroking/gtt/v1/modifyRule", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
             
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/gtt/
          v1/modifyRule"
          json_body <- jsonlite::toJSON(list(
              "id": "1",
              "symboltoken":"3045",
              "exchange":"NSE",
              "price":"195",
              "qty":"1",
              "triggerprice":"196",
              "disclosedqty":"10"
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
          
          
          package main
          
          import (
            "fmt"
            "strings"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/v1/modifyRule"
            method := "POST"
          
            payload := strings.NewReader({
              "id": "1",
              "symboltoken":"3045",
              "exchange":"NSE",
              "price":"195",
              "qty":"1",
              "triggerprice":"196",
              "disclosedqty":"10"
              
          })
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, payload)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }
             
          

          Cancel Rule

          When a rule is successfully cancelled, the API returns a rule id.

          All requests and its response structure is as below.

          Cancel Rule Request

          {
               "id": "1",
               "symboltoken": "3045",
               "exchange": "NSE"
          }

          Cancel Rule Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "id": "1"
               }
          }
          
          var axios = require('axios');
          var data = JSON.stringify({"id":"1","symboltoken":"3045",
          "exchange":"NSE"});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/v1/cancelRule\n',
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
             
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n    \"id\": \"1\",\r\n 
             \"symboltoken\": \"3045\",\r\n    \"exchange\": \"NSE\"\r\n}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/v1/cancelRule
          ")
            .method("POST", body)
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("X-UserType", "USER")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-PrivateKey", "API_KEY")
            .build();
          Response response = client.newCall(request).execute();
          }
             
          
          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n    \"id\": \"1\",\r\n   
           \"symboltoken\": \"3045\",\r\n    \"exchange\": \"NSE\"\r\n}"
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("POST", "/rest/secure/angelbroking/gtt/v1/cancelRule
          ", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/
          gtt/v1/cancelRule"
          json_body <- jsonlite::toJSON(list(
              "id": "1",
              "symboltoken":"3045",
              "exchange":"NSE"
          
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
             
          
          
          package main
          
          import (
            "fmt"
            "strings"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            rest/secure/angelbroking/
            gtt/v1/cancelRule%0A"
            method := "POST"
          
            payload := strings.NewReader({
              "id": "1",
              "symboltoken":"3045",
              "exchange":"NSE"
          })
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, payload)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }
             
          

          Rule Details Request

          When a rule is successfully fetched, the API returns complete details of the rule.

          All requests and its response structure is as below.

          Rule Details Request

          {
               "id": "1"
          }

          Rule Details Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "status": "NEW",
                    "createddate": "2020-11-16T14:19:51Z",
                    "updateddate": "2020-11-16T14:28:01Z",
                    "expirydate": "2021-11-16T14:19:51Z",
                    "clientid": "100",
                    "tradingsymbol": "SBIN-EQ",
                    "symboltoken": "3045",
                    "exchange": "NSE",
                    "transactiontype": "BUY",
                    "producttype": "DELIVERY",
                    "price": "195",
                    "qty": "1",
                    "triggerprice": "196",
                    "disclosedqty": "10"
               }
          }
          
          var axios = require('axios');
          var data = JSON.stringify({"id":"1"});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/
            v1/ruleDetails',
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
             
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType,
               "{\r\n    \"id\": \"1\"\r\n}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            rest/secure/angelbroking/
            gtt/v1/ruleDetails")
            .method("POST", body)
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("X-UserType", "USER")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-PrivateKey", "API_KEY")
            .build();
          Response response = client.newCall(request).execute();
             
          
          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n    \"id\": \"1\"\r\n}"
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("POST", "/rest/secure/angelbroking/
          gtt/v1/ruleDetails", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
             
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/
          gtt/v1/ruleDetails"
          json_body <- jsonlite::toJSON(list(
              "id": "1",
          
          ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
             
          
          
          package main
          
          import (
            "fmt"
            "strings"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/
            v1/ruleDetails"
            method := "POST"
          
            payload := strings.NewReader({
          
              "id": "1",
          
          })
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, payload)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }
             
          

          Rule List Request

          When a list of rules is successfully fetched, the API returns complete details for the list of rules.

          All requests and its response structure is as below.

          Rule List Request

          {
               "status": [
                    "NEW",
                    "CANCELLED",
                    "ACTIVE",
                    "SENTTOEXCHANGE",
                    "FORALL"
               ],
               "page": 1,
               "count": 10
          }

          Rule List Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "clientid": "100",
                    "createddate": "2020-11-16T14:19:51Z",
                    "exchange": "NSE",
                    "producttype": "DELIVERY",
                    "transactiontype": "BUY",
                    "expirydate": "2021-11-16T14:19:51Z",
                    "id": "1",
                    "qty": "1",
                    "price": "195",
                    "status": "NEW",
                    "symboltoken": "3045",
                    "tradingsymbol": "SBIN-EQ",
                    "triggerprice": "196",
                    "updateddate": "2020-11-16T14:28:01Z"
               }
          }
          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n    \"status\": [\r\n        \"NEW\",\r\n     
             \"CANCELLED\",\r\n        \"ACTIVE\",\r\n      
               \"SENTTOEXCHANGE\",\r\n        \"FORALL\"\r\n    ],
               \r\n    \"page\": 1,\r\n    \"count\": 10\r\n}"
          headers = {
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-UserType': 'USER',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-PrivateKey': 'API_KEY'
          }
          conn.request("POST", "/rest/secure/angelbroking/gtt/v1/ruleList
          ", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
             
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n  
                \"status\": [\r\n        \"NEW\",\r\n       
                 \"CANCELLED\",\r\n        \"ACTIVE\",\r\n   
                      \"SENTTOEXCHANGE\",\r\n        \"FORALL\"\r\n    ],
                      \r\n    \"page\": 1,\r\n    \"count\": 10\r\n}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/
            v1/ruleList"
            )
            .method("POST", body)
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Content-Type", "application/json")
            .addHeader("Accept", "application/json")
            .addHeader("X-UserType", "USER")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-PrivateKey", "API_KEY")
            .build();
          Response response = client.newCall(request).execute();
             
          
          
          var axios = require('axios');
          var data = JSON.stringify({"status":["NEW",
          "CANCELLED","ACTIVE","SENTTOEXCHANGE",
          "FORALL"],"page":1,"count":10});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/
            gtt/v1/ruleList\n',
            headers: { 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json', 
              'Accept': 'application/json', 
              'X-UserType': 'USER', 
              'X-SourceID': 'WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-PrivateKey': 'API_KEY'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
             
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/
          gtt/v1/ruleList"
          json_body <- jsonlite::toJSON(list(
              "status": [
                  "NEW",
                  "CANCELLED",
                  "ACTIVE",
                  "SENTTOEXCHANGE",
                  "FORALL"
              ],
              "page": 1,
              "count": 10
          
          ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
             
          
          
          package main
          
          import (
            "fmt"
            "strings"
            "net/http"
            "io/ioutil"
          )
          
          func main() {
          
            url := "https://apiconnect.angelone.in/
            rest/secure/angelbroking/gtt/
            v1/ruleList%0A"
            method := "POST"
          
            payload := strings.NewReader({
              "status": [
                  "NEW",
                  "CANCELLED",
                  "ACTIVE",
                  "SENTTOEXCHANGE",
                  "FORALL"
              ],
              "page": 1,
              "count": 10
          })
          
            client := &http.Client {
            }
            req, err := http.NewRequest(method, url, payload)
          
            if err != nil {
              fmt.Println(err)
              return
            }
            req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
            req.Header.Add("Content-Type", "application/json")
            req.Header.Add("Accept", "application/json")
            req.Header.Add("X-UserType", "USER")
            req.Header.Add("X-SourceID", "WEB")
            req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            req.Header.Add("X-MACAddress", "MAC_ADDRESS")
            req.Header.Add("X-PrivateKey", "API_KEY")
          
            res, err := client.Do(req)
            if err != nil {
              fmt.Println(err)
              return
            }
            defer res.Body.Close()
          
            body, err := ioutil.ReadAll(res.Body)
            if err != nil {
              fmt.Println(err)
              return
            }
            fmt.Println(string(body))
          }
             
          

          Live Market Data API

          The Live Market Data API provides real-time market data for specific symbols, allowing clients to make informed trading and investment decisions. The API offers three distinct modes: LTP, OHLC, and FULL, each delivering varying levels of comprehensive market information.

          https://apiconnect.angelone.in/rest/secure/angelbroking/market/v1/quote/

          Modes

          ModesDescription
          LTP ModeRetrieve the latest Last Traded Price (LTP) for a specified exchange and symbol.
          OHLC ModeRetrieve the Open, High, Low, and Close prices for a given exchange and symbol.
          Full ModeAccess an extensive set of data for a specified exchange and symbol. This mode provides a comprehensive range of data points, including LTP, open, high, low, close prices, last trade quantity, exchange feed time, exchange trade time, net change, percent change, average price, trade volume, open interest, circuit limits, total buying and selling quantity, 52-week low, 52-week high, and depth information for the best five buy and sell orders.

          Supported Exchanges

          All exchanges are supported.

          Number of tokens supported in one request:

          The market data API allows you to fetch data for 50 symbols in just one request with a rate limit of 1 request per second

          Request Format

          ModeSample Request
          Full Mode{ "mode": "FULL", "exchangeTokens": { "NSE": ["3045","881"], "NFO": ["58662"]} }
          OHLC Mode{ "mode": "OHLC", "exchangeTokens": { "NSE": ["3045","881"], "NFO": ["58662"]} }
          LTP Mode{ "mode": "LTP", "exchangeTokens": { "NSE": ["3045","881"], "NFO": ["58662"]} }

          Response Format

          The response is a JSON object containing the requested stock market data:

          1. status: A boolean indicating whether the request was successful.
          2. message: A string describing the status of the request.
          3. errorcode: A string providing specific error codes, if any.
          4. data: An object containing the fetched market data and any unfetched data with errors.
          Sample Response (FULL Mode):
          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "fetched": [
                         {
                              "exchange": "NSE",
                              "tradingSymbol": "SBIN-EQ",
                              "symbolToken": "3045",
                              "ltp": 568.2,
                              "open": 567.4,
                              "high": 569.35,
                              "low": 566.1,
                              "close": 567.4,
                              "lastTradeQty": 1,
                              "exchFeedTime": "21-Jun-2023 10:46:10",
                              "exchTradeTime": "21-Jun-2023 10:46:09",
                              "netChange": 0.8,
                              "percentChange": 0.14,
                              "avgPrice": 567.83,
                              "tradeVolume": 3556150,
                              "opnInterest": 0,
                              "lowerCircuit": 510.7,
                              "upperCircuit": 624.1,
                              "totBuyQuan": 839549,
                              "totSellQuan": 1284767,
                              "52WeekLow": 430.7,
                              "52WeekHigh": 629.55,
                              "depth": {
                                   "buy": [
                                        {
                                             "price": 568.2,
                                             "quantity": 511,
                                             "orders": 2
                                        },
                                        {
                                             "price": 568.15,
                                             "quantity": 411,
                                             "orders": 2
                                        },
                                        {
                                             "price": 568.1,
                                             "quantity": 31,
                                             "orders": 2
                                        },
                                        {
                                             "price": 568.05,
                                             "quantity": 1020,
                                             "orders": 8
                                        },
                                        {
                                             "price": 568,
                                             "quantity": 1704,
                                             "orders": 28
                                        }
                                   ],
                                   "sell": [
                                        {
                                             "price": 568.25,
                                             "quantity": 3348,
                                             "orders": 5
                                        },
                                        {
                                             "price": 568.3,
                                             "quantity": 4447,
                                             "orders": 13
                                        },
                                        {
                                             "price": 568.35,
                                             "quantity": 3768,
                                             "orders": 11
                                        },
                                        {
                                             "price": 568.4,
                                             "quantity": 8500,
                                             "orders": 40
                                        },
                                        {
                                             "price": 568.45,
                                             "quantity": 4814,
                                             "orders": 17
                                        }
                                   ]
                              }
                         }
                    ],
                    "unfetched": []
               }
          }
          Sample Response (OHLC Mode):
          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "fetched": [
                         {
                              "exchange": "NSE",
                              "tradingSymbol": "SBIN-EQ",
                              "symbolToken": "3045",
                              "ltp": 571.8,
                              "open": 568.75,
                              "high": 568.75,
                              "low": 567.05,
                              "close": 566.5
                         }
                    ],
                    "unfetched": []
               }
          }
          Sample Response (LTP Mode):
          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "fetched": [
                         {
                              "exchange": "NSE",
                              "tradingSymbol": "SBIN-EQ",
                              "symbolToken": "3045",
                              "ltp": 571.75
                         }
                    ],
                    "unfetched": []
               }
          }
          Sample Response (LTP Mode where data cannot be fetched):
          {
               "success": true,
               "message": "SUCCESS",
               "errorCode": "",
               "data": {
                    "fetched": [],
                    "unfetched": [
                         {
                              "exchange": "MCX",
                              "symbolToken": "",
                              "message": "Symbol token cannot be empty",
                              "errorCode": "AB4018"
                         }
                    ]
               }
          }

          Field Description

          FieldData TypeDescription
          successBooleanIndicates whether the API request was successful.
          messageStringProvides success or error message.
          errorCodeStringDisplays the error code if there was an issue with the request. Otherwise, it is blank.
          dataObjectContains the fetched and unfetched data.
          data.fetchedArrayArray of fetched data objects.
          exchangeEnum ( Values - NSE, NFO,BSE, MCX, CDS, NCDEX )The exchange for the fetched data.
          tradingSymbolStringThe trading symbol for the fetched data.
          symbolTokenStringThe token for the fetched symbol.
          ltpFloatThe last trading price for the fetched symbol.
          openFloatThe opening price for the fetched symbol.
          highFloatThe highest price for the fetched symbol.
          lowFloatThe lowest price for the fetched symbol.
          closeFloatThe previous closing price for the fetched symbol.
          lastTradeQtyIntegerThe quantity of the last trade executed for the fetched symbol.
          exchFeedTimeStringThe exchange feed time for the fetched symbol.
          exchTradeTimeStringThe exchange trade time for the fetched symbol.
          netChangeFloatThe net change for the fetched symbol.
          percentChangeFloatThe percent change for the fetched symbol.
          avgPriceFloatThe average price for the fetched symbol.
          tradeVolumeIntegerThe trade volume for the fetched symbol.
          opnInterestIntegerThe open interest for the fetched symbol.
          upperCircuitFloatMaximum price increase allowed before trading pauses temporarily.
          lowerCircuitFloatMaximum price decrease allowed before trading pauses temporarily.
          totBuyQuanIntegerThe total buy quantity for the fetched symbol.
          totSellQuanIntegerThe total sell quantity for the fetched symbol.
          52WeekHighFloatThe yearly highest price for the fetched symbol.
          52WeekLowFloatThe yearly lowest price for the fetched symbol.
          depth.buyArrayArray of buy depth objects.
          depth.buy[n].priceFloatThe price at the nth level of buy depth.
          depth.buy[n].quantityIntegerThe quantity at the nth level of buy depth.
          depth.buy[n].ordersIntegerThe number of buy orders at the nth level of market depth.
          depth.sellArrayArray of sell depth objects.
          depth.sell[n].priceFloatThe price at the nth level of sell depth.
          depth.sell[n].quantityIntegerThe quantity at the nth level of sell depth.
          depth.sell[n].ordersIntegerThe number of sell orders at the nth level of market depth.

          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = {
              "mode": "FULL",
              "exchangeTokens": {
                  "NSE": ["3045"]
              }
          }
          headers = {
            'X-PrivateKey': 'API_KEY',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-UserType': 'USER',
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'Content-Type': 'application/json'
          }
          conn.request("POST", "rest/secure/angelbroking/market/v1/quote/", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
              
           
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n   \"mode\": \"FULL\",\r\n   \"exchangeTokens\": { \"NSE\": [\"3045\"] }\r\n}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/rest/secure/angelbroking/market/v1/quote/")
            .method("POST", body)
            .addHeader("X-PrivateKey", "API_KEY")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-UserType", "USER")
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("Content-Type", "application/json")
            .build();
          Response response = client.newCall(request).execute();
              
           
          
          var axios = require('axios');
          var data = JSON.stringify({
              "mode": "FULL",
              "exchangeTokens": {
                  "NSE": ["3045"]
              }
          });
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/market/v1/quote/',
            headers: { 
              'X-PrivateKey': 'API_KEY', 
              'Accept': 'application/json, application/json', 
              'X-SourceID': 'WEB, WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-UserType': 'USER', 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/market/v1/quote/"
          json_body <- jsonlite::toJSON(list(
            mode = "FULL",
            exchangeTokens = list(
              NSE = list("3045")
            )
          ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
           
          
          package main
          
           import (
             "fmt"
             "strings"
             "net/http"
             "io/ioutil"
           )
           
           func main() {
           
             url := "https://apiconnect.angelone.in/
             rest/secure/angelbroking/market/v1/quote/"
             method := "POST"
           
             payload := strings.NewReader({
          		"mode": "FULL",
          		"exchangeTokens": {
          			"NSE": ["3045"]
          		}
          	})
           
             client := &http.Client {
             }
             req, err := http.NewRequest(method, url, payload)
           
             if err != nil {
               fmt.Println(err)
               return
             }
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
             req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
             req.Header.Add("X-MACAddress", "MAC_ADDRESS")
             req.Header.Add("X-UserType", "USER")
             req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("Content-Type", "application/json")
           
             res, err := client.Do(req)
             if err != nil {
               fmt.Println(err)
               return
             }
             defer res.Body.Close()
           
             body, err := ioutil.ReadAll(res.Body)
             if err != nil {
               fmt.Println(err)
               return
             }
             fmt.Println(string(body))
           }
          
              
           

          Historical API

          Historical API provides past data of the indices and instruments. When a successful request is placed, corresponding data is returned. A single API endpoint provides the data for all segments. The exchange parameter in the request body is used to specify the segment whose data is required.

          https://apiconnect.angelone.in/rest/secure/angelbroking/historical/v1/getCandleData

          Exchange Constants

          ParamValueDescription
          exchangeNSENSE Stocks and Indices
          NFONSE Futures and Options
          BSEBSE Stocks and Indices
          BFOBSE Future and Options
          CDSCurrency Derivatives
          MCXCommodities Exchange

          Interval Constants

          IntervalDescription
          ONE_MINUTE1 Minute
          THREE_MINUTE3 Minute
          FIVE_MINUTE5 Minute
          TEN_MINUTE10 Minute
          FIFTEEN_MINUTE15 Minute
          THIRTY_MINUTE30 Minute
          ONE_HOUR1 Hour
          ONE_DAY1 Day

          Max Days in one Request

          The API can provide data of multiple days in one request. Below is the list of Max no of days upto which data can be provided for the requested intervals:

          IntervalMax Days in one Request
          ONE_MINUTE30
          THREE_MINUTE60
          FIVE_MINUTE100
          TEN_MINUTE100
          FIFTEEN_MINUTE200
          THIRTY_MINUTE200
          ONE_HOUR400
          ONE_DAY2000

          Get Candle Data

          All requests and its response structure is as below.

          Get Candle Data Request

          {
               "exchange": "NSE",
               "symboltoken": "99926000",
               "interval": "ONE_HOUR",
               "fromdate": "2023-09-06 11:15",
               "todate": "2023-09-06 12:00"
          }

          Get Candle Data Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": [
                    [
                         "2023-09-06T11:15:00+05:30",
                         19571.2,
                         19573.35,
                         19534.4,
                         19552.05,
                         0
                    ]
               ]
          }

          NOTE:

          1. In Get Candle Data Request fromdate and todate format should be "yyyy-MM-dd hh:mm"
          2. The response is an array of records, where each record in turn is an array of the following values — [timestamp, open, high, low, close, volume].

          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n     \"exchange\": \"NSE\",\r\n    
           \"symboltoken\": \"3045\",\r\n     \"interval\": \"ONE_MINUTE\",\r\n  
              \"fromdate\": \"2021-02-08 09:00\",\r\n     \"todate\": \"2021-02-08 09:16\"\r\n}"
          headers = {
            'X-PrivateKey': 'API_KEY',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-UserType': 'USER',
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'Content-Type': 'application/json'
          }
          conn.request("POST", "/rest/secure/angelbroking/historical/v1/getCandleData", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
              
           
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n   
                \"exchange\": \"NSE\",\r\n     \"symboltoken\": \"3045\",\r\n  
                   \"interval\": \"ONE_MINUTE\",\r\n     \"fromdate\": \"2021-02-08 09:00\",\r\n   
                     \"todate\": \"2021-02-08 09:16\"\r\n}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            rest/secure/angelbroking/historical/v1/
            getCandleData")
            .method("POST", body)
            .addHeader("X-PrivateKey", "API_KEY")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-UserType", "USER")
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("Content-Type", "application/json")
            .build();
          Response response = client.newCall(request).execute();
              
           
          
          var axios = require('axios');
          var data = JSON.stringify({"exchange":"NSE","symboltoken":"3045",
          "interval":"ONE_MINUTE","fromdate":"2021-02-08 09:00",
          "todate":"2021-02-08 09:16"});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/historical/v1/
            getCandleData',
            headers: { 
              'X-PrivateKey': 'API_KEY', 
              'Accept': 'application/json, application/json', 
              'X-SourceID': 'WEB, WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-UserType': 'USER', 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/
          historical/v1/getCandleData"
          json_body <- jsonlite::toJSON(list(
                "exchange": "NSE",
                "symboltoken": "3045",
                "interval": "ONE_MINUTE",
                "fromdate": "2021-02-08 09:00",
                "todate": "2021-02-08 09:16"
          
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
           
          
          package main
          
           import (
             "fmt"
             "strings"
             "net/http"
             "io/ioutil"
           )
           
           func main() {
           
             url := "https://apiconnect.angelone.in/
             rest/secure/angelbroking/historical/v1/
             getCandleData"
             method := "POST"
           
             payload := strings.NewReader({
           
                "exchange": "NSE",
                "symboltoken": "3045",
                "interval": "ONE_MINUTE",
                "fromdate": "2021-02-08 09:00",
                "todate": "2021-02-08 09:16"
           })
           
             client := &http.Client {
             }
             req, err := http.NewRequest(method, url, payload)
           
             if err != nil {
               fmt.Println(err)
               return
             }
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
             req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
             req.Header.Add("X-MACAddress", "MAC_ADDRESS")
             req.Header.Add("X-UserType", "USER")
             req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("Content-Type", "application/json")
           
             res, err := client.Do(req)
             if err != nil {
               fmt.Println(err)
               return
             }
             defer res.Body.Close()
           
             body, err := ioutil.ReadAll(res.Body)
             if err != nil {
               fmt.Println(err)
               return
             }
             fmt.Println(string(body))
           }
          
              
           

          Get Historical OI Data

          Historical OI Data is available for live F&O contracts. Historical OI can be fetched using the token from the scrip master and passing it into the request body.

          https://apiconnect.angelone.in/rest/secure/angelbroking/historical/v1/getOIData

          Get OI Data Request

          {
               "exchange": "NFO",
               "symboltoken": "46823",
               "interval": "THREE_MINUTE",
               "fromdate": "2024-06-07 09:15",
               "todate": "2024-06-07 15:30"
          }

          Get OI Data Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": [
                    {
                         "time": "2024-08-19T12:24:00+05:30",
                         "oi": 166100
                    }
               ]
          }

          
          var axios = require('axios');
          var data = JSON.stringify({"exchange":"NFO","symboltoken":"46823",
          "interval":"ONE_MINUTE","fromdate":"2021-02-08 09:00",
          "todate":"2021-02-08 09:16"});
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/historical/v1/
            getOIData',
            headers: { 
              'X-PrivateKey': 'API_KEY', 
              'Accept': 'application/json, application/json', 
              'X-SourceID': 'WEB, WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-UserType': 'USER', 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\r\n   
                \"exchange\": \"NFO\",\r\n     \"symboltoken\": \"46823\",\r\n  
                   \"interval\": \"ONE_MINUTE\",\r\n     \"fromdate\": \"2021-02-08 09:00\",\r\n   
                     \"todate\": \"2021-02-08 09:16\"\r\n}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            rest/secure/angelbroking/historical/v1/
            getOIData")
            .method("POST", body)
            .addHeader("X-PrivateKey", "API_KEY")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-UserType", "USER")
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("Content-Type", "application/json")
            .build();
          Response response = client.newCall(request).execute();
              
           
          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\r\n     \"exchange\": \"NFO\",\r\n    
           \"symboltoken\": \"46823\",\r\n     \"interval\": \"ONE_MINUTE\",\r\n  
              \"fromdate\": \"2021-02-08 09:00\",\r\n     \"todate\": \"2021-02-08 09:16\"\r\n}"
          headers = {
            'X-PrivateKey': 'API_KEY',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-UserType': 'USER',
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'Content-Type': 'application/json'
          }
          conn.request("POST", "/rest/secure/angelbroking/historical/v1/getOIData", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
              
           
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in/
          rest/secure/angelbroking/
          historical/v1/getCandleData"
          json_body <- jsonlite::toJSON(list(
                "exchange": "NFO",
                "symboltoken": "46823",
                "interval": "ONE_MINUTE",
                "fromdate": "2021-02-08 09:00",
                "todate": "2021-02-08 09:16"
          
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
           
          
          package main
          
           import (
             "fmt"
             "strings"
             "net/http"
             "io/ioutil"
           )
           
           func main() {
           
             url := "https://apiconnect.angelone.in/
             rest/secure/angelbroking/historical/v1/
             getOIData"
             method := "POST"
           
             payload := strings.NewReader({
           
                "exchange": "NFO",
                "symboltoken": "46823",
                "interval": "ONE_MINUTE",
                "fromdate": "2021-02-08 09:00",
                "todate": "2021-02-08 09:16"
           })
           
             client := &http.Client {
             }
             req, err := http.NewRequest(method, url, payload)
           
             if err != nil {
               fmt.Println(err)
               return
             }
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
             req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
             req.Header.Add("X-MACAddress", "MAC_ADDRESS")
             req.Header.Add("X-UserType", "USER")
             req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("Content-Type", "application/json")
           
             res, err := client.Do(req)
             if err != nil {
               fmt.Println(err)
               return
             }
             defer res.Body.Close()
           
             body, err := ioutil.ReadAll(res.Body)
             if err != nil {
               fmt.Println(err)
               return
             }
             fmt.Println(string(body))
           }
          
              
           

          Option Greeks

          Option Greeks Delta(Δ), Gamma (Γ), Theta(Θ) and Vega(ν) along with implied volatility are available on SmartAPI platform.

          The API endpoint is:

          https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/optionGreek
          HTTP Method: POST

          Headers are same as other requests.

          The request body is as follows :

          
          {
              "name":"TCS", // Here Name represents the Underlying stock
              "expirydate":"25JAN2024"
          }
            
          

          Once you pass the underlying and the desired expiry date, it provides you the four greeks, i.e. Delta, Gamma, Theta, Vega and Implied Volatility (IV) for multiple strike prices.

          Sample Response:

          
          {
              "status": true,
              "message": "SUCCESS",
              "errorcode": "",
              "data": [
                  {
                      "name": "TCS",
                      "expiry": "25JAN2024",
                      "strikePrice": "3900.000000",
                      "optionType": "CE",
                      "delta": "0.492400",
                      "gamma": "0.002800",
                      "theta": "-4.091800",
                      "vega": "2.296700",
                      "impliedVolatility": "16.330000",
                      "tradeVolume": "24048.00"
                  },
                  {
                      "name": "TCS",
                      "expiry": "25JAN2024",
                      "strikePrice": "4000.000000",
                      "optionType": "CE",
                      "delta": "0.239000",
                      "gamma": "0.002200",
                      "theta": "-3.033500",
                      "vega": "1.785400",
                      "impliedVolatility": "22.190000",
                      "tradeVolume": "12976.00"
          }
          

          There will be multiple JSON objects in the response, each for a specific strike price.

          Top Gainers/Losers, PCR and OI Buildup

          1. Top Gainers/ Losers

          Top Gainers/Losers API gives you the Top gainers and Losers in the derivatives segment for the day. You can choose from which types of data you want. The data is available for three time periods, i.e. near(Current Month), next(Next Month), Far (The month after next month).

          The API endpoint for the same is :

          https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/gainersLosers

          Headers are same as for all other requests.

          HTTP Method: POST

          The Request packet is as follows:

          
          {
              "datatype":"PercOIGainers", // Type of Data you want(PercOILosers/PercOIGainers/PercPriceGainers/PercPriceLosers)
              "expirytype":"NEAR" // Expiry Type (NEAR/NEXT/FAR)
          } 
          

          The response received for the request is as follows:

          
          {
              "status": true,
              "message": "SUCCESS",
              "errorcode": "",
              "data": [
                  {
                      "tradingSymbol": "HDFCBANK25JAN24FUT",
                      "percentChange": 20.02,
                      "symbolToken": 55394,
                      "opnInterest": 118861600,
                      "netChangeOpnInterest": 1.98253E7
                  },
                  {
                      "tradingSymbol": "IEX25JAN24FUT",
                      "percentChange": 15.57,
                      "symbolToken": 55409,
                      "opnInterest": 77827500,
                      "netChangeOpnInterest": 1.0485E7
                  },
                  {
                      "tradingSymbol": "KOTAKBANK25JAN24FUT",
                      "percentChange": 11.07,
                      "symbolToken": 55428,
                      "opnInterest": 30164800,
                      "netChangeOpnInterest": 3007600.0
                  },
                  {
                      "tradingSymbol": "ICICIGI25JAN24FUT",
                      "percentChange": 7.91,
                      "symbolToken": 55402,
                      "opnInterest": 3954500,
                      "netChangeOpnInterest": 290000.0
                  },
                  {
                      "tradingSymbol": "DRREDDY25JAN24FUT",
                      "percentChange": 7.17,
                      "symbolToken": 55376,
                      "opnInterest": 2211625,
                      "netChangeOpnInterest": 148000.0
                  },
                  {
                      "tradingSymbol": "TATASTEEL25JAN24FUT",
                      "percentChange": 6.73,
                      "symbolToken": 55503,
                      "opnInterest": 234679500,
                      "netChangeOpnInterest": 1.4795E7
                  },
                  {
                      "tradingSymbol": "OFSS25JAN24FUT",
                      "percentChange": 6.5,
                      "symbolToken": 55462,
                      "opnInterest": 770400,
                      "netChangeOpnInterest": 47000.0
                  },
                  {
                      "tradingSymbol": "INDUSINDBK25JAN24FUT",
                      "percentChange": 6.23,
                      "symbolToken": 55417,
                      "opnInterest": 16300000,
                      "netChangeOpnInterest": 956500.0
                  },
                  {
                      "tradingSymbol": "CUB25JAN24FUT",
                      "percentChange": 5.99,
                      "symbolToken": 55367,
                      "opnInterest": 32735000,
                      "netChangeOpnInterest": 1850000.0
                  },
                  {
                      "tradingSymbol": "GUJGASLTD25JAN24FUT",
                      "percentChange": 5.98,
                      "symbolToken": 55389,
                      "opnInterest": 6023750,
                      "netChangeOpnInterest": 340000.0
                  }
              ]
          }  
          

          This lists down all the OI Gainers for the day. Please note that this data is cumulative of OI of all strike prices for the Option Contracts, hence maps all the data to the futures token of the same expiry date. Futures Token here just denotes expiry date and the underlying stock. OI Gainers/ Losers or Price Gainers/ Losers data is for options contracts only.

          KeyPossible Values
          DataType

          PercPriceGainers

          PercPriceLosers

          PercOILosers

          PercOIGainers

          ExpiryType

          NEAR

          FAR

          NEXT

          2. PCR Volume API

          PCR Volume API gives the ratio of Put - Call Ratio for Options Contracts in the market using which you can gauge the market sentiments and make you trading decisions.

          The API endpoint is:

          https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/putCallRatio
          HTTP Method: GET

          Headers remain same as in all other requests.

          Request Body:

          
          //No request Body
          

          Response from the API:

          
          {
              "status": true,
              "message": "SUCCESS",
              "errorcode": "",
              "data": [
                  {
                      "pcr": 1.04,
                      "tradingSymbol": "NIFTY25JAN24FUT"
                  },
                  {
                      "pcr": 0.58,
                      "tradingSymbol": "HEROMOTOCO25JAN24FUT"
                  },
                  {
                      "pcr": 0.65,
                      "tradingSymbol": "ADANIPORTS25JAN24FUT"
                  },
              ]
          }
          

          Please note that PCR here represents the cumulative PCR of Options Contracts for all strike prices, hence the Trading Symbol has been mapped to the corresponding futures instrument for each underlying stock. It represents PCR for Options only.

          3. OI BuildUp

          Using this API, you can check for Long Buildup, Short Buildup, Short Covering and Long Unwinding. Pass the requisite keys in the API and you'd get the appropriate list for your usage.

          The API end point is:

          https://apiconnect.angelone.in/rest/secure/angelbroking/marketData/v1/OIBuildup
          HTTP Method: POST

          Headers will be same as all the other APIs

          The request Body will be as follows:

          
          {
              "expirytype":"NEAR",
              "datatype":"Long Built Up"
          }
          

          Similar to Top Gainers/ Losers API, we can pass multiple values in the data_type and expiry_type keys.

          The values are as follows:

          KeyPossible Values
          DataType

          Long Built Up

          Short Built Up

          Short Covering

          Long Unwinding

          ExpiryType

          NEAR

          FAR

          NEXT


          Please note that there is a single space between the different words in datatype, i.e. Long<single space>Built<single-space>Up

          The response will be as follows:

          
          {
              "status": true,
              "message": "SUCCESS",
              "errorcode": "",
              "data": [
                  {
                      "symbolToken": "55424",
                      "ltp": "723.8",
                      "netChange": "-28.25",
                      "percentChange": "-3.76",
                      "opnInterest": "24982.5",
                      "netChangeOpnInterest": "-76.25",
                      "tradingSymbol": "JINDALSTEL25JAN24FUT"
                  },
                  {
                      "symbolToken": "55452",
                      "ltp": "134.25",
                      "netChange": "-5.05",
                      "percentChange": "-3.63",
                      "opnInterest": "67965.0",
                      "netChangeOpnInterest": "-3120.0",
                      "tradingSymbol": "NATIONALUM25JAN24FUT"
                  }
              ]
          }
          

          You will get all the responses on passing the correct values for data type and expiry time.

          Margin Calculator

          Margin Calculator API delivers the real time margin calculations for a basket of positions.

          https://apiconnect.angelone.in/rest/secure/angelbroking/margin/v1/batch
          HTTP Method: POST
          Access Rate Limit: 10 request per second
          Number of positions input in a request: Upto 50 positions in a single request

          Field Description

          FieldData typeDescription
          exchange

          Enum -

          BSE

          NSE

          NFO

          MCX

          BFO

          CDS

          Exchange and segment

          BSE Equity

          NSE Equity

          NSE Future and Options

          MCX Commodity

          BSE Futures and Options

          Currency Derivate Segment

          qty

          int

          Quantity. Pls note that in the NFO segment it denotes the no. of units in a lot.

          price

          int

          Price

          producttype

          Enum -

          DELIVERY

          CARRYFORWARD

          MARGIN

          INTRADAY

          BO

          Type of product

          Cash & Carry for equity (CNC)

          Normal for futures and options (NRML)

          Margin Delivery

          Margin Intraday Squareoff (MIS)

          Bracket Order (Only for ROBO)

          token

          String

          Symbol/token being traded

          tradetype

          Enum -

          BUY

          SELL

          Type of trade

          Buy

          Sell

          Margin Calculator

          Request and its response structure is as below.

          Margin Calculator Request

          {
               "positions": [
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67300",
                         "tradeType": "BUY"
                    },
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67308",
                         "tradeType": "SELL"
                    }
               ]
          }

          Margin Calculator Response

          {
               "status": true,
               "message": "SUCCESS",
               "errorcode": "",
               "data": {
                    "totalMarginRequired": 29612.35,
                    "marginComponents": {
                         "netPremium": 5060,
                         "spanMargin": 0,
                         "marginBenefit": 79876.5,
                         "deliveryMargin": 0,
                         "nonNFOMargin": 0,
                         "totOptionsPremium": 10100
                    },
                    "marginBreakup": [
                         {
                              "exchange": "NFO",
                              "productType": "INTRADAY",
                              "totalMarginRequired": 19512.35
                         }
                    ],
                    "optionsBuy": {
                         "totOptionsPremium": 10100,
                         "optionDetails": [
                              {
                                   "exchange": "NFO",
                                   "productType": "INTRADAY",
                                   "token": "67300",
                                   "lotMultiplier": 50,
                                   "optionPremium": 10100
                              }
                         ]
                    }
               }
          }

          
          import http.client
          
          conn = http.client.HTTPSConnection("apiconnect.angelone.in")
          payload = "{\n" +
            "  \"positions\": [\n" +
            "    {\n" +
            "      \"exchange\": \"NFO\",\n" +
            "      \"qty\": 50,\n" +
            "      \"price\": 0,\n" +
            "      \"productType\": \"INTRADAY\",\n" +
            "      \"token\": \"67300\",\n" +
            "      \"tradeType\": \"BUY\"\n" +
            "    },\n" +
            "    {\n" +
            "      \"exchange\": \"NFO\",\n" +
            "      \"qty\": 50,\n" +
            "      \"price\": 0,\n" +
            "      \"productType\": \"INTRADAY\",\n" +
            "      \"token\": \"67308\",\n" +
            "      \"tradeType\": \"SELL\"\n" +
            "    }\n" +
            "  ]\n" +
            "}"
          headers = {
            'X-PrivateKey': 'API_KEY',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
            'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
            'X-MACAddress': 'MAC_ADDRESS',
            'X-UserType': 'USER',
            'Authorization': 'Bearer AUTHORIZATION_TOKEN',
            'Accept': 'application/json',
            'X-SourceID': 'WEB',
            'Content-Type': 'application/json'
          }
          conn.request("POST", "/rest/secure/angelbroking/margin/v1/batch", payload, headers)
          res = conn.getresponse()
          data = res.read()
          print(data.decode("utf-8"))
              
           
          
          OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
          MediaType mediaType = MediaType.parse("application/json");
          RequestBody body = RequestBody.create(mediaType, "{\n" +
            "  \"positions\": [\n" +
            "    {\n" +
            "      \"exchange\": \"NFO\",\n" +
            "      \"qty\": 50,\n" +
            "      \"price\": 0,\n" +
            "      \"productType\": \"INTRADAY\",\n" +
            "      \"token\": \"67300\",\n" +
            "      \"tradeType\": \"BUY\"\n" +
            "    },\n" +
            "    {\n" +
            "      \"exchange\": \"NFO\",\n" +
            "      \"qty\": 50,\n" +
            "      \"price\": 0,\n" +
            "      \"productType\": \"INTRADAY\",\n" +
            "      \"token\": \"67308\",\n" +
            "      \"tradeType\": \"SELL\"\n" +
            "    }\n" +
            "  ]\n" +
            "}");
          Request request = new Request.Builder()
            .url("https://apiconnect.angelone.in/
            rest/secure/angelbroking/margin/v1/batch")
            .method("POST", body)
            .addHeader("X-PrivateKey", "API_KEY")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("X-ClientLocalIP", "CLIENT_LOCAL_IP")
            .addHeader("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
            .addHeader("X-MACAddress", "MAC_ADDRESS")
            .addHeader("X-UserType", "USER")
            .addHeader("Authorization", "Bearer AUTHORIZATION_TOKEN")
            .addHeader("Accept", "application/json")
            .addHeader("X-SourceID", "WEB")
            .addHeader("Content-Type", "application/json")
            .build();
          Response response = client.newCall(request).execute();
              
           
          
          var axios = require('axios');
          var data = JSON.stringify({
               "positions": [
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67300",
                         "tradeType": "BUY"
                    },
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67308",
                         "tradeType": "SELL"
                    }
               ]
          });
          
          var config = {
            method: 'post',
            url: 'https://apiconnect.angelone.in/
            rest/secure/angelbroking/margin/v1/batch',
            headers: { 
              'X-PrivateKey': 'API_KEY', 
              'Accept': 'application/json, application/json', 
              'X-SourceID': 'WEB, WEB', 
              'X-ClientLocalIP': 'CLIENT_LOCAL_IP', 
              'X-ClientPublicIP': 'CLIENT_PUBLIC_IP', 
              'X-MACAddress': 'MAC_ADDRESS', 
              'X-UserType': 'USER', 
              'Authorization': 'Bearer AUTHORIZATION_TOKEN', 
              'Content-Type': 'application/json'
            },
            data : data
          };
          
          axios(config)
          .then(function (response) {
            console.log(JSON.stringify(response.data));
          })
          .catch(function (error) {
            console.log(error);
          });
          
          
          
          library(httr)
          
          url <- "https://apiconnect.angelone.in
          /rest/secure/angelbroking/margin/v1/batch"
          json_body <- jsonlite::toJSON(list(
            "positions": [
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67300",
                         "tradeType": "BUY"
                    },
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67308",
                         "tradeType": "SELL"
                    }
               ]
              ))
          
          response <- POST(url, 
              config = list(
              add_headers(
              'Authorization'= 'Bearer AUTHORIZATION_TOKEN',
              'Content-Type'= 'application/json',
              'Accept'= 'application/json',
              'X-UserType'= 'USER',
              'X-SourceID'= 'WEB',
              'X-ClientLocalIP'= 'CLIENT_LOCAL_IP',
              'X-ClientPublicIP'= 'CLIENT_PUBLIC_IP',
              'X-MACAddress'= 'MAC_ADDRESS',
              'X-PrivateKey'= 'API_KEY'
              ))
              ),
              body = json_body,
              encode = "raw"
          
          print(response)
           
          
          package main
          
           import (
             "fmt"
             "strings"
             "net/http"
             "io/ioutil"
           )
           
           func main() {
           
             url := "https://apiconnect.angelone.in/
             rest/secure/angelbroking/margin/v1/batch"
             method := "POST"
           
             payload := strings.NewReader({
               "positions": [
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67300",
                         "tradeType": "BUY"
                    },
                    {
                         "exchange": "NFO",
                         "qty": 50,
                         "price": 0,
                         "productType": "INTRADAY",
                         "token": "67308",
                         "tradeType": "SELL"
                    }
               ]
          })
           
             client := &http.Client {
             }
             req, err := http.NewRequest(method, url, payload)
           
             if err != nil {
               fmt.Println(err)
               return
             }
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("X-ClientLocalIP", "CLIENT_LOCAL_IP")
             req.Header.Add("X-ClientPublicIP", "CLIENT_PUBLIC_IP")
             req.Header.Add("X-MACAddress", "MAC_ADDRESS")
             req.Header.Add("X-UserType", "USER")
             req.Header.Add("Authorization", "Bearer AUTHORIZATION_TOKEN")
             req.Header.Add("X-PrivateKey", "API_KEY")
             req.Header.Add("Accept", "application/json")
             req.Header.Add("X-SourceID", "WEB")
             req.Header.Add("Content-Type", "application/json")
           
             res, err := client.Do(req)
             if err != nil {
               fmt.Println(err)
               return
             }
             defer res.Body.Close()
           
             body, err := ioutil.ReadAll(res.Body)
             if err != nil {
               fmt.Println(err)
               return
             }
             fmt.Println(string(body))
           }
          
              
           

          Rate Limit

          Rate limiting defines limits on how many API calls can be made within a second.

          The limit-exceeding requests will fail and returns 403 Access denied because of exceeding rate limit.

          Sr. NoAPI NameThrottling Limit Rate (Request/Second)Throttling Limit Rate (Request/Minute)Throttling Limit Rate (Request/Hour)
          1/rest/auth/angelbroking/user/v1/loginByPassword1NANA
          2/rest/auth/angelbroking/jwt/v1//generateTokens1NA1000
          3/rest/secure/angelbroking/user/v1/getProfile3NA1000
          4/rest/secure/angelbroking/user/v1/logout1NANA
          5/rest/secure/angelbroking/user/v1/getRMS2NANA
          6/rest/secure/angelbroking/order/v1/placeOrder205001000
          7/rest/secure/angelbroking/order/v1/modifyOrder205001000
          8/rest/secure/angelbroking/order/v1/cancelOrder205001000
          9/rest/secure/angelbroking/order/v1/getOrderBook1NANA
          10/rest/secure/angelbroking/order/v1/getLtpData105005000
          11/rest/secure/angelbroking/order/v1/getPosition1NANA
          12/rest/secure/angelbroking/order/v1/getTradeBook1NANA
          13/rest/secure/angelbroking/order/v1/convertPosition105005000
          14/rest/secure/angelbroking/order/v1/searchScrip1NANA
          15/rest/secure/angelbroking/order/v1//details/{GuiOrderID}105005000
          16/rest/secure/angelbroking/portfolio/v1/getHolding1NANA
          17/rest/secure/angelbroking/portfolio/v1/getAllHolding1NANA
          18/rest/secure/angelbroking/market/v1/quote105005000
          19/rest/secure/angelbroking/margin/v1/batch105005000
          20/rest/secure/angelbroking/gtt/v1/createRule105005000
          21/rest/secure/angelbroking/gtt/v1/modifyRule105005000
          22/rest/secure/angelbroking/gtt/v1/cancelRule105005000
          23/rest/secure/angelbroking/gtt/v1/ruleDetails105005000
          24/rest/secure/angelbroking/gtt/v1/ruleList105005000
          25/rest/secure/angelbroking/historical/v1/getCandleData31805000
          25/rest/secure/angelbroking/marketData/v1/optionGreek1NANA

          NOTE:

          1. The Rate limit is calculated on the basis of client code.