---
title: "Get margin rules"
description: "Get one instrument's margin rules (maximum position size and risk brackets)."
---

| | |
|---|---|
| SDK | `client.get_margin_rules(...)` |
| HTTP | `POST https://market-data.<domain>/full/v1/margin_rules`, or `/lite/v1/margin_rules` for [lite names](../../guides/environments.md#encoding-full-or-lite) (the SDKs' default) |
| WebSocket | method `v1/margin_rules` on `wss://market-data.<domain>/ws/full`, or `/ws/lite` for lite names |
| Auth | None (public) |
| Retries | Read: the SDKs retry retryable errors ([rules](../../guides/errors-and-retries.md)) |
| Contract id | `instrument.get_margin_rules` (`RPCGetMarginRulesV1`) |

## Request

Body type `ApiGetMarginRulesRequest`. Fields the server fills are left out.

- `instrument` · lite `i` · string (instrument name) · required — The instrument to query margin rules for

## Response

Body type `ApiGetMarginRulesResponse` (the same object is the JSON-RPC `result` over WebSocket).

- `instrument` · lite `i` · string (instrument name) · required — The instrument name
- `max_position_size` · lite `mp` · string · required — The maximum position size. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
- `risk_brackets` · lite `rb` · object RiskBracket[] · required — List of risk brackets defining margin requirements at different notional tiers
- `risk_brackets[].tier` · lite `t` · integer (uint32) · required — 1-indexed tier number
- `risk_brackets[].notional_floor` · lite `nf` · string · required — Lower bound of notional value (inclusive) in quote currency
- `risk_brackets[].notional_cap` · lite `nc` · string · optional — Upper bound of notional value (exclusive) in quote currency, omitted for last tier
- `risk_brackets[].maintenance_margin_rate` · lite `mm` · string · required — Maintenance margin rate as a decimal (e.g., '0.01' for 1%)
- `risk_brackets[].initial_margin_rate` · lite `im` · string · required — Initial margin rate as a decimal (e.g., '0.02' for 2%)
- `risk_brackets[].max_leverage` · lite `ml` · integer (uint32) · required — Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate)
- `risk_brackets[].cumulative_maintenance_amount` · lite `cm` · string · required — Cumulative maintenance margin amount in quote currency

## Errors

Errors come back as `{"code", "message", "status"}` (lite `{"c", "m", "s"}`) with the HTTP status. Codes this call can return, as code, name (HTTP status) ([all error codes](../errors.md)):

`1002` InternalServer (500) · `1003` InvalidRequest (400) · `1004` NotFound (404) · `1006` RateLimit (429, retryable) · `3000` InvalidInstrument (400)

## Example

```python
from grvt import Grvt

with Grvt(env="testnet") as client:
    resp = client.get_margin_rules(
        instrument="BTC_USDT_Perp",
    )
    print(resp)
```

Raw HTTP (set `GRVT_DOMAIN`, see [Environments](../../guides/environments.md)):

With full field names:

```sh
curl -sS "https://market-data.$GRVT_DOMAIN/full/v1/margin_rules" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "instrument": "BTC_USDT_Perp"
}
EOF
```

With lite field names:

```sh
curl -sS "https://market-data.$GRVT_DOMAIN/lite/v1/margin_rules" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "i": "BTC_USDT_Perp"
}
EOF
```
