Dhan API Response vs Documentation

Hi team,

I am working on building a wrapper over Dhan APIs in Java.
I have noticed that, some attributes like legName and drvOptionType contains “NA” in the request response, could you please provide guidance here, is this an expected enum values for these fields because is it contrary to the documentation.

drvExpiryDate is mentioned as integer in the documentation.

[{"dhanClientId":"XXX","orderId":"XXX","exchangeOrderId":"XXX","correlationId":"NA","orderStatus":"TRADED","transactionType":"BUY","exchangeSegment":"NSE_EQ","productType":"CNC","orderType":"MARKET","validity":"DAY","tradingSymbol":"GROWWLIQID","securityId":"25447","quantity":1775,"disclosedQuantity":0,"price":106.49,"triggerPrice":0.0,"afterMarketOrder":false,"boProfitValue":0.0,"boStopLossValue":0.0,"legName":"NA","createTime":"2025-11-06 12:14:03","updateTime":"2025-11-06 12:14:03","exchangeTime":"2025-11-06 12:14:03","drvExpiryDate":"0001-01-01","drvOptionType":"NA","drvStrikePrice":0.0,"omsErrorCode":"0","omsErrorDescription":"TRADE CONFIRMED","algoId":"0","remainingQuantity":0,"averageTradedPrice":106.49,"filledQty":1775},{"dhanClientId":"XXX","orderId":"XXX","exchangeOrderId":"XXX","correlationId":"7EME6G9J","orderStatus":"TRADED","transactionType":"BUY","exchangeSegment":"NSE_EQ","productType":"CNC","orderType":"MARKET","validity":"IOC","tradingSymbol":"GOLDCASE","securityId":"22901","quantity":452,"disclosedQuantity":0,"price":18.9,"triggerPrice":0.0,"afterMarketOrder":false,"boProfitValue":0.0,"boStopLossValue":0.0,"legName":"NA","createTime":"2025-11-06 09:25:04","updateTime":"2025-11-06 09:25:04","exchangeTime":"2025-11-06 09:25:04","drvExpiryDate":"0001-01-01","drvOptionType":"NA","drvStrikePrice":0.0,"omsErrorCode":"0","omsErrorDescription":"TRADE CONFIRMED","algoId":"0","remainingQuantity":0,"averageTradedPrice":18.9,"filledQty":452},{"dhanClientId":"XXX","orderId":"XXX","exchangeOrderId":"XXX","correlationId":"llHDCu1r","orderStatus":"TRADED","transactionType":"BUY","exchangeSegment":"NSE_EQ","productType":"CNC","orderType":"MARKET","validity":"IOC","tradingSymbol":"MID150CASE","securityId":"24077","quantity":547,"disclosedQuantity":0,"price":11.03,"triggerPrice":0.0,"afterMarketOrder":false,"boProfitValue":0.0,"boStopLossValue":0.0,"legName":"NA","createTime":"2025-11-06 09:25:04","updateTime":"2025-11-06 09:25:04","exchangeTime":"2025-11-06 09:25:04","drvExpiryDate":"0001-01-01","drvOptionType":"NA","drvStrikePrice":0.0,"omsErrorCode":"0","omsErrorDescription":"TRADE CONFIRMED","algoId":"0","remainingQuantity":0,"averageTradedPrice":11.03,"filledQty":547},{"dhanClientId":"XXX","orderId":"XXX","exchangeOrderId":"XXX","correlationId":"gddw6IfT","orderStatus":"TRADED","transactionType":"BUY","exchangeSegment":"NSE_EQ","productType":"CNC","orderType":"MARKET","validity":"IOC","tradingSymbol":"TOP100CASE","securityId":"24081","quantity":720,"disclosedQuantity":0,"price":11.0,"triggerPrice":0.0,"afterMarketOrder":false,"boProfitValue":0.0,"boStopLossValue":0.0,"legName":"NA","createTime":"2025-11-06 09:25:04","updateTime":"2025-11-06 09:25:04","exchangeTime":"2025-11-06 09:25:04","drvExpiryDate":"0001-01-01","drvOptionType":"NA","drvStrikePrice":0.0,"omsErrorCode":"0","omsErrorDescription":"TRADE CONFIRMED","algoId":"0","remainingQuantity":0,"averageTradedPrice":11.0,"filledQty":720}]

Summarising my asks,

  1. What is the recommended approach to deal with ‘NA’ value, should this be considered as a new enum value for legName and drvOptionType ?
  2. Documentation should reflect the appropriate state of drvExpireyTime, instead of Integer in the documentation, it should be a String.

Please let me know if the is not the right approach to ask question, I would be glad to reach out via the suggested method.

I am calling Order Book API via my Java HTTP Wrapper.

Point 1: LegName and DrvOptionType is only applicable for Options. Keep a default option NA in the enum for both.
Point 2: The existing API returns a string in YYYY-MM-DD format for drvExpiryDate, which is wrong as well. Seems it will be corrected for an Options entry.

Well the best option is try out the curl or via Postman and then write the wrapper around it. Given how inconsistent the Dhan Apis are, I do not use direct JSON deserialization so I know which parameter has changed and to what. FYI I use order book only for EOD analysis.

I was not aware that APIs were inconsistent.

Hey @Himanshu_Rawat @nitishbangera

Will get this changed. On a note, this field is only present in the case of F&O but security ID can be used as a reference always.

@Hardik A suggestion, next time when your team makes an api just make all the date or time variables as long. Anyone can convert into any format they wish to.

Noted @nitishbangera

Will evaluate using long format and compatibility.

I have noticed that sandbox has better details about the API. Unable to add link in the comment.