TradeX (v1)

Download OpenAPI specification:Download

TradeX API

The TradeX API is a high-performance trading API designed for seamless order execution, position tracking, and risk management across multiple exchanges.

🔹 Key Features

  • 🔒 Secure Authentication – Uses Bearer token-based authentication for access control.
  • 📈 Multi-Exchange Support – Trade on NSE, BSE, MCX, and more with a unified API.
  • 📊 Order Management – Supports market, limit, stop-loss, and algorithmic orders.
  • ⏳ GTT Orders – Place Good-Till-Triggered (GTT) orders with conditional execution.
  • 📦 Basket Trading – Execute multiple orders in a single request.
  • ⚠ Risk Management – Monitor margins, exposures, and P&L in real-time.
  • 💰 Position & Holdings Tracking – View live and historical positions with detailed insights.
  • 🚦 Rate Limiting – Ensures fair API usage and prevents excessive requests.

📌 Standardized API Response Format

All API responses follow a structured format:

✅ Success Response Example

{
  "status": 200,
  "message": "Success",
  "data": { ... }
}

❌ Error Response Example

{
  "status": 400,
  "message": "Bad Request: Invalid parameters",
  "data": null
}

🔑 Authentication

All API calls require a valid Bearer token:

Authorization: Bearer {token}

Tokens are obtained via the Login API and must be included in every request.

🛡️ Rate Limits

To ensure fair usage, API requests are subject to rate limits. If the rate limit is exceeded, the response will be:

{
  "status": 429,
  "message": "Too Many Requests: Rate limit exceeded",
  "data": null
}

🚫 IP/Domain Whitelisting

During App Key registration, users may provide an IP address/domain.

API requests from unregistered IPs/domains will fail authentication.

📌 Exchange & Product Restrictions

When requesting an API Key, users can restrict access to specific:

  • Exchanges (e.g., NseCm, Bse, MCX, etc.).
  • Products(e.g., CNC, Intraday, MTF, etc.).

🔹 Example: If a user restricts their key to NseCm and CNC, they will not be able to place orders on MCX or Intraday.

🔹 Enumerations Used:

🔹 Exchanges

  • NseCm – NSE Cash
  • NseFO – NSE Future & Options on Equity
  • Bse – BSE
  • BseFO – BSE Future & Options on Equity
  • NseCD – NSE Currency Derivatives
  • MCX – MCX
  • Ncdex – NCDEX
  • BseCD – BSE Currency Derivatives
  • NseCO – NSE Commodities
  • OFS – Offer For Sale
  • BseCO – BSE Commodities

🔹 Order Side

  • Buy
  • Sell

🔹 Product Types

  • Normal
  • Intraday
  • CNC
  • MTF

🔹 Book Type

  • RL – Regular Order
  • SL – Stop Loss
  • PO – Pre Open Order (Before market start or during pre-open session)
  • CA2 – Special Call Auction/Listing (For new listing/relisting scrips)

🔹 Option Type

  • NONE
  • CA
  • CE
  • PA
  • PE

🔹 Validity (Applicable Exchanges)

  • Day – End Of Day (NseCM, NseFO, NseCD, NseCO, MCX, Ncdex)
  • IOC – Immediate Or Cancel (All Exchanges)
  • EOSES – End Of Session (Bse, BseFO, BseCD, BseCO, MCX)
  • EOD – End Of Day (Bse)
  • GTD – Good Till Date (MCX, Ncdex)
  • GTC – Good Till Cancelled (MCX, Ncdex)

🔹 Order Status

  • Dispatched – Sent from client, response awaited
  • Pending
  • cDispatched – Cancel order sent, response awaited
  • mDispatched – Modify order sent, response awaited
  • Cancelled
  • Rejected – Rejected by Exchange
  • Frozen – Frozen by Exchange
  • Failed – RMS Rejected
  • Executed
  • modFailed – Modification Rejected
  • Accepted – Accepted for future processing (AMO)

User

Login

This endpoint authenticates a user and provides a token for further API access.
The token must be included in subsequent requests as a Bearer Token in the Authorization header.

Authentication Required:
No authentication required for this endpoint.

Example Request:

POST /Login HTTP/1.1
Content-Type: application/json
            
{
  "user_id": "AB1234",
  "app_key": "your_app_key",
  "secret_key": "your_secret_key",
  "source": "web"
}

Example Successful Response:

{
  "status": 200,
  "message": "Login successful",
  "data": {
    "user_id": "AB1234",
    "exchanges_allowed": ["NseCm", "NseFO", "Bse", "MCX"],
    "products_allowed": ["CNC", "Intraday"],
    "token": "your_access_token"
  }
}

Example Error Response (401 Unauthorized):

{
  "status": 401,
  "message": "Unauthorized: Invalid credentials",
  "data": null
}

Responses:

  • 200 OK – Login successful, returns user details.
  • 401 Unauthorized – Invalid credentials.
  • 500 Internal Server Error – Unexpected error occurred.
path Parameters
version
required
string
Request Body schema:

The login request containing authentication credentials.

user_id
required
string non-empty

Unique identifier assigned to the user.
Example: "12345".

app_key
required
string non-empty

Application key used for authentication.
This key is sent to the client via email and should be used for authentication.
Example: "example_app_key".

secret_key
required
string non-empty

Secret key associated with the application key.
This key is sent to the client via email and must be kept confidential.
Example: "example_secret_key".

source
required
string [ 0 .. 10 ] characters

Source of the login request. This should be consumer of the api. (e.g. smallcase, sensibull, tradetron) Helps identify the origin of the authentication request.
Maximum Length: 10 characters.

Responses

Request samples

Content type
{
  • "user_id": "string",
  • "app_key": "string",
  • "secret_key": "string",
  • "source": "string"
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Logout

The client must provide both a valid authentication token and ClientID in the request:

Example Request:

POST /Logout?ClientID=12345 HTTP/1.1  
Authorization: Bearer {token}  
path Parameters
version
required
string
query Parameters
ClientID
string

The unique identifier of the user requesting logout.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": "string"
}

User Profile

This endpoint allows an authenticated client to fetch its detailed user profile, including
their registered contact information, trading permissions, and account-related details.

Authentication Required:
A valid Bearer token must be included in the Authorization header.

Example Request:

POST /UserProfile?ClientID=12345 HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Query Parameters:

  • ClientID → The unique identifier of the user whose profile is being retrieved.

Responses:

  • 200 OK – User profile retrieved successfully.
  • 400 Bad Request – Missing or invalid user ID.
  • 401 Unauthorized – Authentication token is missing or invalid.
  • 500 Internal Server Error – Unexpected failure while retrieving user profile.
path Parameters
version
required
string
query Parameters
ClientID
string

The unique identifier of the user.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Orders

New Order

Places a new order for the authenticated client. This endpoint requires authentication using a Bearer token.
The client must include the token in the Authorization header:

Example Request:

POST /NewOrder HTTP/1.1  
Authorization: Bearer {token}  
Content-Type: application/json  

Example Request Body:

{
  "client": "AB1234",
  "quantity": 100,
  "price": 1500.50,
  ...
}

Responses:

  • 200 OK – Request for new order sent.
  • 400 Bad Request – Invalid order details.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 500 Internal Server Error – Unexpected failure during order processing.
path Parameters
version
required
string
Request Body schema:

The new order request containing order details.

exchange
required
string non-empty

Exchange identifier where the order is placed.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".
Example: "NseCm".

code
required
string non-empty

Unique identifier of the security being traded.

  • Integer for normal orders. Example: 123456
  • String for spread orders. .
side
required
string non-empty

Side of the trade.
Allowed values: "Buy", "Sell".
Example: "Buy".

quantity
required
integer <int32> [ 1 .. 2147483647 ]

Total quantity of the security to be traded.
Example: 100 (in shares of the security).

price
required
number <double>

Order price for limit or stop-limit orders.
If price = 0, the order is considered a Market Order.
Example: 1500.50 (Price in INR for equities, gold, etc.), or 0 for Market Order.

client
required
string non-empty

Client identifier placing the order.
Example: "AB1234".

book
required
string non-empty

Type of order book:

  • "RL" → Regular Order
  • "SL" → Stop Loss Order
  • "PO" → Pre Open Order (Before market start or during pre-open session)
  • "CA2" → Special Call Auction/Listing (For new listing/relisting scrips) Example: "RL".
trigger_price
required
number <double>

Trigger price for stop-loss and stop-limit orders.
This field is required for "SL" orders but ignored for "RL" orders.
Example: 1495.00.

disclosed_qty
required
integer <int32>

Quantity to be disclosed to the market (for iceberg orders).
If disclosed_qty = 0, it means no iceberg order.
Example: 10 (out of 100 total quantity), or 0 for no iceberg order.

product
required
string non-empty

Product type for margin handling.
Example: "CNC", "Intraday", "Normal", "MTF".

validity
required
string non-empty

Order validity type.
Example: "Day" (valid for the day), "EOSES" (valid for the session : All Bse segments), "EOD" (valid till end of day: Only Bse Equities), "IOC" (Immediate or Cancel).

gtd
string or null

Good-Till-Date (GTD) validity for long-duration orders.
Default: blank.

order_flag
integer <int32>

Order flag settings (bitwise OR combinable):

  • 2: After Market Order (AMO)
  • 4: Ignore Daily Price Range (DPR) failure
  • 8: Auto-split order beyond freeze quantity Default value: 0 (no special flags). Multiple flags can be combined. Example:
  • order_flag = 12; // Combines Ignore DPR and Auto-Split (Result: 12)
sender_order_no
required
integer <int32>

Unique number assigned by the API consumer for tracking purposes.
This is not generated by the API but provided by the client application.
Example: 987654.

algol_id
required
integer <int32>

Algorithm identifier for algorithmic trading, provided by the broker.
If the order is algorithmic, algol_id must be between 1001 and 2099.
If the order is not algorithmic, algol_id must be 0.
Example: 1001 (for an algorithmic trading strategy), or 0 for non-algo orders.

Responses

Request samples

Content type
{
  • "exchange": "string",
  • "code": "string",
  • "side": "string",
  • "quantity": 1,
  • "price": 0,
  • "client": "string",
  • "book": "string",
  • "trigger_price": 0,
  • "disclosed_qty": 0,
  • "product": "string",
  • "validity": "string",
  • "gtd": "string",
  • "order_flag": 0,
  • "sender_order_no": 0,
  • "algol_id": 0
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Modify Order

Modifies an existing order for the authenticated client. This endpoint modifies an order for the authenticated client.
Requires authentication using a Bearer token.

Example Request:

POST /ModifyOrder HTTP/1.1  
Authorization: Bearer {token}  
Content-Type: application/json  

Example Request Body:

{
  "client": "AB1234",
  "exchange_order_no": 987654,
  "quantity": 100,
  "price": 1500.50,
  ...
}

Responses:

  • 200 OK – Request to modify order sent.
  • 400 Bad Request – Invalid modification request.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 500 Internal Server Error – Unexpected failure during order modification.
path Parameters
version
required
string
Request Body schema:

The modify order request containing order modification details.

exchange
required
string non-empty

The exchange where the order was placed.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".
This field is required.
Example: "NseCm".

code
required
string non-empty

The unique security identifier (trading symbol code).
This field is required.
Example: 123456.

exchange_order_no
required
string non-empty

The unique order number assigned by the exchange for tracking.
This field is required.
Example: "EX123456789".

side
required
string non-empty ^(Buy|Sell)$

Specifies whether the order is a Buy or Sell order.
This field is required.
Allowed values: "Buy", "Sell".
Example: "Buy".

quantity
required
integer <int32> [ 1 .. 2147483647 ]

The new quantity for the modified order.
This field is required.
Example: 200.

price
required
number <double> >= 0

The new price for the modified order.
If set to 0, the order is treated as a market order.
Example: 1550.75 (for limit orders) or 0 (for market orders).

client
required
string non-empty

The client identifier associated with the order.
This field is required.
Example: "AB1234".

book
required
string non-empty

Type of order book:

  • "RL" → Regular Order
  • "SL" → Stop Loss Order
  • "PO" → Pre Open Order
  • "CA2" → Special Call Auction/Listing
    This field is required.
    Example: "RL".
trigger_price
required
number <double> >= 0

The trigger price for stop-loss and stop-limit orders.
Can be 0 for non-trigger orders.
Example: 1495.00 (for stop orders) or 0 (for non-trigger orders).

disclosed_qty
required
integer <int32> [ 0 .. 2147483647 ]

Quantity to be disclosed to the market (for iceberg orders).
This field is required.
Example: 10 (out of 100 total quantity).

product
required
string non-empty

Product type for margin handling.
This field is required.
Example: "CNC", "Intraday", "Normal", "MTF".

validity
required
string non-empty

Order validity type.
This field is required.
Example: "DAY" (valid for the day), "IOC" (Immediate or Cancel).

gtd
string or null

Good-Till-Date (GTD) validity for long-duration orders.
This field is required.
Example: "2025-12-31" (YYYY-MM-DD format).

order_flag
required
integer <int32>

Reserved for future use.
This field currently has no functionality but may be used in later updates.
Default value: 0.
This field is required.

sender_order_no
required
integer <int32>

Unique number assigned by the API consumer for tracking purposes.
This field is required.
Example: 987654.

qty_remaining
required
integer <int32> [ 0 .. 2147483647 ]

The remaining quantity of the order that is yet to be executed.
This field is required for tracking partially executed orders.
Example: 50 (if 150 out of 200 shares are already executed).

qty_traded
required
integer <int32> [ 0 .. 2147483647 ]

The quantity of the order that has been executed so far.
This field is required for tracking partially executed orders.
Example: 50 (if 50 out of 200 shares are already executed).

Responses

Request samples

Content type
{
  • "exchange": "string",
  • "code": "string",
  • "exchange_order_no": "string",
  • "side": "string",
  • "quantity": 1,
  • "price": 0,
  • "client": "string",
  • "book": "string",
  • "trigger_price": 0,
  • "disclosed_qty": 2147483647,
  • "product": "string",
  • "validity": "string",
  • "gtd": "string",
  • "order_flag": 0,
  • "sender_order_no": 0,
  • "qty_remaining": 2147483647,
  • "qty_traded": 2147483647
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Cancel Order

Cancels an existing order for the authenticated client. This endpoint cancels an order for the authenticated client.
Requires authentication using a Bearer token.

Example Request:

POST /CancelOrder HTTP/1.1  
Authorization: Bearer {token}  
Content-Type: application/json  

Example Request Body:

{
  "exchange": "Bse",
  "code": "54897"
  "exchange_order_no": "124886566"
  ...
}

Responses:

  • 200 OK – Order sent for cancellation.
  • 400 Bad Request – Invalid cancellation request.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 500 Internal Server Error – Unexpected failure during order cancellation.
path Parameters
version
required
string
Request Body schema:

The cancel order request containing order details.

exchange
required
string non-empty

The exchange where the order was placed.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".
This field is required.
Example: "NseCm".

code
required
string non-empty

The unique security identifier (trading symbol code).
This field is required.
Example: 123456.

exchange_order_no
required
string non-empty

The unique order number assigned by the exchange for tracking.
This field is required.
Example: "EX123456789".

user_order_no
integer <int32>

Internal order number generated by the API when the order was first placed.
This number does not change after modifications.
Example: 98765432.

sender_order_no
integer <int32>

Unique identifier assigned by the API consumer for tracking purposes.
This number is optional and is used for reference purposes.
Example: 987654.

client
required
string non-empty

The client identifier associated with the order to be canceled.
This field is required.
Example: "AB1234".

Responses

Request samples

Content type
{
  • "exchange": "string",
  • "code": "string",
  • "exchange_order_no": "string",
  • "user_order_no": 0,
  • "sender_order_no": 0,
  • "client": "string"
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Cancel All Orders

This endpoint sends all open orders for cancellation for a specific exchange, security, and client.
Only orders matching both exchange and code for the given client will be sent for cancellation.

Cancellation Criteria:

  • exchange: The stock/commodity exchange where the orders were placed.
  • code: The security identifier (trading symbol code).
  • client: The client whose orders should be canceled.

Example Request:

POST /CancelAllOrders HTTP/1.1  
Authorization: Bearer {token}  
Content-Type: application/json  

Example Request Body:

{
  "exchange": "NseCm",
  "code": 123456,
  "client": "AB1234"
}

Response Scenarios:

  • 202 AcceptedAll matching orders sent for cancellation successfully.
  • 200 OKPartial success: Some orders canceled, others failed.
  • 400 Bad RequestInvalid request parameters or missing required fields.
  • 401 UnauthorizedInvalid or missing authentication token.
  • 404 Not FoundNo matching orders found for the given exchange, security, and client.
  • 500 Internal Server ErrorUnexpected failure during cancellation processing.
path Parameters
version
required
string
Request Body schema:

The cancel all orders request containing exchange, security code, and client details.

exchange
required
string non-empty

The exchange where the orders were placed.
This field is required and used in combination with code to identify the orders to cancel.

Example: "NseCm".

Allowed values:

  • "NseCm" - NSE Cash Market
  • "NseFO" - NSE Futures and Options
  • "NseCD" - NSE Currency Derivatives
  • "NseCO" - NSE Commodity
  • "Bse" - BSE Cash Market
  • "BseFO" - BSE Futures and Options
  • "BseCD" - BSE Currency Derivatives
  • "BseCO" - BSE Commodity
  • "MCX" - Multi Commodity Exchange
  • "Ncdex" - National Commodity and Derivatives Exchange

Cancellation Rule:

  • All open orders on this exchange that match the specified code will be sent for cancellation.
code
required
integer <int32>

The unique security identifier (trading symbol code) for the instrument being traded.
This field is required and used in combination with exchange to identify the orders to cancel.

Example: 123456 (Security Code for a stock or derivative).

Cancellation Rule:

  • All open orders matching this security code on the specified exchange will be sent for cancellation.
  • If no active orders exist for this security on the exchange, the API will return 404 Not Found.
client
required
string non-empty

The client identifier associated with the orders.
This field is required and used to filter the orders being canceled.

Example: "AB1234".

Cancellation Rule:

  • Only orders belonging to this client will be sent for cancellation.
  • Orders belonging to other clients will not be affected.
  • If no active orders exist for this client, exchange, and code, the API will return 404 Not Found.

Responses

Request samples

Content type
{
  • "exchange": "string",
  • "code": 0,
  • "client": "string"
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": null
}

New GTT Order

This endpoint allows a client to place a new GTT order.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /NewGttOrder HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Request Body:

{
  "client": "AB1234",
  "exchange": "NseCm",
  "code": 123456,
  ...
}

Responses:

  • 200 OK – GTT order placed successfully.
  • 400 Bad Request – Invalid request parameters.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 500 Internal Server Error – Unexpected failure while processing order.
path Parameters
version
required
string
Request Body schema:

The GTT order request payload.

client
required
string non-empty

Client identifier placing the GTT order.

exchange
required
string non-empty

Exchange where the order will be placed.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".

code
required
string non-empty

Token representing the security being traded.

side
required
string non-empty

Side of the trade.
Allowed values: "Buy", "Sell".

product
required
string non-empty

Product type for the order.
Example: "CNC", "Intraday", "Normal", "MTF".

qty
required
integer <int32> [ 1 .. 2147483647 ]

Quantity of the order.
Must be greater than zero.

main_trigger_price
number <double>

Main trigger price for activating the GTT order.

main_order_price
string or null

Main order price for execution after the trigger.
May be a numeric value (0 for market) or one of the following:
"Market", "Active", "LTP", "Active2", "Active3", "Active4", "Active5", "Extreme",
"Passive1", "Passive2", "Passive3", "Passive4", "Passive5", "ATP", "Open", "Close".

main_state
required
string non-empty

State of the main trigger condition.
If main order is selected, use "Scheduled"; otherwise, "None".

price_condition
required
string non-empty

Condition for triggering the price.
Allowed values: "None", "Immediate", "PriceBelow", "PriceAbove".

stop_state
required
string non-empty

State of the stop-loss trigger.
If stop-loss is selected, use "Scheduled"; otherwise, "None".

stop_trigger_price
number <double>

Stop-loss trigger price (if applicable).

stop_order_price
string or null

Stop-loss order price for execution after the trigger.
May be a numeric value or one of the following:
"Market", "Active", "LTP", "Active2", "Active3", "Active4", "Active5", "Extreme",
"Passive1", "Passive2", "Passive3", "Passive4", "Passive5", "ATP", "Open", "Close".

trail_gap
required
number <double>

Trail gap for a trailing stop order.
Used for dynamic stop-loss adjustments.

target_state
required
string non-empty

State of the target price trigger.
If target is selected, use "Scheduled"; otherwise, "None".

target_trigger_price
number <double>

Target price at which the order should execute.

target_order_price
string or null

Target order price for execution after the trigger.
May be a numeric value or one of the following:
"Market", "Active", "LTP", "Active2", "Active3", "Active4", "Active5", "Extreme",
"Passive1", "Passive2", "Passive3", "Passive4", "Passive5", "ATP", "Open", "Close".

sender_order_no
required
integer <int32>

Unique number assigned by the API consumer for tracking purposes. Not required but recommended for order tracking.

Responses

Request samples

Content type
{
  • "client": "string",
  • "exchange": "string",
  • "code": "string",
  • "side": "string",
  • "product": "string",
  • "qty": 1,
  • "main_trigger_price": 0,
  • "main_order_price": "string",
  • "main_state": "string",
  • "price_condition": "string",
  • "stop_state": "string",
  • "stop_trigger_price": 0,
  • "stop_order_price": "string",
  • "trail_gap": 0,
  • "target_state": "string",
  • "target_trigger_price": 0,
  • "target_order_price": "string",
  • "sender_order_no": 0
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Modify GTT Order

This endpoint allows a client to modify an existing GTT order by changing parameters such as trigger price, order price, or quantity.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /ModifyGttOrder HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Request Body:

{
  "gtt_order_id": 987654321,
  "client": "A125",
  "side": "Buy",
  ...
}

Responses:

  • 200 OK – GTT order modified successfully.
  • 400 Bad Request – Invalid request parameters.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 500 Internal Server Error – Unexpected failure while modifying the order.
path Parameters
version
required
string
Request Body schema:

The GTT order modification request payload.

client
required
string non-empty

Client identifier associated with the GTT order.

gtt_order_no
required
integer <int32>

Unique identifier of the GTT order to be modified.

exchange
required
string non-empty

Exchange where the order is placed. Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".

code
required
string non-empty

Unique identifier of the security being traded.

side
required
string non-empty

Side of the trade. Allowed values: "Buy", "Sell".

product
required
string non-empty

Product type for the order. Example: "CNC", "Intraday", "Normal", "MTF".

qty
required
integer <int32> [ 1 .. 2147483647 ]

Quantity of the order. Must be greater than zero.

price_condition
required
string non-empty

Condition for triggering the price. Allowed values: "Immediate", "PriceBelow", "PriceAbove".

main_trigger_price
required
number <double>

Main trigger price for activating the GTT order.

main_order_price
string or null

Main order price for execution after the trigger. May be a numeric value or one of the predefined values: "Market", "LTP", "Active", "Passive", "ATP", "Open", "Close".

main_state
required
string non-empty

State of the main trigger. Allowed values: "None", "Scheduled", "Triggered", "Cancelled", "Executed".

stop_state
string or null

State of the stop-loss trigger. Allowed values: "None", "Scheduled", "Triggered", "Cancelled", "Executed".

stop_trigger_price
number <double>

Stop-loss trigger price.

stop_order_price
string or null

Stop-loss order price after the trigger. May be a numeric value or predefined values: "Market", "LTP", "Active", "Passive", "ATP", "Open", "Close".

trail_gap
number <double>

Trail gap for a trailing stop-loss order. Defines the dynamic adjustment range for the stop-loss trigger.

target_state
string or null

State of the target trigger. Allowed values: "None", "Scheduled", "Triggered", "Cancelled", "Executed".

target_trigger_price
number <double>

Target price at which the order should be executed.

target_order_price
string or null

Target order price after the trigger. May be a numeric value or predefined values: "Market", "LTP", "Active", "Passive", "ATP", "Open", "Close".

sender_order_no
integer <int32>

Unique number assigned by the API consumer for tracking purposes. Not required but recommended for order tracking.

Responses

Request samples

Content type
{
  • "client": "string",
  • "gtt_order_no": 0,
  • "exchange": "string",
  • "code": "string",
  • "side": "string",
  • "product": "string",
  • "qty": 1,
  • "price_condition": "string",
  • "main_trigger_price": 0,
  • "main_order_price": "string",
  • "main_state": "string",
  • "stop_state": "string",
  • "stop_trigger_price": 0,
  • "stop_order_price": "string",
  • "trail_gap": 0,
  • "target_state": "string",
  • "target_trigger_price": 0,
  • "target_order_price": "string",
  • "sender_order_no": 0
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Cancel GTT Order

This endpoint allows a client to cancel a GTT order that has not yet been triggered.

Authentication Required:

  • The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /CancelGttOrder?ClientID=AB1234&GttOrderNo=987654321 HTTP/1.1  
Authorization: Bearer {token}  
Content-Type: application/json  

Notes:

  • Only pending GTT orders can be canceled.
  • If the order has already been triggered or executed, it cannot be canceled.

Responses:

  • 200 OK – GTT order canceled successfully.
  • 400 Bad Request – Invalid request parameters.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 404 Not Found – The specified GTT order does not exist or is not cancelable.
  • 500 Internal Server Error – Unexpected failure while canceling the order.
path Parameters
version
required
string
query Parameters
ClientID
string

The client identifier for whom the GTT order is being canceled.

GttOrderNo
integer <int32>

The unique identifier of the GTT order to be canceled.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Execute Basket Orders

This endpoint allows a client to submit multiple orders as a basket in a single request.
The basket ensures that all orders belong to the same client before processing.

Atomic Execution:

  • The basket will execute in an atomic fashion within the Risk Management System (RMS).
  • All orders must pass or all orders will fail.
  • If even a single order in the basket fails due to margin constraints or RMS validation,
    the entire basket will be rejected.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /ExecuteBasket HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Request Body:

{
  "client": "AB1234",
  "orders": [
    {
      "exchange": "NseCm",
      "code": "123456",
      "side": "Buy",
      ...
    },
    {
      "exchange": "Bse",
      "code": "789012",
      "side": "Sell",
      ...
    }
  ]
}

Validation Rules:

  • client must be valid and authorized.
  • orders list cannot be empty or null
  • orders list cannot have more than 20 orders.
  • Each order within the basket must belong to the same client.

Example Response:

{
  "status": 200,
  "message": "Basket sent for execution",
  "data": null
}

Responses:

  • 200 OK – Basket sent for execution.
  • 400 Bad Request – Invalid request parameters (e.g., missing or empty orders).
  • 401 Unauthorized – Missing or invalid authentication token.
  • 500 Internal Server Error – Unexpected failure while submitting the basket.

Notes:

  • Atomic Processing: If any order in the basket fails, the entire basket is rejected.
  • RMS Checks: Orders must pass margin and compliance validation.
  • If validation fails, an appropriate error message is returned.
  • If execution fails, a 400 Bad Request is returned with a failure reason.
path Parameters
version
required
string
Request Body schema:

The basket order request containing multiple orders.

client
required
string non-empty

The client identifier placing the basket order.
All orders in the basket must belong to this client.

required
Array of objects (NewOrderRequest)

List of individual orders included in the basket.
Must contain at least one and at most 20 valid orders.

Responses

Request samples

Content type
{
  • "client": "string",
  • "orders": [
    ]
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": null
}

Books

Orders Book

This endpoint allows the client to fetch their current and past orders based on filters.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

**Example Request **

POST /OrderBook?ClientID=AB1234&Filter=Pending HTTP/1.1  
Authorization: Bearer {token}  
Content-Type: application/json  

Query Parameters:

  • ClientID → The client identifier whose orders need to be retrieved.
  • Filter → Filter criteria for the order book. Allowed values:
    • "All" → Retrieve all orders.
    • "Pending" → Orders that are yet to be executed.
    • "Unconfirmed" → Orders awaiting exchange confirmation.
    • "Cancelled" → Orders that were canceled.
    • "Rejected" → Orders that were rejected.
    • "Failed" → Orders that failed due to validation or RMS checks.
    • "Executed" → Successfully executed orders.

Example Successful Response (200 OK):

{
  "status": 200,
  "message": "Order book retrieved successfully",
  "data": [
    {
      "exchange": "NseCm",
      "symbol": "RELIANCE",
      "side": "Buy",
      ...
    }
  ]
}

Example Error Response (400 Bad Request - Invalid Query Parameter):

{
  "status": 400,
  "message": "Invalid filter value. Allowed values: All, Pending, Unconfirmed, Cancelled, Rejected, Failed, Executed.",
  "data": null
}

Responses:

  • 200 OK – Order book retrieved successfully.
  • 400 Bad Request – Invalid parameters.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 404 Not Found – No orders found for the given client.
  • 500 Internal Server Error – Unexpected failure while fetching data.
path Parameters
version
required
string
query Parameters
ClientID
string

The client identifier for which the order book is being retrieved.

Filter
string

The filter criteria for retrieving orders. Allowed values: "All", "Pending", "Unconfirmed", "Cancelled", "Rejected", "Failed", "Executed".

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Order Status

This endpoint allows a client to fetch the latest status of an order placed on the exchange.

Authentication Required:
The request must include a valid Bearer token in the Authorization header. If exchange_order_no = 0 or null or empty, then sender_order_no will be used.

Example Request:

POST /OrderStatus HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Request Body:

{
  "client": "AB1234",
  "exchange": "NseCm",
  "exchange_order_no": "987654321",
  ...
}

Responses:

  • 200 OK – Order status retrieved successfully.
  • 400 Bad Request – Invalid request details.
  • 401 Unauthorized – Missing or invalid authentication token.
  • 404 Not Found – No order status found.
  • 500 Internal Server Error – Unexpected failure while fetching order status.
path Parameters
version
required
string
Request Body schema:

The order request payload containing client and order details.

client
required
string non-empty

Client identifier for whom the order history is requested.

exchange
required
string non-empty

Exchange where the order was placed.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".

code
required
string non-empty

Unique identifier of the security being traded.
Example: "500325" (for Reliance).

exchange_order_no
string or null

Unique order number assigned by the exchange.
If exchange_order_no = 0 or null or empty, then sender_order_no must be used.

sender_order_no
integer <int32>

Unique number assigned by the API consumer to track the order.
This will be used only if exchange_order_no is not specified.

Responses

Request samples

Content type
{
  • "client": "string",
  • "exchange": "string",
  • "code": "string",
  • "exchange_order_no": "string",
  • "sender_order_no": 0
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

GTT Orders Book

Fetches all GTT (Good Till Triggered) orders for a given client.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /GttOrdersBook?ClientID=AB1234 HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Successful Response (200 OK):

{
  "status": 200,
  "message": "GTT orders book retrieved successfully",
  "data": [
    {
      "gtt_order_no": 987654,
      "exchange": "NseCm",
      "code": "RELIANCE",
      ...
    }
  ]
}

Example Error Response (400 Bad Request - Missing Client ID):

{
  "status": 400,
  "message": "Missing required parameter: ClientID.",
  "data": null
}

Responses:

  • 200 OK – GTT orders book retrieved successfully.
  • 400 Bad Request – Invalid or missing query parameters.
  • 401 Unauthorized – Client not authorized.
  • 404 Not Found – No GTT orders found.
  • 500 Internal Server Error – Unexpected failure.
path Parameters
version
required
string
query Parameters
ClientID
string

The client identifier whose GTT orders need to be retrieved.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Trades Book

Fetches all executed trades for a given client.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /TradeBook?ClientID=AB1234 HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Successful Response (200 OK):

{
  "status": 200,
  "message": "Trade book retrieved successfully",
  "data": [
    {
      "exchange": "NseCm",
      "code": "RELIANCE",
      "symbol": "RELIANCE",
      ...,
    }
  ]
}

Example Error Response (400 Bad Request - Missing Client ID):

{
  "status": 400,
  "message": "Missing required parameter: ClientID.",
  "data": null
}

Responses:

  • 200 OK – Trade book retrieved successfully.
  • 400 Bad Request – Invalid or missing query parameters.
  • 401 Unauthorized – Client not authorized.
  • 404 Not Found – No trades found.
  • 500 Internal Server Error – Unexpected failure.
path Parameters
version
required
string
query Parameters
ClientID
string

The client identifier whose trade book needs to be retrieved.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Order History

Fetches the complete history of orders placed by a given client.

Authentication Required: Bearer token
If exchange_order_no = 0 or null or empty, then sender_order_no will be used.

Example Request:

POST /OrderHistory HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Request Body:

{
  "client": "AB1234",
  "exchange": "NseCm",
  "code": "500325",
  ...
}

Example Response (200 - Success):

{
  "status": 200,
  "message": "Order history retrieved successfully",
  "data": [
    {
      "exchange": "NseCm",
      "symbol": "RELIANCE",
      "side": "Buy",
      ...
    }
  ]
}

Error Responses:

  • 400 Bad Request – Invalid parameters.
  • 401 Unauthorized – Client not authorized.
  • 404 Not Found – No order history found.
  • 500 Internal Server Error – Unexpected failure.

Example Error Response (400 - Bad Request):

{
  "status": 400,
  "message": "Invalid request parameters.",
  "data": null
}

Example Error Response (404 - No Records Found):

{
  "status": 404,
  "message": "No order history found.",
  "data": null
}
path Parameters
version
required
string
Request Body schema:

The request containing client and order details.

client
required
string non-empty

Client identifier for whom the order history is requested.

exchange
required
string non-empty

Exchange where the order was placed.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".

code
required
string non-empty

Unique identifier of the security being traded.
Example: "500325" (for Reliance).

exchange_order_no
string or null

Unique order number assigned by the exchange.
If exchange_order_no = 0 or null or empty, then sender_order_no must be used.

sender_order_no
integer <int32>

Unique number assigned by the API consumer to track the order.
This will be used only if exchange_order_no is not specified.

Responses

Request samples

Content type
{
  • "client": "string",
  • "exchange": "string",
  • "code": "string",
  • "exchange_order_no": "string",
  • "sender_order_no": 0
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Portfolio

Holdings

Fetches all holdings for a given client.

Authentication Required: Bearer token

Example Request:

POST /Holdings?ClientID=AB1234 HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Query Parameters:

  • ClientID → The client identifier whose holdings need to be retrieved.

Example Response (200 - Success):

{
  "status": 200,
  "message": "Holdings retrieved successfully",
  "data": [
    {
      "client": "AB1234",
      "isin": "INE002A01018",
      "nse_name": "RELIANCE",
      ...
    }
  ]
}

Error Responses:

  • 400 Bad Request – Invalid parameters.
  • 401 Unauthorized – Client not authorized.
  • 404 Not Found – No holdings found.
  • 500 Internal Server Error – Unexpected failure.

Example Error Response (400 - Bad Request):

{
  "status": 400,
  "message": "Invalid request parameters.",
  "data": null
}

Example Error Response (404 - No Holdings Found):

{
  "status": 404,
  "message": "No holdings found.",
  "data": null
}
path Parameters
version
required
string
query Parameters
ClientID
string

The client identifier for retrieving holdings.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Positions

Fetches net positions for a given client, with an optional filter to specify the type of positions to retrieve.

Authentication Required: Bearer token

Example Request:

POST /NetPositions?ClientID=AB1234&Filter=All HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Query Parameters:

  • ClientID → The client identifier whose net positions need to be retrieved.
  • Filter → Filter to specify the type of positions to retrieve.
    • Allowed values: "All", "Opening", "Todays".

Example Response (200 - Success):

{
  "status": 200,
  "message": "Net positions retrieved successfully",
  "data": [
    {
      "client": "AB1234",
      "exchange": "NseCm",
      "code": "500325",
      ...
    }
  ]
}

Error Responses:

  • 400 Bad Request – Invalid parameters.
  • 401 Unauthorized – Client not authorized.
  • 404 Not Found – No net positions found.
  • 500 Internal Server Error – Unexpected failure.

Example Error Response (400 - Bad Request):

{
  "status": 400,
  "message": "Invalid filter. Allowed values: All, Opening, Todays.",
  "data": null
}

Example Error Response (404 - No Net Positions Found):

{
  "status": 404,
  "message": "No net positions found.",
  "data": null
}
path Parameters
version
required
string
query Parameters
ClientID
string

The client identifier for retrieving net positions.

Filter
string
Default: "All"

Filter for net positions. Allowed values: "All", "Opening", "Todays".

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Convert Position

Updates the product type associated with a client's net position.

Authentication Required: Bearer token

Example Request:

POST /ModifyProduct HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Example Request Body:

{
  "client": "AB1234",
  "exchange": "NseCm",
  "code": 123456,
 ...
}

Responses:

  • 200 OK – Product modified successfully.
  • 400 Bad Request – Invalid request parameters.
  • 401 Unauthorized – Client not authorized.
  • 500 Internal Server Error – Unexpected failure.
path Parameters
version
required
string
Request Body schema:

The request containing modification details.

client
required
string non-empty

Client identifier for whom the product modification is requested.

exchange
required
string non-empty

Exchange where the position exists.
Allowed values: "NseCm", "NseFO", "NseCD", "NseCO", "Bse", "BseFO", "BseCD", "BseCO", "MCX", "Ncdex".

code
required
string non-empty

Unique identifier of the security being traded.
Example: "500325" (for Reliance).

old_product
required
string non-empty

Existing product type of the position.
Example: "Intraday", "Normal", "CNC", "MTF".

new_product
required
string non-empty

New product type to which the position is being modified.
Example: "Intraday", "Normal", "CNC", "MTF".

side
required
string non-empty

Trade side indicating whether the position was originally a Buy or Sell.
Allowed values: "Buy", "Sell".

qty
required
integer <int32> [ 1 .. 2147483647 ]

Quantity of the position to be modified.

Responses

Request samples

Content type
{
  • "client": "string",
  • "exchange": "string",
  • "code": "string",
  • "old_product": "string",
  • "new_product": "string",
  • "side": "string",
  • "qty": 1
}

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Funds

Funds Report

This endpoint provides details about the client’s available balance,
margin usage, pay-in/pay-out status, and other financial information.

Authentication Required:
The request must include a valid Bearer token in the Authorization header.

Example Request:

POST /FundsReport?ClientID=AB1234 HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Query Parameters:

  • ClientID → The unique identifier of the client whose funds report is requested.

Example Response (200 - Success):

{
  "status": 200,
  "message": "Funds report retrieved successfully.",
  "data": [
    {
      "client_id": "AB1234",
      "limit_id": "Equity",
      "cash": 250000.50,
      ...
    }
  ]
}

Error Responses:

  • 400 Bad Request – Invalid parameters.
  • 401 Unauthorized – Client not authorized.
  • 500 Internal Server Error – Unexpected failure.

Example Error Response (400 - Bad Request):

{
  "status": 400,
  "message": "Missing or invalid ClientID.",
  "data": null
}

Example Error Response (404 - No Funds Report Found):

{
  "status": 404,
  "message": "No funds report found.",
  "data": null
}
path Parameters
version
required
string
query Parameters
ClientID
string

The unique client identifier for retrieving the funds report.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

Others

Status

This endpoint provides real-time connectivity and session status of different exchanges.

Authentication Required: Bearer token

Example Request:

POST /ExchangeStatus?ClientID=AB1234 HTTP/1.1
Authorization: Bearer {token}
Content-Type: application/json

Query Parameters:

  • ClientID → The client identifier for whom the exchange status is requested.

Example Response:

{
  "status": 200,
  "message": "Exchange status retrieved successfully",
  "data": [
    {
      "exchange": "NseCm",
      "isConnected": true,
      "session": "Open"
    },
    {
      "exchange": "MCX",
      "isConnected": false,
      "session": "Closed"
    }
  ]
}

Responses:

  • 200 OK – Exchange status retrieved successfully.
  • 400 Bad Request – Invalid request parameters.
  • 401 Unauthorized – Client not authorized.
  • 404 Not Found – No exchange status found.
  • 500 Internal Server Error – Unexpected failure.

Notes:

  • The exchange field represents the API identifier for exchanges.
  • isConnected = true means the exchange is live for trading.
  • session can be "Open", "Closed", or "Pre-Open".
path Parameters
version
required
string
query Parameters
ClientID
string

The unique client identifier requesting the exchange status.

Responses

Response samples

Content type
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": [
    ]
}

WebSockets

Connect

Establishes a WebSocket connection.

path Parameters
version
required
string
query Parameters
token
required
string

JWT token for authentication

ClientID
required
string

Client ID for authentication

Orders Packet

Receives real-time order packet.

Example Response Body:

{
  "eventType": "order",
  "data": {
    "exchange": "NseCm",
    "code": "3045",
    "symbol": "SBIN",
    "series": "EQ",
    "instrument": "EQUITIES",
    "strike_price": 0,
    "option_type": "",
    "client": "D5044",
    "user": "D5044",
    "settlor": "HDFC00000637",
    "api_source": "",
    "executing_id": "D5044",
    "generated_by": "IBT",
    "status": "Pending",
    "side": "Sell",
    "book": "RL",
    "product": "Normal",
    "validity": "Day",
    "price": 0,
    "trigger": 0,
    "average_fill_price": 0,
    "qty_remaining": 2,
    "qty_traded": 0,
    "disc_qty": 0,
    "flags": "Day, Market",
    "reason": "",
    "gtd": "",
    "client_entry_time": "2025-03-12T12:45:18",
    "entry_at": "2025-03-12T12:45:22",
    "last_modified": "2025-03-12T12:45:22",
    "exchange_order_no": "1300000000050895",
    "user_order_no": 12,
    "sender_order_no": 0,
    "auction_number": 0,
    "order_category": "Normal",
    "algol_id": 0
  }
}

Trades Packet

Receives real-time trade packet.

Example Response Body:

{
  "eventType": "trade",
  "data": {
    "exchange": "NseCm",
    "code": "3045",
    "symbol": "SBIN",
    "series": "EQ",
    "strike_price": 0,
    "option_type": "",
    "instrument": "EQUITIES",
    "client": "D5044",
    "user": "D5044",
    "generated_by": "IBT",
    "api_source": "",
    "side": "Sell",
    "traded_qty": 2,
    "traded_price": 727.15,
    "traded_value": 1454.3,
    "qty_remaining": 0,
    "qty_cumulative": 2,
    "trade_time": "4691-10-06T21:22:00",
    "product": "Normal",
    "order_category": "Normal",
    "order_book": "RL",
    "order_validity": "Day",
    "order_price": 727.15,
    "order_qty": 2,
    "order_trigger": 0,
    "average_fill_price": 727.15,
    "order_status": "Executed",
    "order_disc_qty": 0,
    "order_entry_at": "2025-03-12T12:45:22",
    "order_last_modified": "2025-03-12T12:45:22",
    "trade_no": "600027868",
    "exchange_order_no": "1300000000050895",
    "sender_order_no": 0,
    "user_order_no": 12,
    "algol_id": 0
  }
}