{
  "info": {
    "name": "INFINN API v4.3",
    "description": "OAuth-only login. 1) Open in a browser: https://api.infinn.in/OAuthlogin/investor-entry-level/login?api_key=<API_KEY>&route_to=<ROUTE_TO>, where route_to = sha256(USER_ID + \"|\" + SECRET_KEY) (user ID in capitals); the collection pre-request script fills {{route_to}}. 2) Copy ?code= into auth_code. 3) checksum = SHA-256(api_key + secret_key + code). 4) Run Generate access token. Every other call sends Authorization: Bearer {{access_token}}. susertoken is not used for login. WebSocket: wss://api.infinn.in/NorenWSTP/ . Token valid until ~4:00 AM IST daily restart. Rate limit: 20 orders/second and 200/minute. Static IP whitelisting is mandatory.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.infinn.in"
    },
    {
      "key": "uid",
      "value": ""
    },
    {
      "key": "actid",
      "value": ""
    },
    {
      "key": "access_token",
      "value": ""
    },
    {
      "key": "auth_code",
      "value": ""
    },
    {
      "key": "checksum",
      "value": ""
    },
    {
      "key": "order_no",
      "value": ""
    },
    {
      "key": "start_epoch",
      "value": ""
    },
    {
      "key": "end_epoch",
      "value": ""
    },
    {
      "key": "api_key",
      "value": "IN001_U"
    },
    {
      "key": "route_to",
      "value": "",
      "description": "Filled by the pre-request script: sha256(uid.toUpperCase() + \"|\" + secret_key)"
    },
    {
      "key": "secret_key",
      "value": "",
      "description": "Your API secret (Secret Code). Keep it in a local environment; never share or commit it."
    }
  ],
  "item": [
    {
      "name": "Session",
      "item": [
        {
          "name": "OAuth login URL (open in browser)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "https://api.infinn.in/OAuthlogin/investor-entry-level/login?api_key={{api_key}}&route_to={{route_to}}",
              "protocol": "https",
              "host": [
                "api",
                "infinn",
                "in"
              ],
              "path": [
                "OAuthlogin",
                "investor-entry-level",
                "login"
              ],
              "query": [
                {
                  "key": "api_key",
                  "value": "{{api_key}}"
                },
                {
                  "key": "route_to",
                  "value": "{{route_to}}"
                }
              ]
            },
            "description": "Open this URL in a browser and sign in. Copy the code from the redirect URL."
          }
        },
        {
          "name": "Generate access token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"code\": \"{{auth_code}}\", \"checksum\": \"{{checksum}}\", \"uid\": \"{{uid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/GenAcsTok",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "GenAcsTok"
              ]
            }
          }
        },
        {
          "name": "Logout",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/Logout",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "Logout"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Account",
      "item": [
        {
          "name": "User details",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/UserDetails",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "UserDetails"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Account & password",
      "item": [
        {
          "name": "Forgot Password (not a login method)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"pan\": \"ABCDE1234F\", \"dob\": \"01011990\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/ForgotPassword",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "ForgotPassword"
              ]
            }
          }
        },
        {
          "name": "Forgot Password OTP (not a login method)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"pan\": \"ABCDE1234F\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/FgtPwdOTP",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "FgtPwdOTP"
              ]
            }
          }
        },
        {
          "name": "Validate OTP and set password (not a login method)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"otp\": \"000000\", \"pwd\": \"NewDemoPass9\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/ValOTPStPwd",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "ValOTPStPwd"
              ]
            }
          }
        },
        {
          "name": "Change Password (not a login method)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"oldpwd\": \"<sha256 of current password>\", \"pwd\": \"NewDemoPass9\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/Changepwd",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "Changepwd"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Funds",
      "item": [
        {
          "name": "Limits",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"actid\": \"{{actid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/Limits",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "Limits"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Market",
      "item": [
        {
          "name": "Search scrip",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"exch\": \"NSE\", \"stext\": \"RELIANCE\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/SearchScrip",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "SearchScrip"
              ]
            }
          }
        },
        {
          "name": "Get quotes",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"exch\": \"NSE\", \"token\": \"2885\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/GetQuotes",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "GetQuotes"
              ]
            }
          }
        },
        {
          "name": "Time price series",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"exch\": \"NSE\", \"token\": \"2885\", \"st\": \"{{start_epoch}}\", \"et\": \"{{end_epoch}}\", \"intrv\": \"5\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/TPSeries",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "TPSeries"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Orders",
      "item": [
        {
          "name": "Place order (safe test: far limit)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"actid\": \"{{actid}}\", \"exch\": \"NSE\", \"tsym\": \"SBIN-EQ\", \"qty\": \"1\", \"prc\": \"1.00\", \"prd\": \"C\", \"trantype\": \"B\", \"prctyp\": \"LMT\", \"ret\": \"DAY\", \"ordersource\": \"API\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/PlaceOrder",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "PlaceOrder"
              ]
            }
          }
        },
        {
          "name": "Modify order",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"exch\": \"NSE\", \"norenordno\": \"{{order_no}}\", \"tsym\": \"SBIN-EQ\", \"qty\": \"1\", \"prc\": \"1.10\", \"prctyp\": \"LMT\", \"ret\": \"DAY\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/ModifyOrder",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "ModifyOrder"
              ]
            }
          }
        },
        {
          "name": "Cancel order",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"norenordno\": \"{{order_no}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/CancelOrder",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "CancelOrder"
              ]
            }
          }
        },
        {
          "name": "Order book",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/OrderBook",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "OrderBook"
              ]
            }
          }
        },
        {
          "name": "Single order history",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"norenordno\": \"{{order_no}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/SingleOrdHist",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "SingleOrdHist"
              ]
            }
          }
        },
        {
          "name": "Trade book",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"actid\": \"{{actid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/TradeBook",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "TradeBook"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Portfolio",
      "item": [
        {
          "name": "Positions book",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"actid\": \"{{actid}}\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/PositionBook",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "PositionBook"
              ]
            }
          }
        },
        {
          "name": "Holdings",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "text/plain"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{access_token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "jData={\"uid\": \"{{uid}}\", \"actid\": \"{{actid}}\", \"prd\": \"C\"}"
            },
            "url": {
              "raw": "{{base_url}}/NorenWClientAPI/Holdings",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "NorenWClientAPI",
                "Holdings"
              ]
            }
          }
        }
      ]
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// route_to = sha256(USER_ID + '|' + SECRET_KEY), user ID in capitals",
          "const uid = (pm.collectionVariables.get('uid') || '').toUpperCase();",
          "const sec = pm.collectionVariables.get('secret_key') || '';",
          "if (uid && sec) pm.collectionVariables.set('route_to', CryptoJS.SHA256(uid + '|' + sec).toString());"
        ]
      }
    }
  ]
}
