Get Order Margin Info
This API calculates the approximate margin required for a new or modified order before it is placed. Supports single-leg and multi-leg strategies.
🔑Header Parameters
| Header | Type | Required | Description | Example/ENUM |
|---|---|---|---|---|
| Authorization | string | Yes | Bearer token for authentication | Bearer access_token |
| x-api-key | string | Yes | API key for access control | x-api-key |
| Content-Type | string | Yes | Format of the request body | application/json |
📦Request Body Schema
📑 Request Body Parameters
| Field | Type | Required | Description | Example / Enum |
|---|---|---|---|---|
| NoOfLegs | integer | Yes | Number of legs in the order | 1, 2 |
| Mode | string | Yes | Calculation mode: "N" = New order, "M" = Modify order | "N", "M" |
| FETraceId | string | No | Optional trace ID echoed back in the response for tracking | "DEMO31_Sa212022190445" |
| MessageType | string | Yes | Request type: "FUND_UTIL_CALC_REQ" for span margin, "FUND_BASKET_UTIL_REQ" for basket/order cart | "FUND_UTIL_CALC_REQ" |
| LegDetails | array | Yes | Array of leg detail objects | Refer below |
🗂️Leg Details object Fields
| Field | Type | Required | Description | Example/ENUM |
|---|---|---|---|---|
| LegNo | integer | Yes | Leg number (positive integer) | 1, 2 |
| BuyOrSell | integer | Yes | Transaction type: 1 = Buy, 2 = Sell | 1 |
| MarketSegment | string | Yes | Exchange segments | "NSE_EQ" |
| Token | integer | Yes | Scrip token ID as per exchange master file (positive integer) | 12345 |
| Quantity | integer | Yes | Order quantity (positive integer) | 100 |
| Price | integer | Yes | Price in paise (1 INR = 100 paise), e.g. 100.05 INR = 10005 paise | 10005 |
| MktFlag | integer | No | Market order flag Possible values: 0 = No, 1 = Yes | 0 |
| OldPrice | integer | No | Previous price in paise (before modification) | 9500 |
| OldQuantity | integer | No | Previous quantity (before modification) | 50 |
| ProductType | string | Yes | Product type of the order | "M" |
| LegIndicator | integer | No | Custom indicator per leg | 1 |
Response Formats
- Standard Margin Response – Returns a single-token margin result.
- SpanMargin Response – Returns multi-leg margin details with a
LegDetailsbreakdown.
🟢Success Response - 200 Ok
| Field | Type | Description | Example/ENUM |
|---|---|---|---|
| status | string | Status of the API call | "success" |
| code | string | Response code | "s-101" |
| message | string | Success message | "Success" |
| data | object | Contains margin response details | See details below |
📦 data Object Fields
| Field | Type | Description | Example |
|---|---|---|---|
| status | integer | Internal status code: 200 = success | 200 |
| result | object | Margin calculation result | Refer below |
📘 Result Object Fields (Standard Response)
| Field | Type | Description | Example |
|---|---|---|---|
| Status | integer | Internal status: 1 = success | 1 |
| ClientId | string | UCC of the client | "APITEST" |
| ClientCode | string | Internal client code | "NWSYF" |
| Token | string | Combined token (format: "100002885" = 10000 prefix + token) | "100002885" |
| MarketSegmentId | string | Market segment ID as string | "521" |
| ApproxMargin | string | Approximate margin required in rupees | "385.78" |
| AvailableMargin | string | Available margin balance in rupees | "10000000000.00" |
| RequestTraceId | string | Echo-back of FETraceId or system-generated trace ID | "NWSYF1929281000" |
| ProductType | string | Product type code | "1" |
| ShortFall | string | Margin shortfall (rupees); "0.00" if no shortfall | "0.00" |
| Brokerage | string | Estimated brokerage in rupees | "0.00" |
📘 Result Object Fields (SpanMargin / Multi-leg Response)
All standard fields plus:
| Field | Type | Description | Example |
|---|---|---|---|
| SPAN/VAR | string | SPAN or VAR margin component | "0.56" |
| ExposureMargin | string | Exposure margin component | "0.00" |
| Total Premium Payable | string | Premium payable for options legs | "0.00" |
| Total Premium Receivable | string | Premium receivable for options legs | "0.00" |
| TotalMargin | string | Combined total margin required | "0.56" |
| Benefit | string | Hedge benefit applied | "0.00" |
| LegDetails | array | Per-leg margin breakdown | Refer below |
📘 LegDetails Array in Response
| Field | Type | Description | Example |
|---|---|---|---|
| Token | string | Scrip token for this leg | "2885" |
| MarketSegmentId | string | Market segment ID | "1" |
| InitialMargin | string | Initial margin for this leg | "0.28" |
| ExposureMargin | string | Exposure margin for this leg | "0.00" |
| PremiumPayable | string | Options premium payable | "0.00" |
| PremiumReceivable | string | Options premium receivable | "0.00" |
| TotalMargin | string | Total margin for this leg | "0.28" |