### Funds and Margins Response Example Source: https://kite.trade/docs/connect/v3/user Example JSON response detailing equity and commodity funds, cash, and margin information. ```json { "status": "success", "data": { "equity": { "enabled": true, "net": 99725.05000000002, "available": { "adhoc_margin": 0, "cash": 245431.6, "opening_balance": 245431.6, "live_balance": 99725.05000000002, "collateral": 0, "intraday_payin": 0 }, "utilised": { "debits": 145706.55, "exposure": 38981.25, "m2m_realised": 761.7, "m2m_unrealised": 0, "option_premium": 0, "payout": 0, "span": 101989, "holding_sales": 0, "turnover": 0, "liquid_collateral": 0, "stock_collateral": 0, "delivery": 0 } }, "commodity": { "enabled": true, "net": 100661.7, "available": { "adhoc_margin": 0, "cash": 100661.7, "opening_balance": 100661.7, "live_balance": 100661.7, "collateral": 0, "intraday_payin": 0 }, "utilised": { "debits": 0, "exposure": 0, "m2m_realised": 0, "m2m_unrealised": 0, "option_premium": 0, "payout": 0, "span": 0, "holding_sales": 0, "turnover": 0, "liquid_collateral": 0, "stock_collateral": 0, "delivery": 0 } } } } } ``` -------------------------------- ### User Profile Response Example Source: https://kite.trade/docs/connect/v3/user Example JSON response structure for a successful user profile retrieval. ```json { "status": "success", "data": { "user_id": "AB1234", "user_type": "individual", "email": "xxxyyy@gmail.com", "user_name": "AxAx Bxx", "user_shortname": "AxAx", "broker": "ZERODHA", "exchanges": [ "BFO", "MCX", "NSE", "CDS", "BSE", "BCD", "MF", "NFO" ], "products": [ "CNC", "NRML", "MIS", "BO", "CO" ], "order_types": [ "MARKET", "LIMIT", "SL", "SL-M" ], "avatar_url": null, "meta": { "demat_consent": "physical" } } } ``` -------------------------------- ### Example JSON Basket for Orders Source: https://kite.trade/docs/connect/v3/basket Prepare a JSON list of instruments with required order parameters for offsite execution. This format is used to POST multiple orders. ```json [ { "variety": "regular", "tradingsymbol": "INFY", "exchange": "NSE", "transaction_type": "BUY", "order_type": "MARKET", "quantity": 10, "readonly": false }, { "variety": "regular", "tradingsymbol": "NIFTY15DECFUT", "exchange": "NFO", "transaction_type": "SELL", "order_type": "LIMIT", "price": 7845, "quantity": 1, "readonly": false }, { "variety": "co", "tradingsymbol": "RELIANCE", "exchange": "NSE", "transaction_type": "BUY", "order_type": "LIMIT", "product": "MIS", "price": 915.15, "quantity": 1, "trigger_price": 910, "readonly": true } ] ``` -------------------------------- ### Instrument List CSV Format Example Source: https://kite.trade/docs/connect/v3/market-quotes This is an example of the CSV data structure returned by the instruments API. Note that `last_price` is not real-time. Use `exchange` and `tradingsymbol` as a unique key for storage. ```csv instrument_token, exchange_token, tradingsymbol, name, last_price, expiry, strike, tick_size, lot_size, instrument_type, segment, exchange 408065,1594,INFY,INFOSYS,0,,,0.05,1,EQ,NSE,NSE 5720322,22345,NIFTY15DECFUT,,78.0,2015-12-31,,0.05,75,FUT,NFO-FUT,NFO 5720578,22346,NIFTY159500CE,,23.0,2015-12-31,9500,0.05,75,CE,NFO-OPT,NFO 645639,SILVER15DECFUT,,7800.0,2015-12-31,,1,1,FUT,MCX,MCX ``` -------------------------------- ### Create an ATO Alert Source: https://kite.trade/docs/connect/v3/alerts This example demonstrates how to create an ATO (Alert Triggers Order) alert, which automatically places an order when triggered. It requires a 'basket' parameter containing the order details. ```curl curl https://api.kite.trade/alerts \ -H 'X-Kite-Version: 3' \ -H 'Authorization: token api_key:access_token' \ -d 'name=NIFTY 50' \ -d 'lhs_exchange=INDICES' \ -d 'lhs_tradingsymbol=NIFTY 50' \ -d 'lhs_attribute=LastTradedPrice' \ -d 'operator=>=' \ -d 'rhs_type=constant' \ -d 'type=ato' \ -d 'rhs_constant=27000' \ -d 'basket={"name":"alerts-basket","type":"alert","tags":[],"items":[{"type":"insert","tradingsymbol":"RELIANCE","exchange":"NSE","weight":10000,"params":{"transaction_type":"BUY","product":"CNC","order_type":"MARKET","validity":"DAY","validity_ttl":1,"quantity":1,"price":0,"trigger_price":0,"disclosed_quantity":0,"last_price":0,"variety":"regular","tags":[],"squareoff":0,"stoploss":0,"trailing_stoploss":0,"iceberg_legs":0,"market_protection":0}}]}' ``` ```json { "status": "success", "data": { "type": "ato", "user_id": "AB1234", "uuid": "a5a2b03d-4851-44b3-9d85-0123baa4a273", "name": "NIFTY 50", "status": "enabled", "disabled_reason": "", "lhs_attribute": "LastTradedPrice", "lhs_exchange": "INDICES", "lhs_tradingsymbol": "NIFTY 50", "operator": ">=", "rhs_type": "constant", "rhs_attribute": "", "rhs_exchange": "", "rhs_tradingsymbol": "", "rhs_constant": 27000, "alert_count": 0, "created_at": "2025-05-26 12:09:26", "updated_at": "2025-05-26 12:09:26" } } ``` -------------------------------- ### Example Order Response (Success) Source: https://kite.trade/docs/connect/v3/orders This JSON object represents a successful retrieval of order data. It includes details for cancelled, complete, and rejected orders, along with their respective statuses and quantities. ```json { "status": "success", "data": [ { "placed_by": "XXXXXX", "order_id": "100000000000000", "exchange_order_id": "200000000000000", "parent_order_id": null, "status": "CANCELLED", "status_message": null, "status_message_raw": null, "order_timestamp": "2021-05-31 09:18:57", "exchange_update_timestamp": "2021-05-31 09:18:58", "exchange_timestamp": "2021-05-31 09:15:38", "variety": "regular", "modified": false, "exchange": "CDS", "tradingsymbol": "USDINR21JUNFUT", "instrument_token": 412675, "order_type": "LIMIT", "transaction_type": "BUY", "validity": "DAY", "product": "NRML", "quantity": 1, "disclosed_quantity": 0, "price": 72, "trigger_price": 0, "average_price": 0, "filled_quantity": 0, "pending_quantity": 1, "cancelled_quantity": 1, "market_protection": 0, "meta": {}, "tag": null, "guid": "XXXXX" }, { "placed_by": "XXXXXX", "order_id": "300000000000000", "exchange_order_id": "400000000000000", "parent_order_id": null, "status": "COMPLETE", "status_message": null, "status_message_raw": null, "order_timestamp": "2021-05-31 15:20:28", "exchange_update_timestamp": "2021-05-31 15:20:28", "exchange_timestamp": "2021-05-31 15:20:28", "variety": "regular", "modified": false, "exchange": "NSE", "tradingsymbol": "IOC", "instrument_token": 415745, "order_type": "LIMIT", "transaction_type": "BUY", "validity": "DAY", "product": "CNC", "quantity": 1, "disclosed_quantity": 0, "price": 109.4, "trigger_price": 0, "average_price": 109.4, "filled_quantity": 1, "pending_quantity": 0, "cancelled_quantity": 0, "market_protection": 0, "meta": {}, "tag": null, "guid": "XXXXXX" }, { "placed_by": "XXXXXX", "order_id": "500000000000000", "exchange_order_id": "600000000000000", "parent_order_id": null, "status": "COMPLETE", "status_message": null, "status_message_raw": null, "order_timestamp": "2021-05-31 15:20:51", "exchange_update_timestamp": "2021-05-31 15:20:52", "exchange_timestamp": "2021-05-31 15:20:52", "variety": "regular", "modified": false, "exchange": "NSE", "tradingsymbol": "IOC", "instrument_token": 415745, "order_type": "MARKET", "transaction_type": "SELL", "validity": "DAY", "product": "CNC", "quantity": 1, "disclosed_quantity": 0, "price": 0, "trigger_price": 0, "average_price": 109.35, "filled_quantity": 1, "pending_quantity": 0, "cancelled_quantity": 0, "market_protection": 0, "meta": {}, "tag": null, "guid": "XXXX" }, { "placed_by": "XXXXXX", "order_id": "220524001859672", "exchange_order_id": null, "parent_order_id": null, "status": "REJECTED", "status_message": "Insufficient funds. Required margin is 95417.84 but available margin is 74251.80. Check the orderbook for open orders.", "status_message_raw": "RMS:Margin Exceeds,Required:95417.84, Available:74251.80 for entity account-XXXXX across exchange across segment across product ", "order_timestamp": "2022-05-24 12:26:52", "exchange_update_timestamp": null, "exchange_timestamp": null, "variety": "iceberg", "modified": false, "exchange": "NSE", "tradingsymbol": "SBIN", "instrument_token": 779521, "order_type": "LIMIT", "transaction_type": "BUY", "validity": "TTL", "validity_ttl": 2, "product": "CNC", "quantity": 200, "disclosed_quantity": 0, "price": 463, "trigger_price": 0, "average_price": 0, "filled_quantity": 0, "pending_quantity": 0, "cancelled_quantity": 0, "market_protection": 0, "meta": { "iceberg": { "leg": 1, "legs": 5, "leg_quantity": 200, "total_quantity": 1000, "remaining_quantity": 800 } }, "tag": "icebergord", "tags": [ "icebergord" ], "guid": "XXXXXX" }, { "placed_by": "XXXXXX", "order_id": "700000000000000", "exchange_order_id": "800000000000000", "parent_order_id": null, "status": "COMPLETE", "status_message": null, "status_message_raw": null, "order_timestamp": "2021-05-31 16:00:36", ``` -------------------------------- ### Order Margins Response Structure Source: https://kite.trade/docs/connect/v3/margins This is an example response structure for order margin calculations, detailing various margin components and charges. ```json { "status": "success", "data": [ { "type": "equity", "tradingsymbol": "INFY", "exchange": "NSE", "span": 0, "exposure": 0, "option_premium": 0, "additional": 0, "bo": 0, "cash": 0, "var": 1498, "pnl": { "realised": 0, "unrealised": 0 }, "leverage": 1, "charges": { "transaction_tax": 1.498, "transaction_tax_type": "stt", "exchange_turnover_charge": 0.051681, "sebi_turnover_charge": 0.001498, "brokerage": 0.01, "stamp_duty": 0.22, "gst": { "igst": 0.011372219999999999, "cgst": 0, "sgst": 0, "total": 0.011372219999999999 }, "total": 1.79255122 }, "total": 1498 } ] } ``` -------------------------------- ### Retrieve Funds and Margins Source: https://kite.trade/docs/connect/v3/user Get overall funds and margin information for both equity and commodity segments using the /user/margins endpoint. Requires X-Kite-Version header set to 3. ```shell curl "https://api.kite.trade/user/margins" \ -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" ``` -------------------------------- ### Example Position Data Structure Source: https://kite.trade/docs/connect/v3/portfolio This JSON structure represents a single position. It includes details such as tradingsymbol, exchange, instrument_token, product type, quantities, prices, and PnL. ```json { "tradingsymbol": "LEADMINI17DECFUT", "exchange": "MCX", "instrument_token": 53496327, "product": "NRML", "quantity": 1, "overnight_quantity": 0, "multiplier": 1000, "average_price": 161.05, "close_price": 0, "last_price": 161.05, "value": -161050, "pnl": 0, "m2m": 0, "unrealised": 0, "realised": 0, "buy_quantity": 1, "buy_price": 161.05, "buy_value": 161050, "buy_m2m": 161050, "sell_quantity": 0, "sell_price": 0, "sell_value": 0, "sell_m2m": 0, "day_buy_quantity": 1, "day_buy_price": 161.05, "day_buy_value": 161050, "day_sell_quantity": 0, "day_sell_price": 0, "day_sell_value": 0 } ``` ```json { "tradingsymbol": "SBIN", "exchange": "NSE", "instrument_token": 779521, "product": "CO", "quantity": 0, "overnight_quantity": 0, "multiplier": 1, "average_price": 0, "close_price": 0, "last_price": 308.4, "value": -2, "pnl": -2, "m2m": -2, "unrealised": -2, "realised": 0, "buy_quantity": 1, "buy_price": 311, "buy_value": 311, "buy_m2m": 311, "sell_quantity": 1, "sell_price": 309, "sell_value": 309, "sell_m2m": 309, "day_buy_quantity": 1, "day_buy_price": 311, "day_buy_value": 311, "day_sell_quantity": 1, "day_sell_price": 309, "day_sell_value": 309 } ``` -------------------------------- ### Response for Retrieving All Alerts Source: https://kite.trade/docs/connect/v3/alerts Example JSON response when retrieving all alerts. It includes details for both 'simple' and 'ato' alert types, such as user ID, UUID, name, status, and specific alert conditions. ```json { "status": "success", "data": [ { "type": "simple", "user_id": "AB1234", "uuid": "550e8400-e29b-41d4-a716-446655440000", "name": "NIFTY 50", "status": "enabled", "disabled_reason": "", "lhs_attribute": "LastTradedPrice", "lhs_exchange": "INDICES", "lhs_tradingsymbol": "NIFTY 50", "operator": ">=", "rhs_type": "constant", "rhs_attribute": "", "rhs_exchange": "", "rhs_tradingsymbol": "", "rhs_constant": 27000, "alert_count": 0, "created_at": "2025-05-26 12:07:50", "updated_at": "2025-05-26 12:07:50" }, { "type": "ato", "user_id": "AB1234", "uuid": "e888ed4a-6801-406f-bdc2-002db5a8411d", "name": "buy gold", "status": "disabled", "disabled_reason": "", "basket": { "items": [ { "id": 275218517, "tradingsymbol": "GOLDBEES", "exchange": "NSE", "instrument_token": 3693569, "weight": 10000, "params": { "validity": "DAY", "validity_ttl": 0, "variety": "regular", "product": "CNC", "order_type": "LIMIT", "transaction_type": "BUY", "quantity": 10000, "disclosed_quantity": 0, "price": 72.22, "trigger_price": 0, "squareoff": 0, "stoploss": 0, "trailing_stoploss": 0, "gtt": { "target": 0, "stoploss": 0 }, "tags": [] } } ] }, "lhs_attribute": "LastTradedPrice", "lhs_exchange": "NSE", "lhs_tradingsymbol": "GOLDBEES", "operator": "<=", "rhs_type": "constant", "rhs_attribute": "", "rhs_exchange": "", "rhs_tradingsymbol": "", "rhs_constant": 71.8, "alert_count": 1, "created_at": "2025-02-17 08:24:10", "updated_at": "2025-02-17 09:15:20" } ] } ``` -------------------------------- ### Custom HTML5 Link for Buy Order Source: https://kite.trade/docs/connect/v3/publisher Transform a standard HTML `` tag into a trade button by adding Kite-specific data attributes. This example creates a link to initiate a market buy order for SBIN. ```html Buy SBI stock ``` -------------------------------- ### Auto Slice Order Response Example Source: https://kite.trade/docs/connect/v3/orders This JSON response illustrates the outcome of an auto-sliced order, showing both successfully placed slices with order IDs and failed slices with error details. ```json { "status": "success", "data": [ { "order_id": "1914227164488687616" }, { "order_id": "1914227164534824960" }, { "order_id": "1914227164580962304" }, { "error": { "code": 400, "error_type": "MarginException", "message": "Insufficient funds. Required margin is 228365.92 but available margin is 228358.50.", "data": null } }, { "order_id": "1914227164681625600" } ] } ``` -------------------------------- ### Custom HTML5 Button for Cover Order Source: https://kite.trade/docs/connect/v3/publisher Configure an HTML button to initiate a Cover Order (CO) by specifying the `data-variety` attribute. This example sets up a limit buy order for RELIANCE with CO parameters. ```html ``` -------------------------------- ### Get Positions Source: https://kite.trade/docs/connect/v3/portfolio Retrieves the user's current net positions and daily trading activity. The 'net' data represents the overall portfolio, while 'day' provides a snapshot of intraday transactions. ```APIDOC ## GET /portfolio/positions ### Description Retrieves the user's current net positions and daily trading activity. The 'net' data represents the overall portfolio, while 'day' provides a snapshot of intraday transactions. ### Method GET ### Endpoint /portfolio/positions ### Headers - X-Kite-Version: 3 - Authorization: token api_key:access_token ### Response #### Success Response (200) - **status** (string) - Indicates the success of the request. - **data** (object) - Contains the portfolio data. - **net** (array) - Array of net position objects. - **tradingsymbol** (string) - Trading symbol of the instrument. - **exchange** (string) - Exchange where the instrument is traded. - **instrument_token** (integer) - Unique identifier for the instrument. - **product** (string) - Product type (e.g., NRML, CO). - **quantity** (integer) - Current net quantity. - **overnight_quantity** (integer) - Quantity carried over from previous day. - **multiplier** (integer) - Multiplier for the instrument. - **average_price** (float) - Average buy price. - **close_price** (float) - Closing price of the instrument. - **last_price** (float) - Last traded price. - **value** (float) - Total value of the position. - **pnl** (float) - Profit or loss. - **m2m** (float) - Mark-to-market value. - **unrealised** (float) - Unrealised profit or loss. - **realised** (float) - Realised profit or loss. - **buy_quantity** (integer) - Total buy quantity. - **buy_price** (float) - Average buy price. - **buy_value** (float) - Total value of buy orders. - **buy_m2m** (float) - Mark-to-market value for buy orders. - **sell_quantity** (integer) - Total sell quantity. - **sell_price** (float) - Average sell price. - **sell_value** (float) - Total value of sell orders. - **sell_m2m** (float) - Mark-to-market value for sell orders. - **day_buy_quantity** (integer) - Intraday buy quantity. - **day_buy_price** (float) - Intraday average buy price. - **day_buy_value** (float) - Intraday total value of buy orders. - **day_sell_quantity** (integer) - Intraday sell quantity. - **day_sell_price** (float) - Intraday average sell price. - **day_sell_value** (float) - Intraday total value of sell orders. - **day** (array) - Array of daily position objects (same structure as net). ### Request Example ```bash curl "https://api.kite.trade/portfolio/positions" \ -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" ``` ### Response Example ```json { "status": "success", "data": { "net": [ { "tradingsymbol": "LEADMINI17DECFUT", "exchange": "MCX", "instrument_token": 53496327, "product": "NRML", "quantity": 1, "overnight_quantity": 0, "multiplier": 1000, "average_price": 161.05, "close_price": 0, "last_price": 161.05, "value": -161050, "pnl": 0, "m2m": 0, "unrealised": 0, "realised": 0, "buy_quantity": 1, "buy_price": 161.05, "buy_value": 161050, "buy_m2m": 161050, "sell_quantity": 0, "sell_price": 0, "sell_value": 0, "sell_m2m": 0, "day_buy_quantity": 1, "day_buy_price": 161.05, "day_buy_value": 161050, "day_sell_quantity": 0, "day_sell_price": 0, "day_sell_value": 0 } ], "day": [ { "tradingsymbol": "GOLDGUINEA17DECFUT", "exchange": "MCX", "instrument_token": 53505799, "product": "NRML", "quantity": -3, "overnight_quantity": 0, "multiplier": 1, "average_price": 23340, "close_price": 23232, "last_price": 23355, "value": 69972, "pnl": -93, "m2m": -93, "unrealised": -93, "realised": 0, "buy_quantity": 1, "buy_price": 23388, "buy_value": 23388, "buy_m2m": 23388, "sell_quantity": 4, "sell_price": 23340, "sell_value": 93360, "sell_m2m": 93360, "day_buy_quantity": 1, "day_buy_price": 23388, "day_buy_value": 23388, "day_sell_quantity": 4, "day_sell_price": 23340, "day_sell_value": 93360 } ] } } ``` ``` -------------------------------- ### Custom HTML5 Button for Sell Order Source: https://kite.trade/docs/connect/v3/publisher Utilize a standard HTML ` ``` -------------------------------- ### KiteConnect.ready() Source: https://kite.trade/docs/connect/v3/publisher Safely initializes KiteConnect functionality after all assets have loaded asynchronously. All other KiteConnect calls should be wrapped within this function. ```APIDOC ## KiteConnect.ready() ### Description Waits asynchronously for all plugin assets to load before executing the provided callback function. This ensures that all KiteConnect functionalities are available. ### Arguments * `function()` - A callback function to execute once KiteConnect is ready. ``` -------------------------------- ### API Server Error Response Example Source: https://kite.trade/docs/connect/v3/exceptions This is an example of an error response from the API server, indicating a 500 Internal Server Error with a specific exception type. ```http HTTP/1.1 500 Server error Content-Type: application/json { "status": "error", "message": "Error message", "error_type": "GeneralException" } ``` -------------------------------- ### Place a Regular Order Source: https://kite.trade/docs/connect/v3/orders Use this endpoint to place a regular order. Ensure all required parameters like tradingsymbol, exchange, transaction_type, order_type, quantity, product, and validity are provided. ```bash curl https://api.kite.trade/orders/regular \ -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" \ -d "tradingsymbol=ACC" \ -d "exchange=NSE" \ -d "transaction_type=BUY" \ -d "order_type=MARKET" \ -d "quantity=1" \ -d "product=MIS" \ -d "validity=DAY" ``` ```json { "status": "success", "data": { "order_id": "151220000000000" } } ``` -------------------------------- ### Retrieve Alert History using GET Call Source: https://kite.trade/docs/connect/v3/alerts Fetch the history of when an alert was triggered, including market data at the time of the trigger, by sending a GET request to the alert's history endpoint. ```bash curl "https://api.kite.trade/alerts/550e8400-e29b-41d4-a716-446655440000/history" \ -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" ``` -------------------------------- ### Get User Profile Source: https://kite.trade/docs/connect/v3/user Retrieves the profile information for the authenticated user. ```APIDOC ## Get User Profile ### Description Retrieves the profile information for the authenticated user. ### Method GET ### Endpoint `/user/profile` ### Response #### Success Response (200) - **user_id** (string) - The unique, permanent user id registered with the broker and the exchanges. - **user_name** (string) - User's real name. - **user_shortname** (string) - Shortened version of the user's real name. - **email** (string) - User's email. - **user_type** (string) - User's registered role at the broker. This will be `individual` for all retail users. - **broker** (string) - The broker ID. - **exchanges** (string[]) - Exchanges enabled for trading on the user's account. - **products** (string[]) - Margin product types enabled for the user. - **order_types** (string[]) - Order types enabled for the user. - **api_key** (string) - The API key for which the authentication was performed. - **access_token** (string) - The authentication token that's used with every subsequent request. - **public_token** (string) - A token for public session validation where requests may be exposed to the public. - **refresh_token** (string) - A token for getting long standing read permissions. - **login_time** (string) - User's last login time. - **meta** (map) - `demat_consent`: empty, consent or physical. - **avatar_url** (string) - Full URL to the user's avatar (PNG image) if there's one. ``` -------------------------------- ### Get User Margins Source: https://kite.trade/docs/connect/v3/user Retrieves detailed funds and margin information for a specific trading segment. ```APIDOC ## Get User Margins ### Description Retrieves detailed funds and margin information for a specific trading segment. ### Method GET ### Endpoint `/user/margins/:segment` ### Parameters #### Path Parameters - **segment** (string) - Required - The trading segment for which to retrieve margin information (e.g., 'equity', 'commodity', 'currency'). ``` -------------------------------- ### Initialize KiteConnect and Add Orders Source: https://kite.trade/docs/connect/v3/publisher Initializes KiteConnect, adds multiple orders to a basket, and registers a callback for transaction completion. Ensure KiteConnect is ready before executing custom code. ```javascript KiteConnect.ready(function () { var kite = new KiteConnect("your_api_key"); kite.add({ exchange: "NSE", tradingsymbol: "INFY", quantity: 5, transaction_type: "BUY", order_type: "MARKET", }); kite.add({ exchange: "NSE", tradingsymbol: "SBIN", quantity: 1, order_type: "LIMIT", transaction_type: "SELL", price: 105, }); kite.add({ tradingsymbol: "RELIANCE", exchange: "NSE", transaction_type: "BUY", order_type: "LIMIT", product: "MIS", price: 915.15, quantity: 1, variety: "co", trigger_price: 910, readonly: true, }); kite.finished(function (status, request_token) { alert("Finished. Status is " + status); }); kite.renderButton("#default-button"); kite.link("#custom-button"); }); ``` -------------------------------- ### Initiate Holdings Authorisation (cURL) Source: https://kite.trade/docs/connect/v3/portfolio Use this cURL command to initiate the authorisation process for equity holdings. You can specify individual ISINs and quantities or authorise the entire holdings. The response contains a request ID used for redirection. ```bash curl --request POST https://api.kite.trade/portfolio/holdings/authorise -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" \ -d "isin=INE002A01018" -d "quantity=50" \ -d "isin=INE009A01021" -d "quantity=50" ``` -------------------------------- ### Retrieve mutual fund holdings Source: https://kite.trade/docs/connect/v3/mutual-funds Get a list of all mutual fund units currently held in the user's DEMAT account. ```APIDOC ## GET /mf/holdings ### Description Retrieve the list of mutual fund holdings available in the DEMAT account. ### Method GET ### Endpoint /mf/holdings ``` -------------------------------- ### Get User Profile Source: https://kite.trade/docs/connect/v3/user Retrieves the full user profile, excluding authentication tokens. This endpoint can be called at any point after successful authentication. ```APIDOC ## GET /user/profile ### Description Retrieves the user's profile information. ### Method GET ### Endpoint https://api.kite.trade/user/profile ### Headers - `X-Kite-Version`: 3 - `Authorization`: token api_key:access_token ### Response #### Success Response (200) - `status` (string): Indicates the success of the request. - `data` (object): Contains the user profile details. - `user_id` (string): The unique user ID. - `user_type` (string): The type of user (e.g., 'individual'). - `email` (string): The user's email address. - `user_name` (string): The user's full name. - `user_shortname` (string): The user's short name. - `broker` (string): The broker ID. - `exchanges` (string[]): List of exchanges enabled for trading. - `products` (string[]): List of margin product types enabled. - `order_types` (string[]): List of order types enabled. - `avatar_url` (string | null): URL to the user's avatar, or null if not available. - `meta` (object): Additional metadata. - `demat_consent` (string): Demat consent status ('physical', 'empty', etc.). ### Response Example ```json { "status": "success", "data": { "user_id": "AB1234", "user_type": "individual", "email": "xxxyyy@gmail.com", "user_name": "AxAx Bxx", "user_shortname": "AxAx", "broker": "ZERODHA", "exchanges": [ "BFO", "MCX", "NSE", "CDS", "BSE", "BCD", "MF", "NFO" ], "products": [ "CNC", "NRML", "MIS", "BO", "CO" ], "order_types": [ "MARKET", "LIMIT", "SL", "SL-M" ], "avatar_url": null, "meta": { "demat_consent": "physical" } } } ``` ``` -------------------------------- ### LTP Quotes Response Structure Source: https://kite.trade/docs/connect/v3/market-quotes Example JSON response for LTP quotes. This response only includes the instrument token and the last traded price. ```json { "status": "success", "data": { "NSE:INFY": { "instrument_token": 408065, "last_price": 1074.35 } } } ``` -------------------------------- ### kite.link() Source: https://kite.trade/docs/connect/v3/publisher Links the order basket to an existing HTML element. Clicking the element will initiate the transaction in an overlay popup. ```APIDOC ## kite.link(element_selector) ### Description Associates the current order basket with an existing HTML element. When the specified element is clicked, the transaction defined in the basket is initiated in an overlay popup. ### Arguments * `element_selector` (string) - A CSS selector string targeting the HTML element to link the basket to (e.g., "#custom-button", ".action-link"). ``` -------------------------------- ### Retrieve Full Instrument List (Bash) Source: https://kite.trade/docs/connect/v3/market-quotes Use this command to fetch a gzipped CSV dump of all tradable instruments across exchanges. Request this once daily and store it locally. Ensure your Authorization header is correctly formatted. ```bash curl "https://api.kite.trade/instruments" \ -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" ``` -------------------------------- ### Get Mutual Fund Holdings Source: https://kite.trade/docs/connect/v3/mutual-funds Retrieve a list of the user's mutual fund holdings. Requires API version 3 and authorization. ```bash curl "https://api.kite.trade/mf/holdings" \ -H "X-Kite-Version: 3" \ -H "Authorization: token api_key:access_token" \ ``` ```json { "status": "success", "data": [ { "folio": "3108290884", "average_price": 78.43, "last_price": 84.86, "last_price_date": "", "pledged_quantity": 0, "fund": "INVESCO INDIA TAX PLAN - DIRECT PLAN", "tradingsymbol": "INF205K01NT8", "pnl": 0, "quantity": 382.488 }, { "folio": "5102495241", "average_price": 1874.101138, "last_price": 2081.4984, "last_price_date": "", "pledged_quantity": 0, "fund": "Indiabulls Liquid Fund - Direct Plan", "tradingsymbol": "INF666M01451", "pnl": 0, "quantity": 1.334 }, { "folio": "9104386836", "average_price": 116.7, "last_price": 101.13, "last_price_date": "", "pledged_quantity": 0, "fund": "BOI AXA TAX ADVANTAGE FUND - DIRECT PLAN", "tradingsymbol": "INF761K01884", "pnl": 0, "quantity": 257.057 } ] } ```