loader2
Login OPEN ICICI 3-in-1 Account
  • Text Size
  • Text to Speech
  • Color Contrast
  • Pause Animations

How to Generate Session Key and Install SDK for Breeze API?

02 Feb 2022|
2 min read |
by ICICI Securities Team
Article Image

 

What is Breeze API?

Breeze API is the next-gen Trading API from ICICIdirect which has been built with a Customer-first mentality. We are the offering the widest range of data, unmatched in India alongside a robust and stable framework of processes to ensure data security and privacy

You need to login to on https://api.icicidirect.com/apiuser/home to save your App.

What is a Session Key?

A session key is a temporary key that is only used once, during one stretch of time, for encrypting and decrypting data. This is similar to a password that someone has to resets every time they login and helps in encrypting a communication session for each app separately. This key or token expires in 24 hours after generation or at midnight.

How can you generate your Session Key?

  • Login with your ICICIdirect Account on https://api.icicidirect.com/apiuser/home and then navigate to ‘View Apps’
  • Select the app for which you want to generate the Session Token and copy its API Key
  • Open a new tab, and switch to Developer Tools (on Chrome, Firefox, and Edge use the keyboard shortcut: Ctrl+Shift+I)
  • Open the URL: https://api.icicidirect.com/apiuser/login?api_key=your_public_key
  • Give ICICIdirect account credentials as usual and submit
  • In the Network Log table, find the resource with the same name as the redirect URL you gave when creating the app. For example, if you gave the redirect URL as https://127.0.0.1:9080/api, look for a row named “127.0.0.1”.Click the row and in the new split, click tab named “Payload”>”Form Data”>”API_Session”.

Against “API_Session” will be an alpha-numeric (could be only numbers or only alphabets) token. This is your Sesssion Key for that app.

What is an SDK?

SDK stands for software development kit or devkit for short. SDK tools will include a variety of things, including libraries, documentation, code samples, processes, and guides. These can be used by developers to integrate into the apps they want to create.

How can you install an SDK?

  • Install virtual environment package.
    (If you have already installed it then skip this step.)
    pip install virtualenv
  • Create and activate the environment.
    virtualenv -p python3 .
    source bin/activate
  • Install breeze-connect SDK  
    pip install breeze-connect

A few samples:

from breeze_connect import BreezeConnect

# Generate Session

isec = BreezeConnect(api_key="your_api_key")

isec.generate_session(api_secret="your_secret",

session_token="YOUR_SESSION_TOKEN_OBTAINED_FROM_LOGIN_PAGE_RESPONSE")

# Websocket

isec.ws_connect()

# subscribe stocks feeds

isec.subscribe_stock(exchange_code="", stock_code="", product_type="", strike_date="", strike_price="", right="", get_exchange_quotes=True, get_market_depth=True)

def on_ticks(ticks):

print("Ticks: {}".format(ticks))

isec.on_ticks = on_ticks

# unsubscribe stocks feeds

isec.unsubscribe_stock(exchange_code="", stock_code="",product_type="", strike_date="", strike_price="", right="", get_exchange_quotes=True, get_market_depth=True)

Please note that the stock symbols for websockets/live data are different from all other end points. The stock codes for this can be referenced from the Security Master file available at https://api.icicidirect.com/breezeapi/documents/index.html#instruments

What are the salient features of Breeze API are:

  1. Historical 1 Second Data: While everyone gives limited amount of Equity OHLC data, only Breeze gives 3 years of second level LTP data. This allows you to model your strategies more accurately and in the process backtest strategies far more accurately.
  2. Historical Derivatives Data: With 3 years of data, no other broker provides Futures or Options historical data for in-depth analysis
  3. Live Streaming OHLC: While everyone gives streaming LTP data, Breeze is the only one that gives streaming OHLC data so that strategies that are written around Historical OHLC data can be simply taken live without the need to change the data handling functions.
  4. Triple secure data: Breeze has SSL + (App Key, Secret Key) encryption + Checksum encryption of the whole data package so no amount of sniffing or hacking can reveal your data to the wannabe hacker. Breeze is the only retail API in India has this feature.
Disclaimericon
Share
instagram facebook twitter linkedin mail whatsApp
Did you enjoy this article?

Related Articles

Recent Articles

View all

Know Your Break-Even Before Placing a Trade

Learn how to calculate the break-even point in commodity trading by factoring in brokerage, taxes, and other charges

icon209 views icon1 minutes icon01 Jul 2026

ICICI Direct Auto Order Slicing: Faster Execution for Large Trades

Learn how ICICI Direct's Auto Order Slicing automatically splits large commodity orders for faster, seamless execution while complying with exchange limits.

icon159 views icon2 minutes icon01 Jul 2026

What is a BSDA Account? Meaning, Eligibility, Charges and Latest Rules

Learn about a BSDA account, its eligibility criteria, annual maintenance charges, and the latest SEBI rules for Basic Services Demat Accounts.

icon251 views icon2 minutes icon30 Jun 2026

Download
iLearn application

Elevate Your Financial Knowledge with the
ICICI Direct iLearn App

Download
ICICI Direct app

Elevate Your Financial Knowledge with the
ICICI Direct iLearn App