Introduction
The Breeze API is a powerful API through which you can fetch live/historical data, automate your trading strategies, and monitor your portfolio in real time.
An AppKey and secret_key pair is issued that allows you to connect to the server.
You have to register a redirect url where you will be sent after the login.
Breeze API is designed to accept 75 API calls per minute and 2000 API calls per day.
All inputs are form-encoded parameters and responses are in the form of JSON.
The success and the error states are indicated by standard HTTP codes and are accompanied by JSON data.
You can also use Breeze API alongside with the third-party applications. Our documentation is a one stop reference to all your questions. You can also reach out to us through the iCommunity.
How To Navigate
How to Navigate?
The documentation specifies various API endpoints which can be used to perform many functions as stated above.
In this documentation, you will find about the following:
The computation of the checksum
Sending the common request headers
API Parameters, its data type and description
Language specific guides
Sample JSON Response
Checksum Computation & Login import hashlib
import hmac
import base64
import time
secret = bytes ( 'your_SECRET_goes_here' , 'utf-8' )
time_stamp = str ( int ( time . time ()))
# 'body' is the body of your current request
data = str ( body )
raw_checksum = bytes ( time_stamp + ' \r\n ' + data , 'utf-8' )
checksum = base64 . b64encode ( hmac . new ( secret , raw_checksum , digestmod = hashlib . sha256 ). digest ())
var crypto = require ( ' crypto ' );
var secret = ' your_SECRET_goes_here ' ;
var time_stamp = new Date (). getTime (). toString ();
var data = JSON . stringify ( body ); // 'body' is the body of the current request
var rawChecksum = time_stamp + ' \r\n ' + data ;
var checksum = crypto . createHmac ( ' sha256 ' , secret ). update ( rawChecksum );
// to base64
checksum . digest ( ' base64 ' );
//You might need to import the following
import javax.crypto.Mac ;
import javax.crypto.spec.SecretKeySpec ;
import java.security.NoSuchAlgorithmException ;
import java.security.InvalidKeyException ;
import javax.xml.bind.DatatypeConverter ;
//The following code generates the checksum
try {
String secret = "your_SECRET_goes_here" ;
// 'body' is the body of the current request
String data = body . toString ();
String rawChecksum = timeStamp + "\r\n" + data ;
Mac hasher = Mac . getInstance ( "HmacSHA256" );
hasher . init ( new SecretKeySpec ( secret . getBytes (), "HmacSHA256" ));
byte [] checksum = hasher . doFinal ( rawChecksum . getBytes ());
DatatypeConverter . printBase64Binary ( checksum );
}
catch ( NoSuchAlgorithmException e ) {}
catch ( InvalidKeyException e ) {}
//You might need to import the following
using System ;
using System.Security.Cryptography ;
using System.Text ;
//The following code generates the checksum
string secret = "yourSECRETgoeshere" ;
string timeStamp = DateTimeOffset . Now . ToUnixTimeSeconds ();
// 'body' is the body of the current request
string data = body . ToString ();
string rawChecksum = timeStamp + "\r\n" + data ;
byte [] secretByte = new ASCIIEncoding (). GetBytes ( secret );
byte [] checksumBytes = new ASCIIEncoding (). GetBytes ( rawChecksum );
byte [] checksum = new HMACSHA256 ( secretByte ). ComputeHash ( checksumBytes );
Convert . ToBase64String ( checksum );
Registration
Authentication is done following the OAuth2.0 protocol. It ensures that all the fields in the request are safe from tampering.
Visit the Breeze API portal to register an app by providing the following information:
App Name
Redirect URL
Breeze User ID
After the app is successfully registered, you should create the AppKey and secret_key pair.
These keys will be unique to the app registered.
The AppKey is the identity of the app for the API system and secret_key is used to encrypt messages sent to the API system by the client system.
All requests must contain:
App Key (AppKey)
Checksum
Timestamp
Checksum Computation
Checksum is computed via SHA256 hash (Time Stamp + JSON Post Data + secret_key)
Redirect response on login request is form post
All JSON Data should be stringified before sending it to the I-Direct system.
Login
Navigate to the Breeze API endpoint with the AppKey to initiate the login flow.
Upon successful login you will have an API_Session. This API_Session, along with a checksum (Time Stamp + JSON Post Data + secret_key) is POSTed to the token API to obtain a session_token, which is then used for signing all subsequent requests.
Key
Value
Description
X-Checksum
token followed by combination of ((ISO8601 UTC DateTime Format with 0 milliseconds) + JSONPostData + secret_key )
X-Timestamp
2021-11-01T10:23:56.000Z
ISO8601 UTC DateTime Format with 0 milliseconds Request will be honoured only if server time stamp and client timestamp is between 60 seconds
X-AppKey
AppKey which is received during registration
X-SessionToken
SessionToken value is received in CustomerDetails API
The Customer Details and Customer Login API endpoints do not require headers
Errors
Exceptions and Errors
The API server generates name of the exception for error responses.
While writing your code, you can raise corresponding exceptions after defining them in your language/library.
The table below shows the list of exceptions and common error codes.
Instruments
You can download the Security Master file for token mapping at your end here .
It is generated/updated daily at 8:00 AM.
Kindly note that the rate limit is set to 75 API calls per minute and 2000 API calls per day.
CustomerDetails
CustomerDetails
var axios = require ( ' axios ' );
var data = ' { \r\n "SessionToken": "39373", \r\n "AppKey": "8g791^N029R47I831B8153=^O2f#7u8g" \r\n } ' ;
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerdetails ' ,
headers : { },
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = "{ \r\n \" SessionToken \" : \" 39373 \" , \r\n \" AppKey \" : \" 8g791^N029R47I831B8153=^O2f#7u8g \"\r\n }"
headers = {}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/customerdetails" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerdetails" )
. method ( "GET" , null )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerdetails" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
var body = @"{
" + "\n" +
@" ""SessionToken"": ""39373"",
" + "\n" +
@" ""AppKey"": ""8g791^N029R47I831B8153=^O2f#7u8g""
" + "\n" +
@"}" ;
request . AddParameter ( "text/plain" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"exg_trade_date" : {
"NSE" : "16-Nov-2021" ,
"BSE" : "16-Nov-2021" ,
"FNO" : "16-Nov-2021" ,
"NDX" : "16-Nov-2021"
},
"exg_status" : {
"NSE" : "O" ,
"BSE" : "O" ,
"FNO" : "O" ,
"NDX" : "O"
},
"segments_allowed" : {
"Trading" : "Y" ,
"" : "Y" ,
"Derivatives" : "Y" ,
"Currency" : "Y"
},
"idirect_userid" : "W0001954" ,
"session_token" : "VzAwMDE5NTQ6MTA2Njc5OA==" ,
"idirect_user_name" : "RUPESH NAGDIVE" ,
"idirect_ORD_TYP" : "" ,
"idirect_lastlogin_time" : "16-Nov-2021 16:22:22" ,
"mf_holding_mode_popup_flg" : "N" ,
"commodity_exchange_status" : "O" ,
"commodity_trade_date" : "16-Nov-2021" ,
"commodity_allowed" : "O"
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerdetails
Body Parameters
Parameter
Data Type
Description
Mandatory
SessionToken
String
SessionToken is received in CustomerLogin API as API_Session
Yes
AppKey
String
AppKey is received during registration
Yes
CustomerLogin
CustomerLogin
var axios = require ( ' axios ' );
var data = ' { \r\n "password": "test1234", \r\n "dOB": "02121990", \r\n "iP_ID": "1.1.1.1", \r\n "appKey": "8g791^N029R47I831B8153=^O2f#7u8g", \r\n "idirect_Userid": "W0001954", \r\n "user_Data": "ALL" \r\n } ' ;
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerlogin ' ,
headers : { },
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = "{ \r\n \" password \" : \" test1234 \" , \r\n \" dOB \" : \" 02121990 \" , \r\n \" iP_ID \" : \" 1.1.1.1 \" , \r\n \" appKey \" : \" 8g791^N029R47I831B8153=^O2f#7u8g \" , \r\n \" idirect_Userid \" : \" W0001954 \" , \r\n \" user_Data \" : \" ALL \"\r\n }"
headers = {}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/customerlogin" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerlogin" )
. method ( "GET" , null )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerlogin" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
var body = @"{
" + "\n" +
@" ""password"": ""test1234"",
" + "\n" +
@" ""dOB"": ""02121990"",
" + "\n" +
@" ""iP_ID"": ""1.1.1.1"",
" + "\n" +
@" ""appKey"": ""8g791^N029R47I831B8153=^O2f#7u8g"",
" + "\n" +
@" ""idirect_Userid"": ""W0001954"",
" + "\n" +
@" ""user_Data"": ""ALL""
" + "\n" +
@"}" ;
request . AddParameter ( "text/plain" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"API_Session" : "39233" ,
"user_id" : "W0001954" ,
"prioritycustflg" : "W" ,
"cust_id" : "54545454545454535155" ,
"mobile_no" : "9167833863"
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/customerlogin
Body Parameters
Parameter
Data Type
Description
Mandatory
password
String
password is set by you during registration
Yes
dOB
String
Date of Birth as numeric string in form of DDMMYYYY
Yes
appKey
String
AppKey is received during registration
Yes
idirect_Userid
String
idirect_Userid is received during registration
Yes
DematHoldings
GetDematHoldings
var axios = require ( ' axios ' );
var data = JSON . stringify ({});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/dematholdings ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/dematholdings" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/dematholdings" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/dematholdings" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : [
{
"stock_code" : "ICINIF" ,
"stock_ISIN" : "INF109K012R6" ,
"quantity" : "16" ,
"demat_total_bulk_quantity" : "16" ,
"demat_avail_quantity" : "0" ,
"blocked_quantity" : "0" ,
"demat_allocated_quantity" : "0"
}
],
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/dematholdings
Body Parameters
Parameter
Data Type
Description
--
--
--
Funds
GetFunds
var axios = require ( ' axios ' );
var data = JSON . stringify ({});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/funds" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"bank_account" : "000101213838" ,
"total_bank_balance" : 436578416.34999996 ,
"allocated_balance" : 278980976.26 ,
"allocated_equity" : 1500002 ,
"allocated_fno" : 155519007.99 ,
"block_by_trade_equity" : 39165.77 ,
"block_by_trade_fno" : 39165.77 ,
"block_by_trade_balance" : 0 ,
"unallocated_balance" : "625854.54"
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds
Body Parameters
Parameter
Data Type
Description
--
--
--
SetFunds
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" transaction_type " : " Debit " ,
" amount " : " 200 " ,
" segment " : " Equity "
});
var config = {
method : ' post ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"transaction_type" : "Debit" ,
"amount" : "200" ,
"segment" : "Equity"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "POST" , "/icicidirectwebapi_core/api/v1/funds" , 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 \"transaction_type\": \"Debit\",\r\n \"amount\": \"200\",\r\n \"segment\": \"Equity\"\r\n}" );
Request request = new Request . Builder ()
. url ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds" )
. method ( "POST" , body )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""transaction_type"": ""Debit"",
" + "\n" +
@" ""amount"": ""200"",
" + "\n" +
@" ""segment"": ""Equity""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"Status" : "Success"
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
POST
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/funds
Body Parameters
Parameter
Data Type
Description
Mandatory
transaction_type
String
"Debit", "Credit"
Yes
amount
String
Numeric string of Currency
Yes
segment
String
"Equity", "FNO"
Yes
HistoricalCharts
GetHistoricalChartsList
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" interval " : " 30minute " ,
" from_date " : " 2021-12-15T07:00:00.000Z " ,
" to_date " : " 2021-12-15T07:00:00.000Z " ,
" stock_code " : " AXIBAN " ,
" exchange_code " : " NSE " ,
" segment " : "" ,
" product_type " : " Futures " ,
" exercise_type " : "" ,
" expiry_date " : " 2021-12-30T07:00:00.000Z " ,
" option_type " : " Others " ,
" strike_price " : " 0 "
});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/historicalcharts ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"interval" : "30minute" ,
"from_date" : "2021-12-15T07:00:00.000Z" ,
"to_date" : "2021-12-15T07:00:00.000Z" ,
"stock_code" : "AXIBAN" ,
"exchange_code" : "NSE" ,
"segment" : "" ,
"product_type" : "Futures" ,
"exercise_type" : "" ,
"expiry_date" : "2021-12-30T07:00:00.000Z" ,
"option_type" : "Others" ,
"strike_price" : "0"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/historicalcharts" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/historicalcharts" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/historicalcharts" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""interval"": ""30minute"",
" + "\n" +
@" ""from_date"": ""2021-12-15T07:00:00.000Z"",
" + "\n" +
@" ""to_date"": ""2021-12-15T07:00:00.000Z"",
" + "\n" +
@" ""stock_code"": ""AXIBAN"",
" + "\n" +
@" ""exchange_code"": ""NSE"",
" + "\n" +
@" ""segment"": """",
" + "\n" +
@" ""product_type"": ""Futures"",
" + "\n" +
@" ""exercise_type"": """",
" + "\n" +
@" ""expiry_date"": ""2021-12-30T07:00:00.000Z"",
" + "\n" +
@" ""option_type"": ""Others"",
" + "\n" +
@" ""strike_price"": ""0""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : [
{
"timestamp" : "2021-12-15 09:07:00" ,
"open" : "738" ,
"close" : "738" ,
"current" : "738" ,
"high" : "738" ,
"low" : "738" ,
"volume" : "18"
}
],
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/historicalcharts
Body Parameters
Parameter
Data Type
Description
Mandatory
interval
String
"30minute","5minute"
Yes
from_date
String
ISO 8601
Yes
to_date
String
ISO 8601
Yes
stock_code
String
"AXIBAN", "TATMOT"
Yes
exchange_code
String
"NSE", "NFO", "BSE"
Yes
product_type
String
"futures","options","furtureplus","futureplus_sltp","optionplus", "cash","eatm","btst","margin","marginplus"
No
expiry_date
String
ISO 8601
No
option_type
String
"call","put","others"
No
strike_price
String
Numeric String of Currency
No
Margin
AddMargins
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" product_type " : " E " ,
" stock_code " : " ACC " ,
" exchange_code " : " BSE " ,
" order_segment_code " : " N " ,
" order_settlement " : " 2021107 " ,
" add_amount " : " 100 " ,
" margin_amount " : " 54590456 " ,
" order_open_quantity " : " 2 " ,
" cover_quantity " : " 1 " ,
" category_INDSTK " : "" ,
" contract_tag " : "" ,
" add_margin_amount " : "" ,
" expiry_date " : "" ,
" order_optional_exercise_type " : "" ,
" option_type " : "" ,
" exercise_type " : "" ,
" strike_price " : "" ,
" order_stock_code " : ""
});
var config = {
method : ' post ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"product_type" : "E" ,
"stock_code" : "ACC" ,
"exchange_code" : "BSE" ,
"order_segment_code" : "N" ,
"order_settlement" : "2021107" ,
"add_amount" : "100" ,
"margin_amount" : "54590456" ,
"order_open_quantity" : "2" ,
"cover_quantity" : "1" ,
"category_INDSTK" : "" ,
"contract_tag" : "" ,
"add_margin_amount" : "" ,
"expiry_date" : "" ,
"order_optional_exercise_type" : "" ,
"option_type" : "" ,
"exercise_type" : "" ,
"strike_price" : "" ,
"order_stock_code" : ""
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "POST" , "/icicidirectwebapi_core/api/v1/margin" , 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 \"product_type\": \"E\",\r\n \"stock_code\": \"ACC\",\r\n \"exchange_code\": \"BSE\",\r\n \"order_segment_code\": \"N\",\r\n \"order_settlement\": \"2021107\",\r\n \"add_amount\": \"100\",\r\n \"margin_amount\": \"54590456\",\r\n \"order_open_quantity\": \"2\",\r\n \"cover_quantity\": \"1\",\r\n \"category_INDSTK\": \"\",\r\n \"contract_tag\": \"\",\r\n \"add_margin_amount\": \"\",\r\n \"expiry_date\": \"\",\r\n \"order_optional_exercise_type\": \"\",\r\n \"option_type\": \"\",\r\n \"exercise_type\": \"\",\r\n \"strike_price\": \"\",\r\n \"order_stock_code\": \"\"\r\n}" );
Request request = new Request . Builder ()
. url ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin" )
. method ( "POST" , body )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""product_type"": ""E"",
" + "\n" +
@" ""stock_code"": ""ACC"",
" + "\n" +
@" ""exchange_code"": ""BSE"",
" + "\n" +
@" ""order_segment_code"": ""N"",
" + "\n" +
@" ""order_settlement"": ""2021107"",
" + "\n" +
@" ""add_amount"": ""100"",
" + "\n" +
@" ""margin_amount"": ""54590456"",
" + "\n" +
@" ""order_open_quantity"": ""2"",
" + "\n" +
@" ""cover_quantity"": ""1"",
" + "\n" +
@" ""category_INDSTK"": """",
" + "\n" +
@" ""contract_tag"": """",
" + "\n" +
@" ""add_margin_amount"": """",
" + "\n" +
@" ""expiry_date"": """",
" + "\n" +
@" ""order_optional_exercise_type"": """",
" + "\n" +
@" ""option_type"": """",
" + "\n" +
@" ""exercise_type"": """",
" + "\n" +
@" ""strike_price"": """",
" + "\n" +
@" ""order_stock_code"": """"
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : null ,
"Status" : 500 ,
"Error" : "Cannot place orders when exchange is in Expiry.:"
}
Category
Value
HTTP Request
POST
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin
Body Parameters
Parameter
Data Type
Description
Mandatory
exchange_code
String
"NSE", "NFO", "BSE"
Yes
product_type
String
"futures","options","furtureplus","futureplus_sltp","optionplus", "cash","eatm","btst","margin","marginplus"
No
stock_code
String
"AXIBAN", "TATMOT"
No
order_settlement
String
Numeric String of Currency
No
add_amount
String
Numeric String of Currency
No
margin_amount
String
Numeric String of Currency
No
order_open_quantity
String
Numeric String for Number of Open Order Quantity
No
cover_quantity
String
Numeric String for Number of Cover Order Quantity
No
category_INDSTK
String
Index & Stock Value
No
add_margin_amount
String
Numeric String of Currency
No
expiry_date
String
ISO 8601
No
option_type
String
"call","put","others"
No
GetMargins
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" exchange_code " : " NSE "
});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"exchange_code" : "NSE"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/margin" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""exchange_code"": ""NSE""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"limit_list" : [
{
"trade_date" : "2021-12-13T06:00:00.000Z" ,
"amount" : 1 ,
"exchange_code" : "" ,
"payin_date" : "" ,
"payout_date" : ""
}
],
"cash_limit" : 281165312.94 ,
"amount_allocated" : 303960175.39 ,
"block_by_trade" : 0 ,
"isec_margin" : 950926.02
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/margin
Body Parameters
Parameter
Data Type
Description
Mandatory
exchange_code
String
"NSE", "NFO", "BSE"
Yes
Order
OrderPlacement
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" stock_code " : " AXIBAN " ,
" exchange_code " : " NFO " ,
" product " : " Futures " ,
" action " : " Buy " ,
" order_type " : " Limit " ,
" stoploss " : " 0 " ,
" quantity " : " 1200 " ,
" price " : " 712.00 " ,
" order_type_fresh " : "" ,
" order_rate_fresh " : "" ,
" validity " : " day " ,
" validity_date " : " 2021-12-16T06:00:00.000Z " ,
" disclosed_quantity " : " 0 " ,
" expiry_date " : " 2021-12-25T06:00:00.000Z " ,
" right " : " others " ,
" strike_price " : " 0 " ,
" user_remark " : " test "
});
var config = {
method : ' post ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"stock_code" : "AXIBAN" ,
"exchange_code" : "NFO" ,
"product" : "Futures" ,
"action" : "Buy" ,
"order_type" : "Limit" ,
"stoploss" : "0" ,
"quantity" : "1200" ,
"price" : "712.00" ,
"order_type_fresh" : "" ,
"order_rate_fresh" : "" ,
"validity" : "day" ,
"validity_date" : "2021-12-16T06:00:00.000Z" ,
"disclosed_quantity" : "0" ,
"expiry_date" : "2021-12-25T06:00:00.000Z" ,
"right" : "others" ,
"strike_price" : "0" ,
"user_remark" : "test"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "POST" , "/icicidirectwebapi_core/api/v1/order" , 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 \"stock_code\": \"AXIBAN\",\r\n \"exchange_code\": \"NFO\",\r\n \"product\": \"Futures\",\r\n \"action\": \"Buy\",\r\n \"order_type\": \"Limit\",\r\n \"stoploss\": \"0\",\r\n \"quantity\": \"1200\",\r\n \"price\": \"712.00\",\r\n \"order_type_fresh\": \"\",\r\n \"order_rate_fresh\": \"\",\r\n \"validity\": \"day\",\r\n \"validity_date\": \"2021-12-16T06:00:00.000Z\",\r\n \"disclosed_quantity\": \"0\",\r\n \"expiry_date\": \"2021-12-25T06:00:00.000Z\",\r\n \"right\": \"others\",\r\n \"strike_price\": \"0\",\r\n \"user_remark\": \"test\"\r\n}" );
Request request = new Request . Builder ()
. url ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" )
. method ( "POST" , body )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""stock_code"": ""AXIBAN"",
" + "\n" +
@" ""exchange_code"": ""NFO"",
" + "\n" +
@" ""product"": ""Futures"",
" + "\n" +
@" ""action"": ""Buy"",
" + "\n" +
@" ""order_type"": ""Limit"",
" + "\n" +
@" ""stoploss"": ""0"",
" + "\n" +
@" ""quantity"": ""1200"",
" + "\n" +
@" ""price"": ""712.00"",
" + "\n" +
@" ""order_type_fresh"": """",
" + "\n" +
@" ""order_rate_fresh"": """",
" + "\n" +
@" ""validity"": ""day"",
" + "\n" +
@" ""validity_date"": ""2021-12-16T06:00:00.000Z"",
" + "\n" +
@" ""disclosed_quantity"": ""0"",
" + "\n" +
@" ""expiry_date"": ""2021-12-25T06:00:00.000Z"",
" + "\n" +
@" ""right"": ""others"",
" + "\n" +
@" ""strike_price"": ""0"",
" + "\n" +
@" ""user_remark"": ""test""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"order_id" : "Equity CASH Order placed successfully through RI reference no 20211215N100000070" ,
"message" : ""
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
POST
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order
Body Parameters
Parameter
Data Type
Description
Mandatory
stock_code
String
"AXIBAN", "TATMOT"
Yes
exchange_code
String
"NSE", "NFO", "BSE"
Yes
product
String
"futures","options","furtureplus","futureplus_sltp","optionplus", "cash","eatm","btst","margin","marginplus"
Yes
action
String
"buy", "sell"
Yes
order_type
String
"limit","market","stoploss"
Yes
stoploss
Double
Numeric Currency
No
quantity
Integer
Number of quantity to place the order
Yes
price
Double
Numeric Currency
Yes
validity
String
"day","ioc","vtc"
Yes
validity_date
String
ISO 8601
No
disclosed_quantity
Integer
Number of quantity to be disclosed
No
expiry_date
String
ISO 8601
No
right
String
"call","put","others"
No
strike_price
Integer
Numeric Currency
No
user_remark
String
Users are free to add their comment/tag to the order
No
GetOrderDetail
var axios = require ( ' axios ' );
var data = ' { \r\n "exchange_code": "NSE", \r\n "order_id": "20211116N100000023", \r\n } ' ;
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = "{ \r\n \" exchange_code \" : \" NSE \" , \r\n \" order_id \" : \" 20211116N100000023 \" , \r\n }"
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/order" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""exchange_code"": ""NSE"",
" + "\n" +
@" ""order_id"": ""20211116N100000023"",
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order
Body Parameters
Parameter
Data Type
Description
Mandatory
exchange_code
String
"NSE", "NFO", "BSE"
Yes
order_id
String
Order Reference to get detailed data of order
Yes
GetOrderList
var axios = require ( ' axios ' );
var data = ' { \r\n "exchange_code": "NSE", \r\n "from_date": "2021-12-01T10:00:00.000Z", \r\n "to_date": "2021-12-30T10:00:00.000Z", \r\n } ' ;
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = "{ \r\n \" exchange_code \" : \" NSE \" , \r\n \" from_date \" : \" 2021-12-01T10:00:00.000Z \" , \r\n \" to_date \" : \" 2021-12-30T10:00:00.000Z \" , \r\n }"
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/order" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""exchange_code"": ""NSE"",
" + "\n" +
@" ""from_date"": ""2021-12-01T10:00:00.000Z"",
" + "\n" +
@" ""to_date"": ""2021-12-30T10:00:00.000Z"",
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : [
{
"order_id" : "20211116N100000023" ,
"exchange_order_id" : "" ,
"exchange_code" : "NSE" ,
"stock_code" : "ICIBAN" ,
"product_type" : "Cash" ,
"action" : null ,
"order_type" : null ,
"stoploss" : 0 ,
"quantity" : "1" ,
"price" : "769.00" ,
"validity" : "" ,
"disclosed_quantity" : "0" ,
"expiry_date" : null ,
"right" : "others" ,
"strike_price" : 0 ,
"average_price" : "0" ,
"cancelled_quantity" : "0" ,
"pending_quantity" : "0" ,
"status" : "Queued" ,
"user_remark" : "*" ,
"order_datetime" : "2021-11-16T12:30:00.000Z" ,
"parent_order_id" : "" ,
"modification_number" : null ,
"exchange_acknowledgement_date" : null ,
"SLTP_price" : null ,
"modification_counter" : null ,
"exchange_acknowledge_number" : null ,
"exchange_acknowledge_time" : null ,
"initial_limit" : null ,
"intial_sltp" : null ,
"LTP" : null ,
"limit_offset" : null ,
"mbc_flag" : null ,
"cutoff_price" : null
}
],
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order
Body Parameters
Parameter
Data Type
Description
Mandatory
exchange_code
String
"NSE", "NFO", "BSE"
Yes
from_date
String
ISO 8601 - Day should not be less than 10 days from to_date
No
to_date
String
ISO 8601 - Day should not be more than 10 days from from_date
No
OrderCancellation
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" order_id " : " 20211116N100000022 " ,
" exchange_code " : " NSE "
});
var config = {
method : ' delete ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"order_id" : "20211116N100000022" ,
"exchange_code" : "NSE"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "DELETE" , "/icicidirectwebapi_core/api/v1/order" , 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 \"order_id\": \"20211116N100000022\",\r\n \"exchange_code\": \"NSE\"\r\n}" );
Request request = new Request . Builder ()
. url ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" )
. method ( "DELETE" , body )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . DELETE );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""order_id"": ""20211116N100000022"",
" + "\n" +
@" ""exchange_code"": ""NSE""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Category
Value
HTTP Request
DELETE
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order
Body Parameters
Parameter
Data Type
Description
Mandatory
order_id
String
Order Reference to cancel order
Yes
exchange_code
String
"NSE", "NFO", "BSE"
Yes
OrderModification
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" order_id " : " 20211116N100000022 " ,
" exchange_code " : " NSE " ,
" quantity " : " 10 " ,
" price " : " 1013.11 " ,
" stoploss " : "" ,
" disclosed_quantity " : "" ,
" order_type " : " Limit " ,
" validity " : "" ,
" expiry_date " : "" ,
" right " : "" ,
" strike_price " : ""
});
var config = {
method : ' put ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"order_id" : "20211116N100000022" ,
"exchange_code" : "NSE" ,
"quantity" : "10" ,
"price" : "1013.11" ,
"stoploss" : "" ,
"disclosed_quantity" : "" ,
"order_type" : "Limit" ,
"validity" : "" ,
"expiry_date" : "" ,
"right" : "" ,
"strike_price" : ""
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "PUT" , "/icicidirectwebapi_core/api/v1/order" , 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 \"order_id\":\"20211116N100000022\",\r\n \"exchange_code\":\"NSE\",\r\n \"quantity\":\"10\",\r\n \"price\":\"1013.11\",\r\n \"stoploss\":\"\",\r\n \"disclosed_quantity\":\"\",\r\n \"order_type\":\"Limit\",\r\n \"validity\":\"\",\r\n \"expiry_date\":\"\",\r\n \"right\":\"\",\r\n \"strike_price\":\"\"\r\n}" );
Request request = new Request . Builder ()
. url ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" )
. method ( "PUT" , body )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . PUT );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""order_id"":""20211116N100000022"",
" + "\n" +
@" ""exchange_code"":""NSE"",
" + "\n" +
@" ""quantity"":""10"",
" + "\n" +
@" ""price"":""1013.11"",
" + "\n" +
@" ""stoploss"":"""",
" + "\n" +
@" ""disclosed_quantity"":"""",
" + "\n" +
@" ""order_type"":""Limit"",
" + "\n" +
@" ""validity"":"""",
" + "\n" +
@" ""expiry_date"":"""",
" + "\n" +
@" ""right"":"""",
" + "\n" +
@" ""strike_price"":""""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"order_reference" : "20211005N100000016" ,
"message" : "Successfully Modified the order" ,
"limit" : "" ,
"popup_flag" : "" ,
"indicator" : "0" ,
"trade_value" : ""
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
PUT
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/order
Body Parameters
Parameter
Data Type
Description
Mandatory
order_id
String
Order Reference to update data of order
Yes
exchange_code
String
"NSE", "NFO", "BSE"
Yes
order_type
String
"limit","market","stoploss"
No
stoploss
String
Numeric String of Currency
No
quantity
String
Modify number of quantity on placed order
No
price
String
Numeric String of Currency
No
validity
String
"day","ioc","vtc"
No
disclosed_quantity
String
Modify number of disclosed quantity on placed order
No
validity_date
String
ISO 8601
No
PortfolioHoldings
GetPortfolioHoldings
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" exchange_code " : "" ,
" from_date " : "" ,
" to_date " : "" ,
" underlying " : "" ,
" portfolio_type " : ""
});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfolioholdings ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"exchange_code" : "" ,
"from_date" : "" ,
"to_date" : "" ,
"underlying" : "" ,
"portfolio_type" : ""
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/portfolioholdings" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfolioholdings" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfolioholdings" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""exchange_code"":"""",
" + "\n" +
@" ""from_date"":"""",
" + "\n" +
@" ""to_date"":"""",
" + "\n" +
@" ""underlying"":"""",
" + "\n" +
@" ""portfolio_type"":""""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfolioholdings
Body Parameters
Parameter
Data Type
Description
Mandatory
exchange_code
String
"NSE", "NFO", "BSE"
Yes
from_date
String
ISO 8601
No
to_date
String
ISO 8601
No
underlying
String
--
No
portfolio_type
String
--
No
PortfolioPositions
GetPortfolioPositions
var axios = require ( ' axios ' );
var data = JSON . stringify ({});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfoliopositions ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/portfoliopositions" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfoliopositions" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfoliopositions" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"EquityPortfolioPositions" : [],
"FNOPortfolioPositions" : [
{
"BOARD_LOT_QTY" : "0" ,
"LST_TRD_PRC" : "2100000" ,
"MIN_LOT_QTY" : "50" ,
"STRK_PRC" : "0" ,
"LMT_RT" : "0" ,
"ORD_TOT_QTY" : "0" ,
"STP_LSS_TGR" : "2102165" ,
"XCHNG_CAN_QTY" : "0" ,
"TMPLT" : "0" ,
"EXRC_QTY" : "0" ,
"CVR_QTY" : "50" ,
"C_OPNPSTN_QTY" : "100" ,
"UI_BUY_QTY" : "0" ,
"UI_SELL_QTY" : "0" ,
"CURR_RT" : "0" ,
"COUNTER" : "1" ,
"CTGRY_INDSTK" : "I" ,
"DLVRY_ALLWD" : "" ,
"EXER_TYP" : "E" ,
"OPT_TYP" : "*" ,
"PRDCT_TYP" : "F" ,
"QT_TRDNG_FLG" : "T" ,
"RQST_TYP" : "A" ,
"STLMNT_TYP" : "" ,
"ORD_TYP" : "" ,
"EX_ORDR_TYP" : "" ,
"ORDR_FLW" : "*" ,
"RMS_PRCSD_FLG" : "Y" ,
"SPL_FLG" : "Y" ,
"EXRC_STTS" : "" ,
"MOD_CAN_FLG" : "" ,
"UPLD_MTCH_FLG" : "" ,
"DAM_TRNSCTN" : "" ,
"DR_CR_FLG" : "" ,
"DWL_FLG" : "Y" ,
"SETTLOR_STTS" : "Y" ,
"STATUS_FLG" : "" ,
"CNTRCT_TAG" : "B" ,
"C_OPNPSTN_FLW" : "B" ,
"MTM_FLG" : "" ,
"NKD_BLKD_FLG" : "" ,
"EBA_STTS" : "" ,
"BK_UBK_FLG" : "C" ,
"FUT_CONV_FLG" : "F" ,
"IS_FLG" : "*" ,
"SO_AMT_BLKD" : "0" ,
"OPNPSTN_VAL" : "0" ,
"PSTN_AMT_BLKD" : "0" ,
"FUT_PRC" : "0" ,
"AMOUNT" : "57950500" ,
"BAL_AMT" : "57950500" ,
"C_MTM_OPN_VAL" : "210000000" ,
"U_ORDR_MRGN" : "0" ,
"U_IMTM_SPRD_PL" : "2100000" ,
"U_MM_TRD_MRGN" : "56425000" ,
"UNRLZD_PL" : "0" ,
"EXPRY_DT" : "25-Nov-2021" ,
"ND_END_DT" : "" ,
"ND_STRT_DT" : "" ,
"UNDRLYNG" : "NIFTY" ,
"XCHNG_CD" : "NFO" ,
"EBA_MTCH_ACT_NO" : "8509003752" ,
"ORDR_RFRNC" : "" ,
"ORD_VALID_DT" : "*" ,
"PLG_ORDR_RFRNC" : ""
}
]
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/portfoliopositions
Body Parameters
Parameter
Data Type
Description
--
--
--
Quotes
GetQuotes
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" stock_code " : "" ,
" exchange_code " : " NFO " ,
" expiry_date " : " 2021-12-30T06:00:00.000Z " ,
" product_type " : " Futures " ,
" right " : " Others " ,
" strike_price " : " 0 "
});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/quotes ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"stock_code" : "" ,
"exchange_code" : "NFO" ,
"expiry_date" : "2021-12-30T06:00:00.000Z" ,
"product_type" : "Futures" ,
"right" : "Others" ,
"strike_price" : "0"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/quotes" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/quotes" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/quotes" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""stock_code"": """",
" + "\n" +
@" ""exchange_code"": ""NFO"",
" + "\n" +
@" ""expiry_date"": ""2021-12-30T06:00:00.000Z"",
" + "\n" +
@" ""product_type"": ""Futures"",
" + "\n" +
@" ""right"": ""Others"",
" + "\n" +
@" ""strike_price"": ""0""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"fno_quotes_list" : [
{
"security_exchange_code" : "NFO" ,
"security_product_type" : "Futures" ,
"security_underlying" : "NIFTY" ,
"security_expiry_date" : "30-Dec-2021" ,
"security_exercise_type" : "European" ,
"security_option_type" : "*" ,
"security_strike_price" : "0" ,
"security_last_traded_price" : 1900000 ,
"security_last_traded_time" : "13-Nov-2021 14:29:19" ,
"security_best_bid_price" : 1750000 ,
"security_best_bid_quantity" : "2000" ,
"security_best_offer_price" : 0 ,
"security_best_offer_quantity" : "0" ,
"security_open_price" : 1819710 ,
"security_high" : 2000870 ,
"security_low" : 1637075 ,
"security_previous_close" : 1818970 ,
"security_per_change" : 445 ,
"security_high_price_range" : 1975815 ,
"security_low_price_change" : 1616580 ,
"security_total_quantity_traded" : "371700" ,
"security_cash_market_quote_of_underlying" : "18016.9"
}
]
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/quotes
Body Parameters
Parameter
Data Type
Description
Mandatory
stock_code
String
"AXIBAN","TATMOT"
Yes
exchange_code
String
"NSE","NFO","BSE"
Yes
expiry_date
String
ISO 8601
No
product_type
String
"futures","options","furtureplus","futureplus_sltp","optionplus", "cash","eatm","btst","margin","marginplus"
No
right
String
"call","put","others"
No
strike_price
String
Numeric String of Currency
No
SquareOff
SquareOff
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" source_flag " : "" ,
" order_stock_code " : " NIFTY " ,
" exchange_code " : " NFO " ,
" order_quantity " : " 50 " ,
" order_rate " : " 0 " ,
" order_flow " : " S " ,
" order_type " : " M " ,
" order_validity " : " T " ,
" order_stop_loss_price " : " 0 " ,
" order_disclosed_quantity " : " 0 " ,
" protection_percentage " : "" ,
" order_segment_code " : "" ,
" order_settlement " : "" ,
" margin_amount " : "" ,
" order_open_quantity " : "" ,
" order_cover_quantity " : "" ,
" order_product " : " F " ,
" order_exp_date " : " 25-Nov-2021 " ,
" order_exc_type " : "" ,
" order_option_type " : "" ,
" order_strike_price " : " 0 " ,
" order_trade_date " : " 16-Nov-2021 " ,
" trade_password " : "" ,
" order_option_exercise_type " : " *E "
});
var config = {
method : ' post ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/squareoff ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"source_flag" : "" ,
"order_stock_code" : "NIFTY" ,
"exchange_code" : "NFO" ,
"order_quantity" : "50" ,
"order_rate" : "0" ,
"order_flow" : "S" ,
"order_type" : "M" ,
"order_validity" : "T" ,
"order_stop_loss_price" : "0" ,
"order_disclosed_quantity" : "0" ,
"protection_percentage" : "" ,
"order_segment_code" : "" ,
"order_settlement" : "" ,
"margin_amount" : "" ,
"order_open_quantity" : "" ,
"order_cover_quantity" : "" ,
"order_product" : "F" ,
"order_exp_date" : "25-Nov-2021" ,
"order_exc_type" : "" ,
"order_option_type" : "" ,
"order_strike_price" : "0" ,
"order_trade_date" : "16-Nov-2021" ,
"trade_password" : "" ,
"order_option_exercise_type" : "*E"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "POST" , "/icicidirectwebapi_core/api/v1/squareoff" , 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 \"source_flag\": \"\",\r\n \"order_stock_code\": \"NIFTY\",\r\n \"exchange_code\": \"NFO\",\r\n \"order_quantity\": \"50\",\r\n \"order_rate\": \"0\",\r\n \"order_flow\": \"S\",\r\n \"order_type\": \"M\",\r\n \"order_validity\": \"T\",\r\n \"order_stop_loss_price\": \"0\",\r\n \"order_disclosed_quantity\": \"0\",\r\n \"protection_percentage\": \"\",\r\n \"order_segment_code\": \"\",\r\n \"order_settlement\": \"\",\r\n \"margin_amount\": \"\",\r\n \"order_open_quantity\": \"\",\r\n \"order_cover_quantity\": \"\",\r\n \"order_product\": \"F\",\r\n \"order_exp_date\": \"25-Nov-2021\",\r\n \"order_exc_type\": \"\",\r\n \"order_option_type\": \"\",\r\n \"order_strike_price\": \"0\",\r\n \"order_trade_date\": \"16-Nov-2021\",\r\n \"trade_password\": \"\",\r\n \"order_option_exercise_type\": \"*E\"\r\n }" );
Request request = new Request . Builder ()
. url ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/squareoff" )
. method ( "POST" , body )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/squareoff" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""source_flag"": """",
" + "\n" +
@" ""order_stock_code"": ""NIFTY"",
" + "\n" +
@" ""exchange_code"": ""NFO"",
" + "\n" +
@" ""order_quantity"": ""50"",
" + "\n" +
@" ""order_rate"": ""0"",
" + "\n" +
@" ""order_flow"": ""S"",
" + "\n" +
@" ""order_type"": ""M"",
" + "\n" +
@" ""order_validity"": ""T"",
" + "\n" +
@" ""order_stop_loss_price"": ""0"",
" + "\n" +
@" ""order_disclosed_quantity"": ""0"",
" + "\n" +
@" ""protection_percentage"": """",
" + "\n" +
@" ""order_segment_code"": """",
" + "\n" +
@" ""order_settlement"": """",
" + "\n" +
@" ""margin_amount"": """",
" + "\n" +
@" ""order_open_quantity"": """",
" + "\n" +
@" ""order_cover_quantity"": """",
" + "\n" +
@" ""order_product"": ""F"",
" + "\n" +
@" ""order_exp_date"": ""25-Nov-2021"",
" + "\n" +
@" ""order_exc_type"": """",
" + "\n" +
@" ""order_option_type"": """",
" + "\n" +
@" ""order_strike_price"": ""0"",
" + "\n" +
@" ""order_trade_date"": ""16-Nov-2021"",
" + "\n" +
@" ""trade_password"": """",
" + "\n" +
@" ""order_option_exercise_type"": ""*E""
" + "\n" +
@" }" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"order_reference" : "202111161100000232" ,
"message" : "Successfully Placed the order" ,
"indicator" : "0"
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
POST
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/squareoff
Body Parameters
Parameter
Data Type
Description
Mandatory
source_flag
String
--
No
order_stock_code
String
"NIFTY","SENSEX"
No
exchange_code
String
"NSE","NFO","BSE"
Yes
order_quantity
String
Number of quantity to sqaure off the orders
No
order_rate
String
Numeric String of Currency
No
order_flow
String
"buy","sell"
No
order_type
String
"limit","market","stoploss"
No
order_validity
String
"day","ioc","vtc"
No
order_stop_loss_price
String
Numeric String of Currency
No
order_disclosed_quantity
String
Number of disclosed quantity to squareoff order
No
protection_percentage
String
--
No
order_segment_code
String
--
No
order_settlement
String
Numeric String of Currency
No
margin_amount
String
Numeric String of Currency
No
order_open_quantity
String
Number of open quantity to squareoff order
No
order_cover_quantity
String
Number of cover quantity to squareoff order
No
order_product
String
"futures","options","cash","eatm","margin"
No
order_exp_date
String
Date when squareoff order will be expired
No
order_exc_type
String
Type to execute order
No
order_option_type
String
"call","put","others"
No
order_strike_price
String
Numeric String of Currency
No
order_trade_date
String
Trade date to squareoff order
No
trade_password
String
--
No
order_option_exercise_type
String
--
No
Trades
GetTradeList
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" from_date " : " 2021-09-28T06:00:00.000Z " ,
" to_date " : " 2021-12-15T06:00:00.000Z " ,
" exchange_code " : " NSE " ,
" product_type " : "" ,
" action " : "" ,
" stock_code " : ""
});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"from_date" : "2021-09-28T06:00:00.000Z" ,
"to_date" : "2021-12-15T06:00:00.000Z" ,
"exchange_code" : "NSE" ,
"product_type" : "" ,
"action" : "" ,
"stock_code" : ""
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/trades" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""from_date"": ""2021-09-28T06:00:00.000Z"",
" + "\n" +
@" ""to_date"": ""2021-12-15T06:00:00.000Z"",
" + "\n" +
@" ""exchange_code"": ""NSE"",
" + "\n" +
@" ""product_type"": """",
" + "\n" +
@" ""action"": """",
" + "\n" +
@" ""stock_code"": """"
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : {
"trade_book" : [
{
"match_account" : "8509003752" ,
"order_trade_date" : "28-Sep-2021" ,
"order_stock_code" : "LARTOU" ,
"order_flow" : "S" ,
"order_quantity" : "1" ,
"order_average_executed_rate" : "1720.90" ,
"order_trans_value" : "1720.90" ,
"order_brokerage" : "15.00" ,
"order_product" : "M" ,
"order_exchange_code" : "NSE" ,
"order_reference" : "20210928N100000067" ,
"order_segment_code" : "N" ,
"order_settlement" : "2021183" ,
"dp_id" : "IN303028" ,
"client_id" : "80003129" ,
"LTP" : "1952.00" ,
"order_eATM_withheld" : "0.00" ,
"order_csh_withheld" : "0.00" ,
"order_total_taxes" : "3.21" ,
"order_type" : "77"
}
]
},
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades
Body Parameters
Parameter
Data Type
Description
Mandatory
from_date
String
ISO 8601
No
to_date
String
ISO 8601
No
exchange_code
String
"NSE","NFO","BSE"
Yes
product_type
String
"futures","options","furtureplus","futureplus_sltp","optionplus", "cash","eatm","btst","margin","marginplus"
No
action
String
"buy","sell"
No
stock_code
String
"AXIBAN","TATMOT"
No
GetTradeDetail
var axios = require ( ' axios ' );
var data = JSON . stringify ({
" exchange_code " : " NSE " ,
" order_id " : " 20210928N100000067 "
});
var config = {
method : ' get ' ,
url : ' https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades ' ,
headers : {
' Content-Type ' : ' application/json ' ,
' X-Checksum ' : ' token ' ,
' X-Timestamp ' : '' ,
' X-AppKey ' : '' ,
' X-SessionToken ' : ''
},
data : data
};
axios ( config )
. then ( function ( response ) {
console . log ( JSON . stringify ( response . data ));
})
. catch ( function ( error ) {
console . log ( error );
});
import http.client
import json
conn = http . client . HTTPSConnection ( "uatapi.icicidirect.com" )
payload = json . dumps ({
"exchange_code" : "NSE" ,
"order_id" : "20210928N100000067"
})
headers = {
'Content-Type' : 'application/json' ,
'X-Checksum' : 'token ' ,
'X-Timestamp' : '' ,
'X-AppKey' : '' ,
'X-SessionToken' : ''
}
conn . request ( "GET" , "/icicidirectwebapi_core/api/v1/trades" , 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://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades" )
. method ( "GET" , null )
. addHeader ( "Content-Type" , "application/json" )
. addHeader ( "X-Checksum" , "token " )
. addHeader ( "X-Timestamp" , "" )
. addHeader ( "X-AppKey" , "" )
. addHeader ( "X-SessionToken" , "" )
. build ();
Response response = client . newCall ( request ). execute ();
var client = new RestClient ( "https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Content-Type" , "application/json" );
request . AddHeader ( "X-Checksum" , "token " );
request . AddHeader ( "X-Timestamp" , "" );
request . AddHeader ( "X-AppKey" , "" );
request . AddHeader ( "X-SessionToken" , "" );
var body = @"{
" + "\n" +
@" ""exchange_code"": ""NSE"",
" + "\n" +
@" ""order_id"": ""20210928N100000067""
" + "\n" +
@"}" ;
request . AddParameter ( "application/json" , body , ParameterType . RequestBody );
IRestResponse response = client . Execute ( request );
Console . WriteLine ( response . Content );
Sample JSON Response
{
"Success" : [
{
"order_settlement" : "2021183" ,
"order_exchange_trade_number" : "81" ,
"order_executed_quantity" : "1" ,
"order_flow" : "S" ,
"order_brokerage" : "17.71" ,
"order_pure_brokerage" : "15" ,
"order_taxes" : "3.2056" ,
"order_eATM_withheld" : "0" ,
"order_cash_withheld" : "0" ,
"order_executed_rate" : "1720.9" ,
"order_stock_code" : "LARTOU" ,
"order_exchange_code" : "NSE" ,
"match_account" : "8509003752" ,
"order_trade_reference" : "2021/0928/00587863" ,
"order_exchange_trade_tm" : "28-Sep-2021 12:02:02" ,
"order_segment_dis" : "Rolling" ,
"order_segment_code" : "N"
}
],
"Status" : 200 ,
"Error" : null
}
Category
Value
HTTP Request
GET
URL
https://uatapi.icicidirect.com/icicidirectwebapi_core/api/v1/trades
Body Parameters
Parameter
Data Type
Description
Mandatory
exchange_code
String
"NSE","NFO","BSE"
Yes
order_id
String
Order Reference to get detailed data of trade
Yes