---
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
  - `warnings` string[]
  - `expiresAt` number, double
  - `estimates` object
    - `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
- `500` — Internal Server Error

---

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