Fetching MF Holdings through Free Kite Connect APIs

rs07

function fetchHoldings() {
var accessToken = PropertiesService.getScriptProperties().getProperty('ACCESS_TOKEN');

if (!accessToken) {
SpreadsheetApp.getUi().alert('❌ Access Token not found! Please login again.');
return;
}

// API URLs
var mfUrl = 'https://api.kite.trade/portfolio/mf/holdings'; // Mutual Fund holdings URL

var options = {
method: 'get',
headers: {
'X-Kite-Version': '3',
'Authorization': 'token ' + API_KEY + ':' + accessToken
}
};

try {
// Fetch mutual fund holdings
var mfResponse = UrlFetchApp.fetch(mfUrl, options);
var mfData = JSON.parse(mfResponse.getContentText());

if (mfData.status !== 'success') {
Logger.log("Didn't get it");
return;
} else {
Logger.log(mfData);
}


I am not able to get the MF Holdings through Free APP that I created on Kite Connect.
  • chinrust
    Can you describe more? Like what errors you are encountering?
Sign In or Register to comment.