On this page
Login fails? Check your IP first

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.

Read this first if you have not

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

Or just search

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.

CodeWhat it means
400Missing or wrong request fields or values.
403Session expired or no longer valid. Log in again.
404The requested resource was not found.
405That HTTP method is not allowed on this endpoint (use POST).
410The resource has been removed permanently.
429Too many requests: you hit the rate limit.
500Something unexpected went wrong on the server.
502The order system behind the API is down, so the API cannot reach it.
503The API is down or unavailable.
504Gateway 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.

CodeMeaningBody
401The gateway rejected your credentials before the request reached the trading system.empty body
400Missing or bad request parameters or values.
403Session expired or invalidated. Must relogin.
404The requested resource was not found.empty body
405The request method is not allowed on this endpoint.
410The requested resource is gone permanently.
429Too many requests to the API (rate limiting).
500Something unexpected went wrong.
502The backend OMS is down and the API is unable to communicate with it.
503Service unavailable; the API is down.
504Gateway timeout; the API is unreachable.
400Bad Request

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 jData does not parse - a trailing comma, a single quote where a double quote belongs, or an unescaped character.
  • Content-Type is not text/plain.

How to fix it

  1. Serialise the JSON with your language's JSON library rather than building the string by hand, then prefix it with jData=.
  2. Send Content-Type: text/plain. Not application/json, and not application/x-www-form-urlencoded - see how requests are shaped.
  3. URL-encode trading symbols containing special characters, such as M&M.
403Forbidden

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

  1. Check the call came from your whitelisted static IP (compare api.ipify.org with the IP in the API key panel). Static IP whitelisting is mandatory.
  2. Discard the stored token - do not retry with it.
  3. Send the user through the login flow again to obtain a fresh code, then exchange it with GenAcsTok.
  4. Treat 401 and 403 the same way in your retry logic: both mean stop and re-authenticate, never back off and retry.
404Not Foundconfirmed behaviour

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/OrderBook works, /NorenWClientAPI/orderbook does not.

How to fix it

  1. Copy the path from the endpoint's reference page rather than typing it.
  2. Check the two exceptions above.
405Method Not Allowed

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.

410Gone

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 [email protected] for the replacement. Do not retry: unlike a 5xx, this will not start working again.

429Too Many Requests

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

  1. Replace polling with the WebSocket feed. This is the real fix, and it removes the problem rather than slowing it down.
  2. Back off exponentially when you do get a 429, with jitter so that parallel workers do not retry in lockstep.
  3. Put one rate limiter in front of all your API calls, in a place every process shares.
  4. See rate limits for the budget arithmetic.
500Internal Server Error

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.

502Bad Gateway

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.

503Service Unavailable

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.

504Gateway Timeout

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.

Your HTTP client will call every one of these a success

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 expired

What 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

  1. Re-run the login flow.
  2. Build this into your client as a single check: on any emsg starting Session Expired, clear the stored token and re-authenticate once, rather than retrying the call.
What it looks like
{
  "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 rejected

What 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

  1. Verify the concatenation order with a known triple. Worked example (dummy values): app key IN001_U, secret demo-secret-0000, code 7a1c0e52-90b4-4f3d-a6e8-5d2c4b1f0a93 gives the string IN001_Udemo-secret-00007a1c0e52-90b4-4f3d-a6e8-5d2c4b1f0a93.
  2. Log in again for a fresh code - the old one is spent whether or not the call succeeded.
  3. Output the digest as lower-case hex.
What it looks like
{
  "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 omitted

What 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, not actId or ActID.
  • You nested jData inside itself. The body is jData={"uid":"..."}, not jData={"jData":{...}}.

How to fix it

  1. Read the names out of the error message - it tells you exactly which fields are missing.
  2. Compare against the parameter table on that endpoint's page; required fields carry a red required badge.
  3. Drop optional fields entirely rather than sending them empty. amo is the clearest example: omit it, or send "Yes", but never send it blank.
What it looks like
{
  "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 rejection

What 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

  1. Check prc against the instrument's tick size (TickSize in the symbol master, or ti in a quote).
  2. Check qty against LotSize for derivatives.
  3. Check exch, prd and prctyp against exarr, prarr and orarr from User Details.
  4. Call Order Margin with the same values - it often returns a more specific remarks than PlaceOrder's emsg.
What it looks like
{
  "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 return

What 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

  1. Treat this as "empty", not "broken". Show an empty state, not an error dialog.
  2. If you did expect data, check that exch and token actually identify the instrument you had in mind - a token from the wrong exchange returns no data rather than an error.
What it looks like
{
  "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 nothing

What 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

  1. Try a shorter search string.
  2. Drop the exch filter to search all enabled exchanges.
  3. Show "no results" in your UI rather than an error.
What it looks like
{
  "stat": "Not_Ok",
  "emsg": "No Data : "
}

Seen on: Search Scrips

Rejected : ORA:Order not foundThe order cannot be modified

What happened

The order management system could not find a modifiable order with that number.

Why it happens

  • The norenordno is wrong, or belongs to another account.
  • The order is no longer in a modifiable state. Only OPEN and TRIGGER_PENDING orders can be changed - one that has filled, been cancelled or been rejected cannot.
  • It is from a previous trading day.

How to fix it

  1. Read the order's current status with Single Order Status.
  2. If it has filled, you cannot modify it - place a new order instead.
  3. 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.
What it looks like
{
  "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 cancelled

What 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

  1. Check the status first with Single Order Status.
  2. For a cover or bracket order, use Exit Cover / Bracket Order instead - plain CancelOrder cannot unwind the linked legs.
  3. In a cancel-all routine, log this and carry on rather than aborting the loop.
What it looks like
{
  "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 answer

What 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.

What it looks like
{
  "stat": "Not_Ok",
  "emsg": "Server Timeout : "
}

Seen on: Logout, Limits

Invalid Input : Invalid Position TypeBad postype, or a mismatched report request

What happened

A position or report request carried a value the system did not accept.

Why it happens

  • On Product Conversion: postype must be Day or CF.
  • 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

  1. Send postype as exactly Day or CF.
  2. On the reports, check from_date and to_date are dd-mm-yyyy and that brkname matches the value from User Details.
What it looks like
{
  "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 value

What 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 jData from 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 margin

What 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

  1. Call Order Margin before placing. When it returns remarks: "Insufficient Balance", marginused is the shortfall - the extra amount required.
  2. Check available margin with Limits: total credits minus marginused.
  3. 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 rule

What 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

  1. Show this string to the user verbatim. It already contains the diagnosis; replacing it with "order failed" throws away the only useful information.
  2. Read the circuit limits from uc and lc in a quote and validate the price in your own UI first.
What it looks like
"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 behaviour

What 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 accesstoken is wrong, expired or invalidated.
  • source does 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

  1. 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.
  2. Compare s case-insensitively. The documentation says Not_Ok; the live feed sends NOT_OK.
  3. Do not treat socket-open as authenticated. Wait for ak with a success value before subscribing.
What it looks like
{"t":"ak","s":"NOT_OK"}

... followed by close frame 1008 PolicyViolation

Seen on: wss://api.infinn.in/NorenWSTP/

Silent feedConnected, authenticated, but no data arrives

What happened

The handshake succeeded, ak reported success, and nothing follows.

Why it happens

  • You subscribed before ak arrived, so the subscription was dropped.
  • The k string is malformed. The format is exchange|token joined 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_update flag may not be enabled on your account.

How to fix it

  1. Count your acknowledgements: you should receive one tk / dk / lk per token you subscribed to. Fewer means some were dropped.
  2. Send a {"t":"h"} heartbeat. If no hk comes back, the connection is dead - reconnect and resubscribe.
  3. Subscribe to one known-good instrument first: NSE|2885 is 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
Modifying or cancelling
Reading positions, holdings or quotes
Anything, intermittently

Errors this documentation cannot list

The published catalogue is incomplete

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 by category, display the detail
"""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

Next

Esc
↑↓ navigate↵ openEsc close/ to search