On this page
If GenAcsTok returns stat: "Not_Ok", the most common cause is that the computer you are using is not on the whitelist. Open api.ipify.org on that computer and make sure the number shown is the Primary IP in trade.infinn.in → top-right profile icon → Generate Key (API Key panel). Only then check the API key, secret and code.
Every error the Infinn API produces, at both layers, each with what happened, why, and what to do about it.
This API fails in two independent places and the two look nothing alike. The two error layers explains the structure in five minutes and makes everything below make sense.
Find your error
stat of Not_Ok and an emsg. The
trading system received your request and declined it.The WebSocket will not workConnected but refused, or connected and silent.Press Ctrl K and paste the error text. Error codes and emsg strings are both in the search index.
Layer 1 - transport errors
These are the HTTP error codes the INFINN API returns. The cards below add a plain-language fix for each.
| Code | What it means |
|---|---|
| 400 | Missing or wrong request fields or values. |
| 403 | Session expired or no longer valid. Log in again. |
| 404 | The requested resource was not found. |
| 405 | That HTTP method is not allowed on this endpoint (use POST). |
| 410 | The resource has been removed permanently. |
| 429 | Too many requests: you hit the rate limit. |
| 500 | Something unexpected went wrong on the server. |
| 502 | The order system behind the API is down, so the API cannot reach it. |
| 503 | The API is down or unavailable. |
| 504 | Gateway timeout: the API did not respond in time. |
These arrive as an HTTP status code. In practice: the body is empty - there is no JSON and no emsg to read. Check the status code before attempting to parse anything.
| Code | Meaning | Body |
|---|---|---|
401 | The gateway rejected your credentials before the request reached the trading system. | empty body |
400 | Missing or bad request parameters or values. | |
403 | Session expired or invalidated. Must relogin. | |
404 | The requested resource was not found. | empty body |
405 | The request method is not allowed on this endpoint. | |
410 | The requested resource is gone permanently. | |
429 | Too many requests to the API (rate limiting). | |
500 | Something unexpected went wrong. | |
502 | The backend OMS is down and the API is unable to communicate with it. | |
503 | Service unavailable; the API is down. | |
504 | Gateway timeout; the API is unreachable. |
What happened
The request was malformed badly enough that it was rejected before it could be interpreted.
Why it happens
- The body is not in the form
jData={...}. - The JSON inside
jDatadoes not parse - a trailing comma, a single quote where a double quote belongs, or an unescaped character. Content-Typeis nottext/plain.
How to fix it
- Serialise the JSON with your language's JSON library rather than building the string by hand, then prefix it with
jData=. - Send
Content-Type: text/plain. Notapplication/json, and notapplication/x-www-form-urlencoded- see how requests are shaped. - URL-encode trading symbols containing special characters, such as
M&M.
What happened
The session is no longer valid, as distinct from never having been valid.
Why it happens
- The session expired naturally.
- The user logged out, or logged in from another client, which invalidated this session.
How to fix it
- Check the call came from your whitelisted static IP (compare
api.ipify.orgwith the IP in the API key panel). Static IP whitelisting is mandatory. - Discard the stored token - do not retry with it.
- Send the user through the login flow again to obtain a fresh code, then exchange it with GenAcsTok.
- Treat 401 and 403 the same way in your retry logic: both mean stop and re-authenticate, never back off and retry.
What happened
The path does not exist on the server. Note: the body is empty.
Why it happens
- A typo in the endpoint name. These paths are case-sensitive:
/NorenWClientAPI/OrderBookworks,/NorenWClientAPI/orderbookdoes not.
How to fix it
- Copy the path from the endpoint's reference page rather than typing it.
- Check the two exceptions above.
What happened
You used the wrong HTTP verb.
Why it happens
Every endpoint in the Infinn API is POST, including the ones that only read data. A GET to /NorenWClientAPI/OrderBook is a 405.
How to fix it
Use POST everywhere. There are no exceptions across the whole API.
What happened
The endpoint existed once and has been withdrawn.
Why it happens
An endpoint you are calling has been retired.
How to fix it
Check the endpoint against this reference, and contact INFINN support at support@infinn.in for the replacement. Do not retry: unlike a 5xx, this will not start working again.
What happened
You exceeded the published rate limit of 20 orders per second and 200 orders per minute.
Why it happens
- Polling a snapshot endpoint in a loop. Positions Book and Get Quotes are the usual culprits.
- Fetching quotes per instrument for a long watchlist.
- Several processes sharing one token without a shared limiter - the limit applies to the account, not the process.
How to fix it
- Replace polling with the WebSocket feed. This is the real fix, and it removes the problem rather than slowing it down.
- Back off exponentially when you do get a 429, with jitter so that parallel workers do not retry in lockstep.
- Put one rate limiter in front of all your API calls, in a place every process shares.
- See rate limits for the budget arithmetic.
What happened
A fault inside the API itself.
Why it happens
Not caused by your request. The documentation gives no further detail.
How to fix it
Retry with exponential backoff. If the call was a write - placing, modifying or cancelling an order - do not blindly retry: read the order book first to find out whether it actually took effect. See retrying safely.
What happened
The API is up, but the order management system behind it is not reachable.
Why it happens
The OMS is down or restarting. This is common outside market hours and during scheduled maintenance.
How to fix it
Retry with backoff. Check whether the market is open before assuming a fault - and apply the same caution as for 500 on any write that may have half-completed.
What happened
The API itself is unavailable.
Why it happens
Maintenance or an outage.
How to fix it
Retry with backoff. Surface a clear status to your users rather than letting requests hang.
What happened
The request was accepted but no response arrived in time.
Why it happens
The upstream system did not answer quickly enough.
How to fix it
Treat the outcome as unknown. A timeout is not a failure - the order may well have been placed. Reconcile against the order book before retrying anything that sends an order.
Layer 2 - application errors
These arrive with HTTP 200. The status code says the message got through; stat: "Not_Ok" and emsg say what the trading system thought of it.
Nothing at the transport level distinguishes these from a successful call. If your code branches only on the status code, every error below is invisible to it.
Session Expired : Invalid Session KeySession expiredWhat happened
The call reached the trading system, which did not recognise your session. Note that this arrives as HTTP 200 with stat: "Not_Ok" - your HTTP client will report success.
Why it happens
The token expired, was invalidated by a logout, or was superseded by a login elsewhere. It is the application-layer equivalent of a 403.
How to fix it
- Re-run the login flow.
- Build this into your client as a single check: on any
emsgstartingSession Expired, clear the stored token and re-authenticate once, rather than retrying the call.
{
"stat": "Not_Ok",
"emsg": "Session Expired : Invalid Session Key"
}Seen on: Almost every endpoint. It is the most frequently shown failure sample in the API specification.
Invalid Input : INVALID_VERIFIERChecksum or code rejectedWhat happened
Token generation failed. The code or the checksum you sent was not accepted.
Why it happens
- The checksum was computed over the wrong string. It must be
SHA-256(app_key + secret_key + code)- in that order, concatenated with nothing in between, no spaces and no separators. - The code was already used. Login codes work exactly once.
- The code expired. Its lifetime is short.
- The hash was uppercased, or sent as raw bytes rather than as lower-case hexadecimal.
- You used your user ID where the app key belongs. The login URL and the checksum both take the app key.
How to fix it
- Verify the concatenation order with a known triple. Worked example (dummy values): app key
IN001_U, secretdemo-secret-0000, code7a1c0e52-90b4-4f3d-a6e8-5d2c4b1f0a93gives the stringIN001_Udemo-secret-00007a1c0e52-90b4-4f3d-a6e8-5d2c4b1f0a93. - Log in again for a fresh code - the old one is spent whether or not the call succeeded.
- Output the digest as lower-case hex.
{
"stat": "Not_Ok",
"emsg": "Invalid Input : INVALID_VERIFIER",
"uid": "TEST"
}Seen on: GenAcsTok
Invalid Input : Missing uid or actid or prd.A required field was omittedWhat happened
One or more required jData fields were absent or empty. The message names them.
Why it happens
- The field was genuinely not sent.
- The field was sent as an empty string. For required fields that is the same as omitting it.
- A typo in the field name. These are case-sensitive:
actid, notactIdorActID. - You nested
jDatainside itself. The body isjData={"uid":"..."}, notjData={"jData":{...}}.
How to fix it
- Read the names out of the error message - it tells you exactly which fields are missing.
- Compare against the parameter table on that endpoint's page; required fields carry a red required badge.
- Drop optional fields entirely rather than sending them empty.
amois the clearest example: omit it, or send"Yes", but never send it blank.
{
"stat": "Not_Ok",
"emsg": "Invalid Input : Missing uid or actid or prd."
}Seen on: Holdings, Get Top List, and any endpoint with required fields
Error Occurred : 2 "invalid input"Generic input rejectionWhat happened
The trading system rejected the payload but gave only a numeric code and a two-word description.
Why it happens
A field is present but its value is unacceptable: a price that is not a multiple of the tick size, a quantity that is not a multiple of the lot size, a product code the account is not entitled to use, or an exchange not in your exarr.
How to fix it
- Check
prcagainst the instrument's tick size (TickSizein the symbol master, ortiin a quote). - Check
qtyagainstLotSizefor derivatives. - Check
exch,prdandprctypagainstexarr,prarrandorarrfrom User Details. - Call Order Margin with the same values - it often returns a more specific
remarksthan PlaceOrder'semsg.
{
"stat": "Not_Ok",
"request_time": "20:40:01 19-05-2020",
"emsg": "Error Occurred : 2 \"invalid input\""
}Seen on: PlaceOrder
Error Occurred : 5 "no data"Nothing to returnWhat happened
The request was valid and understood; there was simply nothing matching it.
Why it happens
An empty positions book, no quote for that token, no holdings for that product. It is reported as a failure, but in most cases it is an ordinary empty result.
How to fix it
- Treat this as "empty", not "broken". Show an empty state, not an error dialog.
- If you did expect data, check that
exchandtokenactually identify the instrument you had in mind - a token from the wrong exchange returns no data rather than an error.
{
"stat": "Not_Ok",
"request_time": "14:14:11 26-05-2020",
"emsg": "Error Occurred : 5 \"no data\""
}Seen on: Positions Book, Interoperable Positions Book, Get Quotes
No Data : Search returned nothingWhat happened
No instrument matched the search text. Note the trailing space and empty detail after the colon - several Infinn error strings end this way.
Why it happens
The search text matches nothing, or it matches nothing on the exch you restricted the search to.
How to fix it
- Try a shorter search string.
- Drop the
exchfilter to search all enabled exchanges. - Show "no results" in your UI rather than an error.
{
"stat": "Not_Ok",
"emsg": "No Data : "
}Seen on: Search Scrips
Rejected : ORA:Order not foundThe order cannot be modifiedWhat happened
The order management system could not find a modifiable order with that number.
Why it happens
- The
norenordnois wrong, or belongs to another account. - The order is no longer in a modifiable state. Only
OPENandTRIGGER_PENDINGorders can be changed - one that has filled, been cancelled or been rejected cannot. - It is from a previous trading day.
How to fix it
- Read the order's current
statuswith Single Order Status. - If it has filled, you cannot modify it - place a new order instead.
- Expect this error as a normal race: an order can fill in the moment between you reading it as OPEN and your modification arriving. Handle it, do not treat it as a bug.
{
"request_time": "16:03:29 28-05-2020",
"stat": "Not_Ok",
"emsg": "Rejected : ORA:Order not found"
}Seen on: Modify Order
Rejected : ORA:Order not found to CancelThe order cannot be cancelledWhat happened
The same condition as above, on the cancel path.
Why it happens
The order has already filled, already been cancelled, or was rejected. There is nothing left to withdraw.
How to fix it
- Check the status first with Single Order Status.
- For a cover or bracket order, use Exit Cover / Bracket Order instead - plain CancelOrder cannot unwind the linked legs.
- In a cancel-all routine, log this and carry on rather than aborting the loop.
{
"request_time": "16:01:48 28-05-2020",
"stat": "Not_Ok",
"emsg": "Rejected : ORA:Order not found to Cancel"
}Seen on: Cancel Order
Server Timeout : The trading system did not answerWhat happened
Infinn received your request but the system behind it did not respond in time. Again, delivered as HTTP 200.
Why it happens
Load or a transient fault in the backend.
How to fix it
Do not assume it failed. For reads, retry. For writes, reconcile first: read the order book and find out what actually happened before sending anything again. A retried order placement can leave you with two positions.
{
"stat": "Not_Ok",
"emsg": "Server Timeout : "
}Seen on: Logout, Limits
Invalid Input : Invalid Position TypeBad postype, or a mismatched report requestWhat happened
A position or report request carried a value the system did not accept.
Why it happens
- On Product Conversion:
postypemust beDayorCF. - On the report endpoints, this same message appears as the documented failure sample even though they take no position type - there it most likely signals a malformed date range or
brkname.
How to fix it
- Send
postypeas exactlyDayorCF. - On the reports, check
from_dateandto_datearedd-mm-yyyyand thatbrknamematches the value from User Details.
{
"stat": "Not_Ok",
"emsg": "Invalid Input : Invalid Position Type"
}Seen on: Product Conversion, Get Order Report, Get Trade Report
Invalid AMOThe amo field was sent with the wrong valueWhat happened
An after-market order was refused because of how the amo field was populated.
Why it happens
The API specification is explicit: the message appears "if the amo field is not sent with a Yes value". Sending amo as an empty string, as "No", as false, or as "yes" in lower case all risk this.
How to fix it
- For an after-market order, send exactly
"amo": "Yes". - For a normal order, omit the field entirely - do not send it blank or set to
"No". - If you build
jDatafrom a struct, make sure the key is dropped rather than serialised as empty when the flag is off.
Seen on: Place Order
Insufficient fundsRejected by the exchange for marginWhat happened
This arrives as rejreason on an order-book row rather than as an emsg: the order was accepted by Infinn, then rejected downstream.
Why it happens
The account did not have enough margin for the order at the moment it was evaluated.
How to fix it
- Call Order Margin before placing. When it returns
remarks: "Insufficient Balance",marginusedis the shortfall - the extra amount required. - Check available margin with Limits: total credits minus
marginused. - For several orders at once, use Basket Margin - a hedged basket needs far less margin together than its legs do separately.
Seen on: Order Book (as rejreason)
RED:RULE:{Check circuit limit including square off order}Rejected by a risk ruleWhat happened
A pre-trade risk rule blocked the order. These arrive in rejreason and are unusually informative - they name the rule, the offending value and the limits.
Why it happens
In the documented example the limit price of ₹2,400.00 sat outside the instrument's circuit band of ₹1,590.05 to ₹1,943.35, so the exchange would not accept it.
How to fix it
- Show this string to the user verbatim. It already contains the diagnosis; replacing it with "order failed" throws away the only useful information.
- Read the circuit limits from
ucandlcin a quote and validate the price in your own UI first.
"rejreason": "RED:RULE:{Check circuit limit including square off order}Current:INR 2,400.00 LowerCircuit:INR 1,590.05 UpperCircuit:INR 1,943.35:NSE.ACC-EQ for C-IN001 [DEFAULT]"Seen on: Single Order Status (as rejreason)
WebSocket errors
{"t":"ak","s":"NOT_OK"}WebSocket authentication refusedconfirmed behaviourWhat happened
The socket opened, you sent the connect task, and the server refused the session - then closed the connection with code 1008 (PolicyViolation).
Why it happens
- The
accesstokenis wrong, expired or invalidated. sourcedoes not match the value used at login.- The connecting IP is not the one registered on your profile - the same IP rule that governs the REST API.
How to fix it
- Make a REST call such as User Details with the same token first. If that returns an HTTP
403, the problem is the token or the IP, not the stream. - Compare
scase-insensitively. The documentation saysNot_Ok; the live feed sendsNOT_OK. - Do not treat socket-open as authenticated. Wait for
akwith a success value before subscribing.
{"t":"ak","s":"NOT_OK"}
... followed by close frame 1008 PolicyViolationSeen on: wss://api.infinn.in/NorenWSTP/
Silent feedConnected, authenticated, but no data arrivesWhat happened
The handshake succeeded, ak reported success, and nothing follows.
Why it happens
- You subscribed before
akarrived, so the subscription was dropped. - The
kstring is malformed. The format isexchange|tokenjoined with#- a pipe between exchange and token, a hash between instruments. - You used a trading symbol where a numeric token belongs.
- The market is closed, so there is genuinely nothing to send.
- You exceeded the feed's undocumented subscription ceiling and the surplus was dropped without an error.
- For position updates specifically, the server-side
-position_updateflag may not be enabled on your account.
How to fix it
- Count your acknowledgements: you should receive one
tk/dk/lkper token you subscribed to. Fewer means some were dropped. - Send a
{"t":"h"}heartbeat. If nohkcomes back, the connection is dead - reconnect and resubscribe. - Subscribe to one known-good instrument first:
NSE|2885is RELIANCE-EQ.
Errors by what you were doing
The same errors, indexed by the task you were attempting when you hit one.
Logging in
Invalid Input : INVALID_VERIFIER- wrong checksum, or a code that has already been used. By far the most common.401- on the very first call after login - usually the IP address, not the token.
Placing an order
Error Occurred : 2 "invalid input"- nearly always a tick-size or lot-size violation.Insufficient funds- arrives asrejreason, notemsg. Check Order Margin first.RED:RULE:{Check circuit limit including square off order}- a risk rule. The message names the rule and the limits; show it verbatim.Invalid AMO-amomust be"Yes"or omitted entirely.
Modifying or cancelling
Rejected : ORA:Order not found- the order is no longer modifiable. Often a lost race, not a bug.Rejected : ORA:Order not found to Cancel- already filled, cancelled or rejected.
Reading positions, holdings or quotes
Error Occurred : 5 "no data"- usually just an empty result. Show an empty state.No Data :- a search matched nothing.429- you are polling. Use the WebSocket feed instead.
Anything, intermittently
Session Expired : Invalid Session Key- re-authenticate; do not retry.Server Timeout :- outcome unknown. Reconcile before retrying any write.504- same as above - a timeout is not a failure.502- the order system is down. Common outside market hours.
Errors this documentation cannot list
Infinn publishes one ten-row table of HTTP codes. Everything in the application-layer section above was gathered from the sample failure responses scattered across individual endpoint pages - which means there are certainly emsg values in production that appear nowhere in the documentation.
So treat emsg as free text. Branch on the part before the colon - Session Expired, Invalid Input, Rejected, Error Occurred, Server Timeout, No Data - and show the rest to the user unaltered rather than trying to match whole strings.
"""Classify an Infinn emsg without needing to know every possible value.
The catalogue is incomplete, so matching whole strings will miss errors
that exist in production. The prefix before the colon is stable and
sufficient for routing; the detail after it is for the user.
"""
CATEGORIES = {
"session expired": "reauthenticate", # clear the token, log in again
"invalid input": "fix_request", # a field is wrong; do not retry
"rejected": "order_state", # order gone or not modifiable
"error occurred": "inspect", # generic; read the detail
"server timeout": "reconcile", # outcome unknown
"no data": "empty", # not an error for the user
}
def classify(emsg):
"""Returns (action, detail) for an emsg string."""
text = str(emsg or "").strip()
head, _, tail = text.partition(":")
action = CATEGORIES.get(head.strip().lower(), "inspect")
return action, tail.strip() or text
# classify('Session Expired : Invalid Session Key')
# -> ('reauthenticate', 'Invalid Session Key')
# classify('Error Occurred : 5 "no data"')
# -> ('inspect', '5 "no data"')
# classify('Some Future Error : whatever')
# -> ('inspect', 'whatever') <- unknown categories degrade safely