☰
Login
Signup
Home
›
Node JS client
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
14.4K
All Categories
0
Incidents
169
Node JS client
47
Go client
817
.Net API client
393
Kite Publisher
541
.Net / VBA / Excel (3rd party)
473
Algorithms and Strategies
1K
Java client
1.1K
API clients
408
PHP client
4.2K
Python client
355
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.5K
General
In this Discussion
10:45AM
Nivas
12:00PM
dhrutikpatel
getMFHoldings API call broken due to content-type error
dhrutikpatel
July 6
in
Node JS client
When calling the `getMFHoldings()` method from the Kite Connect SDK in the following endpoint:
```js
app.get("/api/v1/mutualfunds", ensureToken, async (req, res) => {
try {
const kc = getKiteClientWithToken();
const mfHoldings = await kc.getMFHoldings();
res.json(mfHoldings);
} catch (err) {
console.error("❌ Error fetching mutual funds:", JSON.stringify(err, null, 2));
res.status(500).send("Failed to fetch mutual funds");
}
});
```
the request results in the following error:
```
{"error_type":"DataException","message":"Unknown content type (application/json;charset=utf-8) with response: ([object Object])"}
```
dhrutikpatel
3:56AM
@sujith
Nivas
10:45AM
edited 10:46AM
Can you enable the debug logs of kiteconnectjs and the complete stack trace here?
You can enable debug logs as mentioned
here
.
PS: Make sure to remove app and client-specific tokens while pasting here.
dhrutikpatel
12:00PM
Since, it is not an error rather it is a wrong response.
{
"error_type": "DataException",
"message": "Unknown content type (application/json;charset=utf-8) with response: ([object Object])"
}
I am not able to see any error on terminal while hitting this API.
CAN YOU CHECK ON YOUR END, THIS API WORK FOR YOU OR NOT?
{
url: '/mf/holdings',
method: 'get',
data: null,
headers: {
common: { Accept: 'application/json, text/plain, */*' },
delete: {},
get: {},
head: {},
post: { 'Content-Type': 'application/x-www-form-urlencoded' },
put: { 'Content-Type': 'application/x-www-form-urlencoded' },
patch: { 'Content-Type': 'application/x-www-form-urlencoded' },
'X-Kite-Version': 3,
'User-Agent': 'kiteconnectjs/5.0.1',
Authorization: '',
'Content-Type': 'application/x-www-form-urlencoded'
},
params: {},
baseURL: '
https://api.kite.trade'
,
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
paramsSerializer: [Function: paramsSerializer],
timeout: 7000,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
}
}
{
status: 200,
statusText: 'OK',
headers: {
date: 'Mon, 07 Jul 2025 11:05:58 GMT',
'content-type': 'application/json;charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'keep-alive',
'x-frame-options': 'DENY',
'x-xss-protection': '1; mode=block',
vary: 'Accept-Encoding',
'access-control-allow-origin': '*',
'cf-cache-status': 'DYNAMIC',
'strict-transport-security': 'max-age=15552000; includeSubDomains',
'set-cookie': [
'_cfuvid= path=/; domain=.kite.trade; HttpOnly; Secure; SameSite=None'
],
server: 'cloudflare',
'cf-ray': '',
'alt-svc': 'h3=":443"; ma=86400'
},
config: {
url: '/mf/holdings',
method: 'get',
data: null,
headers: {
Accept: 'application/json, text/plain, */*',
'X-Kite-Version': 3,
'User-Agent': 'kiteconnectjs/5.0.1',
Authorization: '',
'Content-Type': 'application/x-www-form-urlencoded'
},
params: {},
baseURL: '
https://api.kite.trade'
,
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
paramsSerializer: [Function: paramsSerializer],
timeout: 7000,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
}
},
request: ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
finish: [Function: requestOnFinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: true,
_header: 'GET /mf/holdings HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'X-Kite-Version: 3\r\n' +
'User-Agent: kiteconnectjs/5.0.1\r\n' +
'Authorization:
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype],
keepAliveMsecs: 1000,
keepAlive: true,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/mf/holdings',
_ended: true,
res: IncomingMessage {
_events: [Object],
_readableState: [ReadableState],
_maxListeners: undefined,
socket: null,
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
joinDuplicateHeaders: undefined,
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [TLSSocket],
_consuming: true,
_dumped: false,
req: [Circular *1],
_eventsCount: 3,
responseUrl: '
https://api.kite.trade/mf/holdings'
,
redirects: [],
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 28,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api.kite.trade',
protocol: 'https:',
_redirectable: Writable {
_events: [Object],
_writableState: [WritableState],
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_eventsCount: 3,
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular *1],
_currentUrl: '
https://api.kite.trade/mf/holdings'
,
_timeout: null,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false
},
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kChunkedBuffer)]: [],
[Symbol(kChunkedLength)]: 0,
[Symbol(kSocket)]: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'api.kite.trade',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api.kite.trade',
_closeAfterHandlingError: false,
_readableState: [ReadableState],
_writableState: [WritableState],
allowHalfOpen: false,
_maxListeners: undefined,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
timeout: 5000,
parser: null,
_httpMessage: null,
autoSelectFamilyAttemptedAddresses: [Array],
[Symbol(alpncallback)]: null,
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: -1,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 5000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 100321,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 88,
[Symbol(triggerId)]: 86,
[Symbol(kAsyncContextFrame)]: undefined
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: true,
[Symbol(kSetKeepAliveInitialDelay)]: 1,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'x-kite-version': [Array],
'user-agent': [Array],
authorization: [Array],
'content-type': [Array],
host: [Array]
},
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 65536,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null
},
data: {
status: 'success',
data: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object]
]
}
}
Sign In
or
Register
to comment.
You can enable debug logs as mentioned here.
PS: Make sure to remove app and client-specific tokens while pasting here.
{
"error_type": "DataException",
"message": "Unknown content type (application/json;charset=utf-8) with response: ([object Object])"
}
I am not able to see any error on terminal while hitting this API.
CAN YOU CHECK ON YOUR END, THIS API WORK FOR YOU OR NOT?
{
url: '/mf/holdings',
method: 'get',
data: null,
headers: {
common: { Accept: 'application/json, text/plain, */*' },
delete: {},
get: {},
head: {},
post: { 'Content-Type': 'application/x-www-form-urlencoded' },
put: { 'Content-Type': 'application/x-www-form-urlencoded' },
patch: { 'Content-Type': 'application/x-www-form-urlencoded' },
'X-Kite-Version': 3,
'User-Agent': 'kiteconnectjs/5.0.1',
Authorization: '',
'Content-Type': 'application/x-www-form-urlencoded'
},
params: {},
baseURL: 'https://api.kite.trade',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
paramsSerializer: [Function: paramsSerializer],
timeout: 7000,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
}
}
{
status: 200,
statusText: 'OK',
headers: {
date: 'Mon, 07 Jul 2025 11:05:58 GMT',
'content-type': 'application/json;charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'keep-alive',
'x-frame-options': 'DENY',
'x-xss-protection': '1; mode=block',
vary: 'Accept-Encoding',
'access-control-allow-origin': '*',
'cf-cache-status': 'DYNAMIC',
'strict-transport-security': 'max-age=15552000; includeSubDomains',
'set-cookie': [
'_cfuvid= path=/; domain=.kite.trade; HttpOnly; Secure; SameSite=None'
],
server: 'cloudflare',
'cf-ray': '',
'alt-svc': 'h3=":443"; ma=86400'
},
config: {
url: '/mf/holdings',
method: 'get',
data: null,
headers: {
Accept: 'application/json, text/plain, */*',
'X-Kite-Version': 3,
'User-Agent': 'kiteconnectjs/5.0.1',
Authorization: '',
'Content-Type': 'application/x-www-form-urlencoded'
},
params: {},
baseURL: 'https://api.kite.trade',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
paramsSerializer: [Function: paramsSerializer],
timeout: 7000,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
}
},
request: ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
finish: [Function: requestOnFinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: true,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: true,
_header: 'GET /mf/holdings HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'X-Kite-Version: 3\r\n' +
'User-Agent: kiteconnectjs/5.0.1\r\n' +
'Authorization:
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype] {},
freeSockets: [Object: null prototype],
keepAliveMsecs: 1000,
keepAlive: true,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: '/mf/holdings',
_ended: true,
res: IncomingMessage {
_events: [Object],
_readableState: [ReadableState],
_maxListeners: undefined,
socket: null,
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
joinDuplicateHeaders: undefined,
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [TLSSocket],
_consuming: true,
_dumped: false,
req: [Circular *1],
_eventsCount: 3,
responseUrl: 'https://api.kite.trade/mf/holdings',
redirects: [],
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 28,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api.kite.trade',
protocol: 'https:',
_redirectable: Writable {
_events: [Object],
_writableState: [WritableState],
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_eventsCount: 3,
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular *1],
_currentUrl: 'https://api.kite.trade/mf/holdings',
_timeout: null,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false
},
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kChunkedBuffer)]: [],
[Symbol(kChunkedLength)]: 0,
[Symbol(kSocket)]: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'api.kite.trade',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 9,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api.kite.trade',
_closeAfterHandlingError: false,
_readableState: [ReadableState],
_writableState: [WritableState],
allowHalfOpen: false,
_maxListeners: undefined,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
timeout: 5000,
parser: null,
_httpMessage: null,
autoSelectFamilyAttemptedAddresses: [Array],
[Symbol(alpncallback)]: null,
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: -1,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 5000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 100321,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 88,
[Symbol(triggerId)]: 86,
[Symbol(kAsyncContextFrame)]: undefined
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: true,
[Symbol(kSetKeepAliveInitialDelay)]: 1,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'x-kite-version': [Array],
'user-agent': [Array],
authorization: [Array],
'content-type': [Array],
host: [Array]
},
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 65536,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null
},
data: {
status: 'success',
data: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object]
]
}
}