API Documentation
The Trade API allows you to automate trading by connecting your applications to the stock market.
Samco Trade API Documentation v3.2
The Login, Generate OTP, Generate Secret Key, and Generate Access Token APIs are deprecated. Please migrate to the latest V3.2 APIs — use Generate Session Token for direct authentication or OAuth 2.1 Authorization-Code Flow.
The SAMCO Trade API is a set of REST APIs that allows users to build customized applications based on their trading requirements. It enables users to log in, search for symbols, place and execute orders, view order status, and check their positions and holdings, among other functions. This documentation provides all the necessary details to understand the SAMCO Trade API collection. The APIs ship ready-to-run code samples in cURL, Java, Node.js, and Python — see Supported Client Runtimes for tested versions.
For reference, you can download the Postman collection by Click here
.
For downloading a list of all tradeable scrips across exchanges please Click here
. This is a CSV file which you can import into your database.
NOTE: To ensure stability and there by provide seamless services to our customers, Samco may set limits on your use of the Trade APIs (for example, limit on the number of requests sent to a specific API) . If you have additional questions regarding the rate limits on APIs, please reach out to us using the support link and we will be happy to assist you.
APIs will work intermittently over the weekends/holidays and outside market hours due to maintenance activity.
Base URL : https://tradeapi.samco.in
What's new in V3.2
See the full Trade API v3.2.0 release notes for highlights, new endpoints, deprecated APIs, and the migration guide.
Deprecated APIs
| API Name | Request URL |
|---|---|
| Login | /login |
| Generate OTP | /otp/generateOtp |
| Generate Secret Key | /otp/secretKeyGenerator |
| Generate Access Token | /accessToken/token |
| IP Register | /ip/ipRegistration |
| IP Update | /ip/ipUpdate |
Note: Generate Access Token API is used to generate the access token required for login.
NEW: Samco Trade API Web Dashboard
We have launched the Samco Trade API Web Dashboard — the recommended self-service portal for:
The dashboard replaces the legacy password-based IP registration flow. The older /ip/ipRegistration and /ip/ipUpdate endpoints continue to work but are deprecated. New integrations should manage Static IPs via the Web Dashboard.
| BSE CG | SENSEX | BSE CD | NIFTY50 PR 1x INV | BSE IT | METAL | OILGAS | NIFTY50 PR 2x LEV |
|---|---|---|---|---|---|---|---|
| BSEIPO | GREENX | POWER | NIFTY50 TR 1x INV | CARBON | BASMTR | CDGS | NIFTY50 TR 2x LEV |
| BSEFMC | BSE HC | ALLCAP | NIFTY50 TR 2x LEV | REALTY | SMEIPO | DOL30 | NIFTY Mid LIQ 15 |
| LRGCAP | MIDSEL | SMLSEL | NIFTY100 LIQ 15 | SNXT50 | SNSX50 | NIFTY 50 | NIFTY Quality 30 |
| NIFTY BANK | NIFTY NEXT 50 | DOL100 | NIFTY MIDCAP 50 | NIFTY 100 | NIFTY 200 | NIFTY 500 | NIFTY FIN SERVICE |
| NIFTY AUTO | NIFTY FMCG | NIFTY IT | NIFTY COMMODITIES | NIFTY MEDIA | NIFTY METAL | NIFTY PHARMA | NIFTY CONSUMPTION |
| NIFTY PSU BANK | NIFTY PVT BANK | NIFTY REALTY | NIFTY GROWSECT 15 | NIFTY CPSE | NIFTY ENERGY | NIFTY INFRA | NIFTY DIV OPPS 50 |
| NIFTY MNC | NIFTY PSE | NIFTY SERV SECTOR | NIFTY MID100 FREE | DOL200 | TECK | BSEPSU | NIFTY SML100 FREE |
| AUTO | BANKEX | INDIA VIX | NIFTY50 VALUE 20 | NIFTY MID SELECT |
The following APIs can be accessed without a session token:
| Function | Endpoint |
|---|---|
| Generate Session Token (direct) | /session/token |
| Login (deprecated) | /login |
| Generate OTP (deprecated) | /otp/generateOtp |
| Generate Secret Key (deprecated) | /otp/secretKeyGenerator |
| Generate Access Token (deprecated) | /accessToken/token |
| IP Register (deprecated) | /ip/ipRegistration |
| IP Update (deprecated) | /ip/ipUpdate |
This is the request header which should be included in every API request.
ℹ️ Note: The session token is required for all APIs except the ones listed above.
| Name | Required | Description |
|---|---|---|
| Accept | false | Accept indicates what the format of the response will be. If the user does not provide an accept, by default it is considered as application/json. Only application/json, */*, or blank are acceptable. |
| Content-Type | false | Content-Type refers to the media type or MIME type of the data in an HTTP message, indicating the type of content being sent. By default, it is considered as application/json. Only application/json, */*, or blank are acceptable. |
| x-session-token | true | When one hits the login API, it receives a session token in response. The same token is used here for validation for all API requests. |
The HTTP response code indicates the success or failure of an HTTP request. Below is a list
| Name | Meaning | Description |
|---|---|---|
| 200 | OK | API response received successfully |
| 400 | Bad Request | Input validation Failed. Check the validation errors in response object. |
| 406 | Not Acceptable | Client's request headers unacceptable. Server can't provide desired response. |
| 415 | Unsupported Media Type | Unsupported media type in request. Server cannot process the content. |
| 429 | Too Many Requests | Rate limiting. |
| 500 | Internal Server Error | Server Error |
We have implemented two types of rate limits on our server: session-based and IP-based.
Session-based rate limit : When a client logs in, they receive a session token. This token represents one session. For example, if the client is using the personal index API, they can make 3 requests per second with this session token.
IP-based rate limit : If a client is in an organization where many clients are using the trade API, we apply an IP-based rate limit. This means that from that organization's IP address, only a limited number of requests to each API are allowed.
For example, the personal index API has a IP rate limit of 20 requests per second. If 5 employees in an organization are using the personal index API from the same IP address, each employee can make up to 4 requests per second. If any employee exceeds their limit and makes 5 requests per second, one of the requests from the other employees will fail.This means that no client can exceed their session limit, and no client from a single IP address can exceed the IP-based limit.
| API Name | Requests URL | Session | IP |
|---|---|---|---|
| Generate Session Token | /session/token | 5 req/sec | 200 req/sec |
| User Login (deprecated) | /login | 5 req/sec | 200 req/sec |
| Generate OTP | /otp/generateOtp | 1 req/sec | 200 req/sec |
| Generate Secret Key | /otp/secretKeyGenerator | 1 req/sec | 200 req/sec |
| Generate Access Token | /accessToken/token | 5 req/sec | 200 req/sec |
| IP Register (deprecated) | /ip/ipRegistration | 1 req/sec | 200 req/sec |
| IP Update (deprecated) | /ip/ipUpdate | 1 req/sec | 200 req/sec |
| Login Code | /webSecretCode | 5 req/sec | 200 req/sec |
| Personal Index | /indexData | 3 req/sec | 20 req/sec |
| Market Depth | /marketDepth | 3 req/sec | 20 req/sec |
| Contract Analyser | /contractsAnalyser | 1 req/sec | 5 req/sec |
| Add GTT | /gttoco/addGtt | 3 req/sec | 20 req/sec |
| Modify GTT | /gttoco/modifyGtt | 3 req/sec | 20 req/sec |
| Delete GTT | /gttoco/deleteGtt | 3 req/sec | 20 req/sec |
| Add OCO | /gttoco/addOco | 3 req/sec | 20 req/sec |
| Modify OCO | /gttoco/modifyOco | 3 req/sec | 20 req/sec |
| Delete OCO | /gttoco/deleteOco | 3 req/sec | 20 req/sec |
| List GTT OCO | /gttoco/listGttOco | 3 req/sec | 20 req/sec |
| Span Margin | /spanMargin | 3 req/sec | 20 req/sec |
| Get Quote | /quote/getQuote | 10 req/sec | 500 req/sec |
| Index Quote | /quote/indexQuote | 10 req/sec | 500 req/sec |
| Multi Quote | /quote/multiQuote | 10 req/sec | 500 req/sec |
| Search Equity & Derivative | /eqDervSearch/search | 5 req/sec | 500 req/sec |
| Option Chain | /option/optionChain | 1 req/sec | 20 req/sec |
| Future Chain | /future/futureChain | 1 req/sec | 20 req/sec |
| User Limits | /limit/getLimits | 2 req/sec | 200 req/sec |
| Place Order | /order/placeOrder | 10 req/sec | 200 req/sec |
| Place BO Order | /order/placeOrderBO | 10 req/sec | 200 req/sec |
| Place CO Order | /order/placeOrderCO | 10 req/sec | 200 req/sec |
| Bulk Order | order/bulkOrder | 10 req/sec | 200 req/sec |
| Get Order Status | /order/getOrderStatus | 100 req/sec | 200 req/sec |
| Order Book | /order/orderBook | 100 req/sec | 200 req/sec |
| TriggerOrders | /order/getTriggerOrders | 20 req/sec | 200 req/sec |
| Modify Order | /order/modifyOrder | 10 req/sec | 200 req/sec |
| Cancel BO Order | /order/exitBO | 10 req/sec | 200 req/sec |
| Cancel CO Order | /order/exitCO | 10 req/sec | 200 req/sec |
| Cancel Order | /order/cancelOrder | 10 req/sec | 200 req/sec |
| Trade Book | /trade/tradeBook | 5 req/sec | 20 req/sec |
| User Positions | /position/getPositions | 5 req/sec | 200 req/sec |
| Position Conversion | /position/convertPosition | 5 req/sec | 200 req/sec |
| Position Square Off | /position/squareOff | 20 req/sec | 200 req/sec |
| User Holdings | /holding/getHoldings | 2 req/sec | 200 req/sec |
| Intraday candle data | /intraday/candleData | 5 req/sec | 20 req/sec |
| Index IntraDay candle data | /intraday/indexCandleData | 5 req/sec | 20 req/sec |
| Historical candle data | /history/candleData | 5 req/sec | 20 req/sec |
| Index Historical CandleData | /history/indexCandleData | 5 req/sec | 20 req/sec |
| Create Basket | basket/createBasket | 5 req/sec | 20 req/sec |
| Modify Basket | basket/modifyBasket | 5 req/sec | 20 req/sec |
| Delete Basket | basket/deleteBasket | 5 req/sec | 20 req/sec |
| List Basket | basket/listBasket | 5 req/sec | 20 req/sec |
| Create Order | basket/createOrder | 5 req/sec | 20 req/sec |
| List Basket Order | basket/listBasketOrder | 5 req/sec | 20 req/sec |
| Delete basket Order | basket/deleteBasketOrder | 5 req/sec | 20 req/sec |
| Span Calculator | basket/spanCalculator | 5 req/sec | 20 req/sec |
| Execute Basket Order | basket/executeBasketOrder | 5 req/sec | 20 req/sec |
| Modify basket Order | basket/modifyBasketOrder | 5 req/sec | 20 req/sec |
| Rearrange Basket Order | basket/rearrangeBasketOrder | 5 req/sec | 20 req/sec |