---
title: "POST /orders/txns/prepare"
method: POST
path: "/orders/txns/prepare"
tags: ["Order Transactions"]
---

# POST /orders/txns/prepare

`POST /orders/txns/prepare`

## Request body

- PrepareRequest
  - `subaccountApproval` RecordStringAny — Construct a type with a set of properties K of type T
  - `subaccountAddress` string
  - `from` string
  - `mode` 'express' | 'classic', required
  - `uiFeeReceiver` string
  - `referralCode` string
  - `autoCancel` boolean
  - `tpsl` object[]
    - `size` string
    - `triggerPrice` string, required
    - `type` 'take-profit' | 'stop-loss', required
  - `twapConfig` object
    - `frequency` number, double
    - `parts` number, double, required
    - `duration` number, double, required
  - `gasPaymentToken` string
  - `manualSwapPath` string[]
  - `keepLeverage` boolean
  - `receiveToken` string
  - `collateralToPay` object
    - `token` string, required
    - `amount` string, required
  - `executionFeeBufferBps` number, double
  - `acceptablePriceImpactBps` string
  - `slippage` number, double
  - `collateralToken` string
  - `triggerPrice` string
  - `size` string
  - `orderType` 'market' | 'limit' | 'stop-market' | 'take-profit' | 'stop-loss' | 'twap', required
  - `direction` 'long' | 'short'
  - `symbol` string
  - `kind` 'increase' | 'decrease' | 'swap', required

## Response `200`

Success

- PrepareResponse
  - `traceId` string
  - `validationWarnings` OrderValidationWarningResponse[]
    - union
      - object
        - `details` object, required
          - `marketDataStatus` 'fresh' | 'stale', required
          - `jitDataStatus` 'available' | 'stale' | 'unavailable', required
          - `limitingFactor` 'reserve' | 'openInterest' | 'both' | 'notApplicable', required
          - `jitAvailableLiquidity` string, required
          - `baseAvailableLiquidity` string, required
          - `availableLiquidity` string, required
          - `requestedSizeUsd` string, required
        - `message` string, required
        - `code` 'INSUFFICIENT_LIQUIDITY', required
      - object
        - `details` object, required
          - `reason` 'STALE_MARKET_DATA' | 'JIT_DATA_UNAVAILABLE' | 'JIT_ACCOUNT_ELIGIBILITY_UNKNOWN' | 'COLLATERAL_SWAP', required
        - `message` string, required
        - `code` 'TRADING_CAPACITY_UNAVAILABLE', required
  - `warnings` string[]
  - `expiresAt` number, double
  - `estimates` object
    - `tradingCapacity` TradingCapacityResponse
      - `marketDataStatus` 'fresh' | 'stale', required
      - `jitDataStatus` 'available' | 'stale' | 'unavailable', required
      - `limitingFactor` 'reserve' | 'openInterest' | 'both' | 'notApplicable', required
      - `jitAvailableLiquidity` string, required
      - `baseAvailableLiquidity` string, required
      - `availableLiquidity` string, required
    - `fundingFeeUsd` string, required
    - `borrowingFeeUsd` string, required
    - `positionFeeUsd` string, required
    - `sizeDeltaUsd` string, required
    - `acceptablePrice` string, required
    - `executionFeeAmount` string, required
    - `swapPriceImpactDeltaUsd` string, required
    - `positionPriceImpactDeltaUsd` string, required
  - `payload` RecordStringAny, required — Construct a type with a set of properties K of type T
  - `requestId` string, required
  - `mode` 'express' | 'classic', required
  - `payloadType` 'transaction' | 'typed-data', required

## Other responses

- `400` — Bad Request
- `429` — Too Many Requests
- `500` — Internal Server Error

## Changes

- **2026-08-25** `4455f6c22f99` — 4 info
  - added the media type `application/json` for the response with the status `400`
  - added the non-success response with the status `429`
  - added the optional property `estimates/tradingCapacity` to the response with the `200` status
  - added the optional property `validationWarnings` to the response with the `200` status

[Change history](https://skmtc.dev/gmx/apis/gmx-io-gmx-public-api/changes/orders/txns/prepare/post.md)

---

[API](https://skmtc.dev/gmx/apis/gmx-io-gmx-public-api.md) · [All operations](https://skmtc.dev/gmx/apis/gmx-io-gmx-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gmx/gmx-io-gmx-public-api/revisions/4455f6c22f99/schema)
