GET ORDER MARGIN INFO
This API retrieves margin requirements for one or more order legs for authorized end users through a middleware-based integration.
It can be used to calculate approximate margin, available margin, brokerage, and margin shortfall before placing or modifying an order.
| Fields | Type | Required | Description | Example |
|---|
| Content-Type | string | Yes | Request payload format | application/json |
| Authorization | string | Yes | Bearer token for authentication | access_token |
| x-api-key | string | Yes | API key provided | x-api-key |
📦 Request Body Schema
| 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
| Fields | Type | Required | Description | Example/Enum |
|---|
| LegNo | integer | Yes | Leg number | 1 |
| BuyOrSell | integer | Yes | Transaction type | 1 |
| MarketSegmentId | integer | Yes | Exchange Segment ID | 2 |
| Token | integer | Yes | Scrip token | 56838 |
| Quantity | integer | Yes | Order quantity | 50 |
| Price | integer | Yes | Order price in paise | 250000 |
| MktFlag | integer | Yes | Market order flag | 0 |
| OldPrice | integer | No | Previous order price in paise (for order modification) | 240000 |
| OldQuantity | integer | No | Previous order quantity (for order modification) | 25 |
| ProductType | string | Yes | Product type | M |
| LegIndicator | integer | No | Leg Indicator | 1 |
🟢 Success Response - 200 OK
| Fields | Type | Description | Example |
|---|
| status | string | Status of API call | "success" |
| code | string | Response code | "s-101" |
| message | string | Success message | "Margin calculated successfully" |
| data | object | Order margin details | See below table |
📘 Data Object Fields
| Fields | Type | Description | Example |
|---|
| status | integer | Margin request status code | 0 |
| result | object | Margin calculation result | See below table |
📘 Result Object Fields
| Fields | Type | Description | Example |
|---|
| MarketSegmentId | string | Exchange Segment ID | "2" |
| Token | string | Scrip token | "56838" |
| ApproxMargin | string | Approximate margin required | "125000" |
| AvailableMargin | string | Available margin | "450000" |
| RequestTraceId | string | Echo-back request identifier | "MARGIN12345" |
| ProductType | string | Product type | "M" |
| ShortFall | string | Margin shortfall amount | "0" |
| Brokerage | string | Brokerage amount | "25" |
📝 Notes
- Used to calculate margin requirements before placing or modifying an order.
- Supports single-leg and multi-leg margin calculations.
Mode = N should be used for fresh orders.
Mode = M should be used when calculating margin impact for order modifications.