# Order Margin

## POST /api/oms/margin

Order Margin

to get the margin required and available margin info while placing an order

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| Authorization | header | string | Yes | Access token in the following format:  Bearer <api_key>:<access_token>  Both values are required. The `api_key` is your app credential from the Apps Section. The `access_token` is obtained from the authentication endpoint and is valid for 24 hours. |

### Request Body (application/x-www-form-urlencoded)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| symId | string | Yes | Unique identifier of the symbol |
| qty | number | Yes | 'qty' is number of shares for which required margin, for modification order 'qty' should be 'fillQty' + 'modified qty' |
| side | string ("buy" | "sell") | Yes | Order side 'buy' or 'sell' |
| type | string ("limit" | "market" | "stoplimit" | "stopmarket") | Yes | Price type of an order |
| product | string ("delivery" | "intraday" | "normal" | "bracket" | "cover") | Yes | Product type of an order. 'delivery' is applicable for equities. 'normal' is applicable for derivatives. 'intraday' is applicable for both equity and derivatives |
| limitPrice | number | No | This is required only for limit and stop limit orders |
| trigPrice | number | No | This is required only for stoploss limit and stoploss market orders |
| stopTrigPrice | number | No | Stop loss leg order trigger price. |
| orgQty | number | No | Original quantity is applicable for modification order, original quantity is 'qty' from orderbook |
| orgLimitPrice | number | No | Original limit price is applicable for modification order, original limit price is limit price from orderbook |
| orgTrigPrice | number | No | Original trigger price is applicable for modification order, original trigger price is trigger price from orderbook |
| orgStopTrigPrice | number | No | Original stop loss price is applicable only for Cover and Bracket order modification, original stop loss price is stop loss price from orderbook. |
| fillQty | number | No | fillQty is partially filled quantity, fillQty is 'fillQty' from orderbook. |
| orderId | string | No | Order id is applicable for bracket and cover order modification |
| mainLegOrderId | string | No | Mainleg order id field is applicable for bracket and cover order |

### Responses

#### 200 — OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| s | string ("ok" | "no-data" | "error") | No |  |
| d | object | No |  |
| d.availableMargin | number | No | Available margin to trade |
| d.requiredMargin | number | No | Required margin to trade |
| d.shortfall | number | No |  |
| d.holdQty | number | No | This is applicable only for SELL order of Equity ( Delivery ) |
| d.remarks | string | No | Remarks is applicable for failure cases |
| d.edisAuthRequired | boolean | No | 'edisAuthEnabled' flag should be consume in case of edis navigation |
| msg | string ("no-data" | "error msg") | No |  |
| s | string ("ok" | "error" | "no-data") | No |  |

#### 400 — Bad Request

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| s | string ("error") | No | Response status. Always `error` for error responses. |
| msg | string ("Internal Error occurred. Kindly try again." | "Input validation failed. Kindly check your input contains required fields for the request") | No | Error message describing which field failed validation or why the request was rejected. |

#### 401 — Unauthorized — one of: (1) invalid or expired access token — tokens expire after 24 hours, re-authenticate to get a new one; (2) `Authorization` header missing or malformed — use format `Bearer <api_key>:<access_token>`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| s | string ("error") | No | Response status. Always `error` for error responses. |
| msg | string ("Unauthorized") | No | Error message. |

#### 429 — Too Many Requests — rate limit exceeded. General API: 10 req/sec per auth token (400 req/min).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| s | string ("error") | No | Response status. Always `error` for error responses. |
| msg | string | No | Error message indicating the rate limit was exceeded. |

#### 500 — Internal Server Error — retry with backoff; contact support if it persists.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| s | string ("error") | No | Response status. Always `error` for error responses. |
| msg | string | No | Error message. |