Dhan API Issue – Infinite Redirect Loop (Exceeded 30 Redirects)

Hi everyone,

I’m facing a strange issue with the Dhan API and wanted to check if anyone else is experiencing this or has a fix.

:cross_mark: Error

Exceeded 30 redirects

Happening across multiple endpoints:

  • get_fund_limits

  • intraday_minute_data

  • get_positions

  • get_trade_book


:magnifying_glass_tilted_left: What I Debugged

I tested this outside my app (pure Python requests) and here’s what I found:

  • Calling:
https://api.dhan.co/v2/fundlimit

:backhand_index_pointing_right: Returns:


301 Moved Permanently
Location: https://api.dhan.co:443/v2/
  • Then calling:
https://api.dhan.co:443/v2/

:backhand_index_pointing_right: Again returns:


301 → https://api.dhan.co:443/v2/

:right_arrow: This creates an infinite redirect loop, so any HTTP client eventually fails with:

Exceeded 30 redirects

:paperclip: Debug output:


:warning: Key Observations

  • Happens even without using dhanhq SDK

  • Happens regardless of token / headers

  • Response headers show:

    • server: awselb/2.0

    • via: CloudFront

:backhand_index_pointing_right: So this looks like a CloudFront / ELB routing issue, not an application bug.


:test_tube: What I Tried

  • Disabled redirects → confirmed loop

  • Tried multiple endpoints → same behavior

  • Tested POST/GET → same result

  • Removed headers/token → same result

  • DNS resolves to CloudFront → confirms edge routing


:thinking: Questions

  1. Is anyone else facing this right now?

  2. Is this region-specific (India / ISP issue)?

  3. Any known alternate base URL for Dhan API?

  4. Any workaround (VPN / different DNS / headers)?

Just an update since last hour it was not working and surprisingly it started working automatically. I presume it was temparary issue on dhan api side, which now got solved and my app started working. Still it would be helpful if someone can share some information to find root cause.