Skip to content
TradeLite
API docsTermsRisk disclosure
Sign in

On this page

  1. Getting started
  2. API keys
  3. Authentication
  4. Place an order
  5. Close orders
  6. List positions
  7. TradingView alerts
  8. Code examples
  9. Errors and limits
  10. Security

TradeLite API

Version 1 · Last updated: 10 October 2026

Trade a TradeLite strategy from your own program, a trading bot or TradingView alerts. Every order goes through the same checks as an order placed in the app: the strategy's rules (max quantity, loss and profit caps, "Stop today"), your risk settings, default stop loss and targets, and live routing to your broker. Orders and positions show up in the app at once.

1. Getting started

  1. Open TradeLite → Strategies, tap a strategy, then press API.
  2. Press Create key and copy the key. It is shown only once.
  3. Send your first order:
curl -X POST https://tradelite.in/api/v1/order \
  -H "X-API-Key: tl_your_key" \
  -H "Content-Type: application/json" \
  -d '{"symbol": "RELIANCE", "side": "buy", "qty": 1}'
EndpointWhat it does
POST /api/v1/orderPlaces a market, limit or stop order
POST /api/v1/closeCloses a position or cancels a pending order: one, all on a symbol, or all
GET /api/v1/positionsLists the strategy's open positions and pending orders

Base address: https://tradelite.in/api/v1. Requests and replies are JSON (UTF-8). Every reply has "ok": true or "ok": false with an "error" message.

2. API keys

  • A key belongs to one strategy. It can only place, close and see that strategy's orders. A strategy can have up to 5 keys, for example one for TradingView and one for a Python bot.
  • Allow live orders is off for a new key. A key with it off is paper only: it works on a paper strategy that no broker account copies, and it is refused on a live strategy. Turn it on (in the API dialog) only for a key that should place real orders through your broker accounts.
  • Delete a key anytime in the same dialog. Programs using it stop working at once. Deleting the strategy deletes its keys.
  • If the strategy's edits are locked with an admin email, creating a key or allowing live orders needs the code sent to that email.
  • The dialog shows when each key was last used and how many calls it made.

3. Authentication

Send the key in one of these ways:

WhereExample
Header (recommended)X-API-Key: tl_your_key
HeaderAuthorization: Bearer tl_your_key
JSON body (for TradingView, which can't set headers){"key": "tl_your_key", …}

4. Place an order

POST https://tradelite.in/api/v1/order

Simple order

Only the symbol and the side are needed. The order is a market order at the live price, the quantity is one lot when you leave it out, and the strategy's default stop loss and targets apply.

{ "symbol": "RELIANCE", "side": "buy", "qty": 1 }

Full order

{
  "symbol": "NSE:RELIANCE",
  "side": "sell",
  "type": "limit",
  "price": 1425.50,
  "qty": 3,
  "sl": 1440,
  "tp": 1410,
  "tp2": 1400,
  "tp3": 1390,
  "comment": "Opening range breakout"
}
FieldRequiredMeaning
symbolYesRELIANCE, or with the exchange: NSE:RELIANCE, or an NFO: contract as named in the app. Without an exchange NSE is tried first, then NFO.
sideYesbuy or sell (long / short work too). action is accepted instead of side.
qtyNoQuantity, as in the app's order ticket (lots for F&O). It must be a multiple of the symbol's lot step. Default: one lot step.
typeNomarket (default), limit or stop.
priceFor limit / stopEntry price. A buy limit and a sell stop must be below the current price; a buy stop and a sell limit above it. Market orders always fill at TradeLite's live price.
slNoStop-loss price: below the entry for a buy, above it for a sell.
tp, tp2, tp3NoTarget prices. With 2 or 3 targets the quantity is split into that many legs, each closing at its own target.
commentNoUp to 120 characters, shown with the order.

No sl / tp given? The strategy's default SL / TP are used, as in the app.

Reply

{
  "ok": true,
  "strategy": { "id": "1712", "name": "Nifty scalper", "type": "paper" },
  "order": {
    "order_id": "8573899012", "symbol": "NSE:RELIANCE", "side": "buy", "type": "market",
    "status": "open", "qty": 1, "price": 1428.35, "sl": 1418.35, "tp": 1448.35,
    "tp2": null, "tp3": null, "open_time": "2026-10-10 09:15:02", "live": false, "comment": ""
  }
}

Keep order_id to close the order later. status is open for a filled market order and pending for a limit or stop order. live is true when the order also went to your broker.

5. Close orders

POST https://tradelite.in/api/v1/close. Open positions close at the live price; pending orders are cancelled. Send one of these:

{ "order_id": "8573899012" }     // one order
{ "symbol": "RELIANCE" }         // everything of this strategy on RELIANCE
{ "all": true }                  // everything of this strategy
{ "ok": true, "strategy": { … }, "closed": ["8573899012"], "failed": [] }

6. List positions

GET https://tradelite.in/api/v1/positions (POST works too)

{
  "ok": true,
  "strategy": { "id": "1712", "name": "Nifty scalper", "type": "paper" },
  "live_allowed": false,
  "positions": [ { "order_id": "8573899012", "symbol": "NSE:RELIANCE", "side": "buy", "type": "market",
                   "status": "open", "qty": 1, "price": 1428.35, "ltp": 1431.10, "profit": 2.75, … } ],
  "pending": [ ]
}

profit is the open profit or loss, in rupees, as in the app.

7. TradingView alerts

  1. In TradingView, create an alert and tick Webhook URL (a paid TradingView plan is needed for webhooks).
  2. URL: https://tradelite.in/api/v1/order
  3. Message (from a TradingView strategy):
{
  "key": "tl_your_key",
  "symbol": "{{ticker}}",
  "side": "{{strategy.order.action}}",
  "qty": {{strategy.order.contracts}}
}

For an indicator alert, write the side yourself, for example "side": "buy". To exit, make a second alert with the URL https://tradelite.in/api/v1/close and the message {"key": "tl_your_key", "symbol": "{{ticker}}"}.

The key is inside the alert message, so treat your TradingView account like a password and use a separate key that you can delete.

8. Code examples

Python

import requests

API = "https://tradelite.in/api/v1"
H = {"X-API-Key": "tl_your_key"}

r = requests.post(API + "/order", headers=H, json={"symbol": "RELIANCE", "side": "buy", "qty": 1, "sl": 1400, "tp": 1460})
order = r.json()
print(order)

print(requests.get(API + "/positions", headers=H).json())
requests.post(API + "/close", headers=H, json={"order_id": order["order"]["order_id"]})

JavaScript (Node 18+)

const API = "https://tradelite.in/api/v1", H = { "X-API-Key": "tl_your_key", "Content-Type": "application/json" };
const r = await fetch(API + "/order", { method: "POST", headers: H, body: JSON.stringify({ symbol: "INFY", side: "sell", qty: 1 }) });
console.log(await r.json());

9. Errors and limits

StatusWhen
200Done
400Something in the request is missing or wrong (the message says what), or the body isn't JSON
401No key, or the key is wrong or deleted
403The key is paper only and the strategy is live (or broker accounts copy it)
404Unknown endpoint, or nothing to close
405Wrong method (use POST, or GET for positions)
409The close could not run now; try again
422Refused by the strategy's rules or your risk settings, for example "max open positions reached" or "trading is stopped for today"
429Over a rate limit: 10 requests a second per key, or 10 orders a second per exchange for your account
{ "ok": false, "error": "Nifty scalper: daily loss limit ₹2,000 reached (today −₹2,140)" }
  • Order rate: at most 10 orders a second per exchange for your account, counting all your keys. This is the SEBI / NSE limit for retail API trading without exchange registration (SEBI circular of 4 February 2025, NSE circular of 29 April 2025). A close of many orders is paced to stay within it.
  • Requests: at most 10 a second per key, and up to 5 keys per strategy.
  • Market orders need a live price. Right after a quiet period, an NSE symbol's price may take a few seconds to arrive: the error says so, and a retry works.
  • NSE / F&O orders follow the same rules as in the app (market hours, your broker chosen for live orders and approved for the day).

10. Security

  • Treat a key like a password: anyone who has it can trade the strategy. Don't put it in public code or screenshots.
  • TradeLite stores only a fingerprint (SHA-256) of each key, so a lost key can't be shown again: delete it and create a new one.
  • Use paper-only keys unless the key must place real orders.
  • All requests use HTTPS. Trading involves risk of loss; automated orders can lose money quickly. See the risk disclosure.
TradeLite

Never Overtrade Again. A charting and trading terminal for Indian stock markets.

Product

Psychology controlProduct tourOption chainReplay & journalStrategy builderTrading API

Markets

NSE & NFOOption chain

Account

Sign inCreate accountFAQ

Legal

Terms of usePrivacy policyRisk disclosureGrievance officer

TradeLite is a trading software tool. It is not a stock broker and is not registered with SEBI as an investment adviser or research analyst. Nothing on this site is investment advice or a recommendation to buy or sell any security.

Trading in securities and derivatives involves risk of loss. Past performance does not guarantee future results. Paper-trading results are simulated. Screenshots show a paper account.

Charts by TradingView Lightweight Charts · © 2026 TRADELITE FINTECH PRIVATE LIMITED · CIN U66301TN2025PTC187440