Skip to content

Authentication

Send your access token in the Authorization header of every request:

Text Only
Authorization: YOUR_ACCESS_TOKEN

One access token for Indian and Global stocks

Your access token works for Indian Stocks APIs and Global Stocks APIs.

A new token replaces the previous one

When you generate a token, the previous token stops working for both Indian and Global stocks. If you run Indian and Global stocks strategies at the same time, generate one token a day and use it in both.

Getting your access token

There are two ways to get an access token. Both give you the same token.

Method 1: Generate it on the website

  1. Log in to indmoney.com.
  2. Go to Access Tokens and generate your access token.

Method 2: Generate it from code with TOTP

For scripts and servers, you can generate a token with a TOTP (time-based one-time password) instead of visiting the website each day.

Setup (one time)

  1. On the Access Tokens page, click Setup TOTP and link an authenticator app.
  2. When setup is complete, the page shows your Client ID. You send it as x-api-key when you generate a token.

The Indian Stocks authentication guide covers the setup steps in detail.

Generate a token

POST https://api.indmoney.com/generate/token

Header Required Value
x-api-key Yes Your Client ID
Content-Type Yes application/json
Body field Type Required Value
mpin string Yes Your account MPIN
totp string Yes The current 6-digit code from your authenticator app
Bash
curl --location 'https://api.indmoney.com/generate/token' \
  --header 'x-api-key: YOUR_CLIENT_ID' \
  --header 'Content-Type: application/json' \
  --data '{"mpin": "YOUR_MPIN", "totp": "123456"}'

The response returns the access token in a field named token. Send that value in the Authorization header of every request.

Limits on wrong codes, lockouts and how often you can generate a token are the same as for Indian stocks. See TOTP limits and lockouts.

Token lifetime

  • A token expires at 07:00 IST the next day, whatever time it was created.
  • Disabling or resetting TOTP revokes the current token.
  • Your INDmoney app or website login can't be used as an API token.

Authentication errors

HTTP Code Where Meaning
401 api_authentication_failed Orders, portfolio, wallet, profile Token missing, expired, replaced or revoked
403 TokenException Market data (/v1/market/*) Token missing, expired, replaced or revoked

Generate a new token and try again. If your token stops working during the day, check whether another script is generating tokens.