On this page

We will call User Details. It is the right first call for three reasons: it changes nothing, it needs only your user ID, and its answer tells you what the rest of your integration is allowed to do.

This call is completely safe

It reads. It places no orders, moves no money and alters no state. You can run it as often as you like - within the rate limit.

What you need

  • An access token from authentication.
  • Your user ID - the ID you log into trade.infinn.in with.
  • To be running on the machine whose IP you registered.

The request, part by part

The complete request
POST /NorenWClientAPI/UserDetails HTTP/1.1
Host: api.infinn.in
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: text/plain

jData={"uid":"IN001"}

Five lines, and every one matters.

LineWhat it isWhy it must be exactly this
POST /NorenWClientAPI/UserDetailsMethod and pathEvery Infinn endpoint is POST, including the ones that only read. A GET returns 405.
Host: api.infinn.inThe serverThe only host. HTTPS only. Your HTTP client adds this for you.
Authorization: Bearer …Who you areThe word Bearer, one space, then the token. Missing or wrong gives an empty 401.
Content-Type: text/plainThe body formatNot application/json. Not x-www-form-urlencoded. Getting this wrong gives a 400 with no explanation.
jData={"uid":"…"}What you are askingOne form field named jData, whose value is a JSON string. Not a JSON document.
The Content-Type is text/plain

Not application/json, even though the body contains JSON. Not application/x-www-form-urlencoded, even though the body looks like a form field.

This is unusual - most APIs would use one of those - and getting it wrong produces a 400 that gives no hint as to why. Why it is this way

Run it

Pick a language. Each of these is complete: paste it, replace the two placeholder values, run it.

cURL
# Replace both placeholders, then run.
curl --request POST \
--url 'https://api.infinn.in/NorenWClientAPI/UserDetails' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: text/plain' \
--data 'jData={"uid":"IN001"}'

# Add -i to see the status code and headers as well as the body:
#   curl -i --request POST ...

The response, part by part

A successful call looks like this.

200 OK
{
"request_time": "20:20:04 19-05-2020",
"stat": "Ok",
"exarr": ["NSE", "NFO"],
"orarr": ["MKT", "LMT", "SL-LMT", "SL-MKT", "DS", "2L", "3L", "4L"],
"prarr": [
  { "prd": "C", "s_prdt_ali": "Delivery",      "exch": ["NSE", "BSE"] },
  { "prd": "I", "s_prdt_ali": "Intraday",      "exch": ["NSE", "BSE", "NFO"] },
  { "prd": "H", "s_prdt_ali": "High Leverage", "exch": ["NSE", "BSE", "NFO"] },
  { "prd": "B", "s_prdt_ali": "Bracket Order", "exch": ["NSE", "BSE", "NFO"] }
],
"brkname": "VIDYA",
"brnchid": "VIDDU",
"email": "[email protected]",
"actid": "IN001",
"uprev": "INVESTOR"
}
FieldWhat it tells you
statCheck this first. Ok means the request succeeded. The HTTP status alone does not tell you this - see the two error layers.
exarrExchanges this account may trade. Use it to populate your exchange dropdown.
orarrOrder types enabled. Note that the sample includes 4L, which is not in the documented prctyp list - trust this array.
prarrProducts enabled, each with the exchanges it is allowed on. Show s_prdt_ali to the user; send prd.
actidYour account ID. Send it as actid on the endpoints that want one.
uprevAlways INVESTOR. The documentation notes that no other user type may log in through this API.
request_timeWhen Infinn processed the request, as HH:MM:SS dd-mm-yyyy in IST.
Keep this response — do not throw it away

Those three arrays are the correct source for your order form. exarr populates the exchange dropdown, orarr the order types, and prarr the products - showing s_prdt_ali to the user and sending prd.

Hard-coding them instead produces rejections on accounts with different entitlements, and those look exactly like bugs in your own code.

If it did not work

Work down this list in order. It is ordered by how often each cause is the real one.

What you sawMost likely causeWhat to do
401, empty bodyThis machine's public IP is not the registered one. This is the most common cause, and almost nobody checks it first.Run curl -s https://api.ipify.org and compare with Primary IP Address on your profile. Update it
401, and the IP is correctA malformed or expired token.Check the header is Bearer <token> exactly. Confirm you are sending the 64-character access token, not the 36-character login code. Then get a fresh token.
400The content type, or malformed JSON.Send Content-Type: text/plain, and serialise with a JSON library rather than building the string by hand.
404A typo in the path. These are case-sensitive.Copy it from the endpoint page. UserDetails, not userdetails.
405You used GET.Use POST. All 58 endpoints are POST.
200 with stat: "Not_Ok"The request arrived and was declined. Read emsg.Look the message up in the error reference.
A JSON decode error in your own codeYou parsed before checking the status. A 401 has an empty body, so there is nothing to parse.Check response.status_code before calling .json().
Connection timed outNetwork, or a firewall blocking outbound HTTPS.Test with curl -sI https://api.infinn.in from the same machine.

Anything not covered here is in the error reference, or run through the debugging checklist.

Next

Esc
↑↓ navigate↵ openEsc close/ to search