---
title: "Preview Margin Order Impact"
method: POST
path: "/v1/margin/order/preview"
tags: ["Margin Trading"]
---

# Preview Margin Order Impact

`POST /v1/margin/order/preview`

## Request

- Base URL: `https://api.gemini.com`
- URL: `https://api.gemini.com/v1/margin/order/preview`
- Auth: API key in header `X-GEMINI-APIKEY` and API key in header `X-GEMINI-SIGNATURE` and API key in header `X-GEMINI-PAYLOAD`

Previews the margin impact of a hypothetical spot order without actually placing it.

Returns both pre-order and post-order margin risk statistics, allowing you to understand how an order would affect your margin account before execution. This is useful for risk management and planning trades.

### Roles
The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

### Account Type
This endpoint is only available for margin trading accounts.

## Headers

- `X-GEMINI-APIKEY` string, required
- `X-GEMINI-SIGNATURE` string, required
- `X-GEMINI-PAYLOAD` string, required
- `Content-Type` string
- `Content-Length` string
- `Cache-Control` string

## Request body

- object
  - `request` string, required: The literal string "/v1/margin/order/preview"
  - `nonce` union, required: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
    - union: timestamp
      - string: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------|-----------------------|------------------------| | string (seconds) | `1495127793` | `POST` only | | string (milliseconds) | `1495127793000` | `POST` only |
      - integer: Gemini strongly recommends using milliseconds instead of seconds for timestamps. | Timestamp format | Example | Supported request type | |-----------------------------|---------------------------|------------------------| | whole number (seconds) | `1495127793` | `GET`, `POST` | | whole number (milliseconds) | `1495127793000` | `GET`, `POST` |
    - integer
  - `symbol` string, required: The trading pair symbol (e.g., "btcusd")
  - `side` 'buy' | 'sell', required: The order side
  - `type` 'market' | 'limit', required: The order type
  - `amount` string, decimal: The order amount in base currency (required for limit orders and sell market orders)
  - `price` string, decimal: The limit price (required for limit orders)
  - `totalSpend` string, decimal: Total spend in quote currency (required for buy market orders)
  - `account` string: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group.

## Response `200`

Pre-order and post-order margin risk statistics

- MarginOrderPreview
  - `preorder` MarginRiskStats, required
    - `marginAssetValue` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `availableCollateral` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `notionalValue` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `totalBorrowed` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `leverage` string, decimal, required: The leverage ratio
    - `reservedBuyOrders` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `reservedSellOrders` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `buyingPower` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `sellingPower` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `liquidationRisk` LiquidationRisk
      - `lossPercentage` string, decimal, required: The percentage loss from current value that would trigger liquidation, formatted as decimal (e.g., "0.1550" = 15.50%)
      - `liquidationPrice` MoneyAmount
        - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
        - `value` string, decimal, required: The amount in the specified currency
  - `postorder` MarginRiskStats, required
    - `marginAssetValue` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `availableCollateral` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `notionalValue` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `totalBorrowed` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `leverage` string, decimal, required: The leverage ratio
    - `reservedBuyOrders` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `reservedSellOrders` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `buyingPower` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `sellingPower` MoneyAmount, required
      - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
      - `value` string, decimal, required: The amount in the specified currency
    - `liquidationRisk` LiquidationRisk
      - `lossPercentage` string, decimal, required: The percentage loss from current value that would trigger liquidation, formatted as decimal (e.g., "0.1550" = 15.50%)
      - `liquidationPrice` MoneyAmount
        - `currency` string, required: The currency code (e.g., "USD", "BTC", "ETH")
        - `value` string, decimal, required: The amount in the specified currency

## Other responses

- `400`: Bad request - malformed request or invalid parameters
- `401`: Unauthorized - missing or invalid authentication
- `403`: ApiKey fails IP Filtering Check
- `404`: Resource not found
- `429`: Too many requests - you have exceeded the rate limit
- `500`: Internal server error

---

[API](https://skmtc.dev/gemini/apis/rest-api.md) - [All operations](https://skmtc.dev/gemini/apis/rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gemini/apis/rest-api/revisions/24979792d748?raw)
