> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raze.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a perp operation

> The instructions of one perp operation, as ONE transaction for `wallet` to sign, and with
`serialize: true` the unsigned transaction itself. Nothing is signed, sent or reserved.

The same body works on both venues; only `marketId` changes. The operations:

| `op` | What it does | Jupiter | GMTrade |
|---|---|---|---|
| `open` | Open or increase a position at market | yes | yes |
| `limit` | Open at a trigger price (long below the mark, short above) | `422 venue_form` | yes |
| `close` | Reduce or close at market (`closeBps`, default all) | yes, paid out in USDC | yes, paid out in the position's collateral |
| `tpsl` | Resting take profit (`tp`) or stop loss (`sl`) on a position | yes, paid out in USDC | yes, paid out in the position's collateral |
| `update` | Move the trigger or the size of a resting order | `422 venue_form` (cancel, then `tpsl`) | yes |
| `cancel` | Cancel a request or pending order (`orderId`) | yes, 45 s after it was created | yes, while pending |
| `deposit` | Add collateral to a position (`amountUsd`) | yes | yes |
| `withdraw` | Remove collateral from a position (`amountUsd`) | yes, paid out in USDC | yes, in the position's collateral |

The transaction is, in order: a memo `dad-perp:<op>:<clientOrderId>` signed by the wallet, the
funding route (if any), then the venue's instructions (token accounts created idempotently,
native SOL wrapped before and unwrapped after, GMTrade's user and position accounts when
missing, the order). It is a **v1** transaction
(4 096 bytes, 64 instructions, 64 accounts, no lookup tables): compute limits are in its
message, not in `instructions`.

**Keeper execution.** Landing this transaction queues the operation; the venue's keeper executes
it later (`venueForm` says how). On Jupiter a market request lives seconds and can be cancelled
45 s after its creation; on GMTrade an order can be cancelled while it is pending, and each
order escrows a 300 000-lamport execution fee for the keeper, returned by `cancel`.

**`clientOrderId` is not an idempotency key.** It derives the address of the request/order,
so a retry of the same `(op, clientOrderId)` fails while the first one is still pending, but
acts a second time once the keeper has executed it. Check whether the first transaction landed
before retrying.

Wallet accounts (positions, the GMTrade user account, the order named by `orderId`) are read
from the chain at every call.


Which fields each operation needs, and which venue supports which: [Perps](/router/perps#operations).


## OpenAPI

````yaml perp.openapi.yaml POST /perp/instructions
openapi: 3.1.0
info:
  title: Raze Router Perps API
  version: 1.0.0
  description: >
    Perpetual futures on Solana through the router: live markets, quotes,
    unsigned

    transactions and the live state of a wallet, on **Jupiter Perps**
    (`jupiter`) and **GMTrade**

    (gmsol / GMX-Solana, `gmtrade`).


    **The router never signs and never sends.** `POST /perp/instructions`
    returns the instructions

    and, on request, the serialized unsigned transaction; your backend has the
    wallet sign it and

    broadcasts it.


    **One operation, one transaction.** The collateral deposit travels in the
    same transaction as the

    order, and when the wallet pays with another token (`fundingMint`) an
    exact-out swap route into the

    collateral mint is placed in front of the venue instruction, in that same
    transaction.


    **Execution is asynchronous on both venues.** The transaction creates a
    request (Jupiter) or an

    order (GMTrade); the venue's keeper executes it afterwards in its own
    transaction, at its own

    oracle price. Watch `GET /perp/account` (or the chain) to see the fill.


    **Conventions, everywhere:**

    - Perps are off until you enable them: `ROUTER_PERP=jupiter,gmtrade` (or
    `all`) in the router's
      environment. A venue that is off answers `422 venue_disabled`.
    - Market ids are `<venue>:<SYMBOL>-PERP`, e.g. `jupiter:SOL-PERP`,
    `gmtrade:SOL-WSOL-USDC-PERP`.
      Case-insensitive; `-PERP` is optional; `jup:`, `gmsol:` and `gm:` are accepted as aliases.
    - USD amounts are integers in micro-USD: fields ending in `Usd` (requests)
    and `UsdE6`
      (responses), so `10000000` is $10.
    - Prices are integers, USD per whole token × 10^6 (`priceE6`,
    `triggerPriceE6`).

    - Leverage and shares are basis points: `leverageBps` 20000 = 2x, `closeBps`
    10000 = all.

    - Token amounts (`collateralAmount`, `amountIn`…) are raw base units of the
    mint.

    - Amounts and prices are JSON integers (send them as numbers, not strings).
    A response field
      that does not apply is omitted, except in `/perp/account` where an unknown value is `null`.
    - Times are Unix **seconds**.

    - Failure: `{"error": "<label>", "reason": "<text>", "quoteId": "<id>"}`.
    The status says whose
      fault it is: 400 the request, 409 re-quote, 422 a named decline, 503 the router or the chain.
      A body over 256 KiB is refused with 413; an unknown route answers 404 `not_found`.

    **On `https://router.raze.bot` perps are not enabled:** `GET /perp/markets`
    lists no venue and

    every operation answers `422 venue_disabled`. They work on a router of your
    own with

    `ROUTER_PERP` set.


    **No authentication.** A router you run yourself listens on loopback
    (`ROUTER_LISTEN`, default

    `127.0.0.1:4700`) and trusts its caller; put your own auth in front of it if
    you expose it.
servers:
  - url: https://router.raze.bot
    description: Raze's public router (perps not enabled)
  - url: http://127.0.0.1:4700
    description: Your own router (default ROUTER_LISTEN)
security: []
tags:
  - name: markets
    description: Live perp markets per venue
  - name: trading
    description: Quotes and unsigned transactions for every perp operation
  - name: account
    description: Live positions and resting orders of a wallet
paths:
  /perp/instructions:
    post:
      tags:
        - trading
      summary: Build a perp operation
      description: >
        The instructions of one perp operation, as ONE transaction for `wallet`
        to sign, and with

        `serialize: true` the unsigned transaction itself. Nothing is signed,
        sent or reserved.


        The same body works on both venues; only `marketId` changes. The
        operations:


        | `op` | What it does | Jupiter | GMTrade |

        |---|---|---|---|

        | `open` | Open or increase a position at market | yes | yes |

        | `limit` | Open at a trigger price (long below the mark, short above) |
        `422 venue_form` | yes |

        | `close` | Reduce or close at market (`closeBps`, default all) | yes,
        paid out in USDC | yes, paid out in the position's collateral |

        | `tpsl` | Resting take profit (`tp`) or stop loss (`sl`) on a position
        | yes, paid out in USDC | yes, paid out in the position's collateral |

        | `update` | Move the trigger or the size of a resting order | `422
        venue_form` (cancel, then `tpsl`) | yes |

        | `cancel` | Cancel a request or pending order (`orderId`) | yes, 45 s
        after it was created | yes, while pending |

        | `deposit` | Add collateral to a position (`amountUsd`) | yes | yes |

        | `withdraw` | Remove collateral from a position (`amountUsd`) | yes,
        paid out in USDC | yes, in the position's collateral |


        The transaction is, in order: a memo `dad-perp:<op>:<clientOrderId>`
        signed by the wallet, the

        funding route (if any), then the venue's instructions (token accounts
        created idempotently,

        native SOL wrapped before and unwrapped after, GMTrade's user and
        position accounts when

        missing, the order). It is a **v1** transaction

        (4 096 bytes, 64 instructions, 64 accounts, no lookup tables): compute
        limits are in its

        message, not in `instructions`.


        **Keeper execution.** Landing this transaction queues the operation; the
        venue's keeper executes

        it later (`venueForm` says how). On Jupiter a market request lives
        seconds and can be cancelled

        45 s after its creation; on GMTrade an order can be cancelled while it
        is pending, and each

        order escrows a 300 000-lamport execution fee for the keeper, returned
        by `cancel`.


        **`clientOrderId` is not an idempotency key.** It derives the address of
        the request/order,

        so a retry of the same `(op, clientOrderId)` fails while the first one
        is still pending, but

        acts a second time once the keeper has executed it. Check whether the
        first transaction landed

        before retrying.


        Wallet accounts (positions, the GMTrade user account, the order named by
        `orderId`) are read

        from the chain at every call.
      operationId: buildPerpInstructions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InstructionsRequest'
            examples:
              open:
                summary: open, Jupiter long SOL, serialized
                value:
                  wallet: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                  op: open
                  marketId: jupiter:SOL-PERP
                  side: long
                  clientOrderId: doc-open-1
                  collateralUsd: 25000000
                  leverageBps: 30000
                  serialize: true
              openNative:
                summary: open, paid in native SOL
                value:
                  wallet: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                  op: open
                  marketId: jupiter:SOL-PERP
                  side: long
                  clientOrderId: doc-open-2
                  collateralUsd: 25000000
                  leverageBps: 30000
                  fundingMint: SOL
              openGmtrade:
                summary: open, GMTrade, first order of the wallet
                value:
                  wallet: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                  op: open
                  marketId: gmtrade:SOL-USDC-USDC-PERP
                  side: long
                  clientOrderId: doc-gm-open-1
                  collateralUsd: 25000000
                  leverageBps: 50000
                  serialize: true
              limit:
                summary: limit, GMTrade short SOL at $130
                value:
                  wallet: bJx6noQaPDTCQ2vxn2dMX1nYbTKhgprcj3bfAvYemky
                  op: limit
                  marketId: gmtrade:SOL-USDC-USDC-PERP
                  side: short
                  clientOrderId: doc-gm-lim-1
                  collateralUsd: 25000000
                  leverageBps: 50000
                  triggerPriceE6: 130000000
              close:
                summary: close half of a position
                value:
                  wallet: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                  op: close
                  marketId: jupiter:SOL-PERP
                  side: long
                  clientOrderId: doc-close-1
                  closeBps: 5000
                  serialize: true
              tpsl:
                summary: tpsl, stop loss at $125 on a short
                value:
                  wallet: 3yrYgLhLRa9G2tsmMHecPXk2iY1Ks1rhsLEeYEbasGif
                  op: tpsl
                  marketId: jupiter:SOL-PERP
                  side: short
                  clientOrderId: doc-sl-1
                  trigger: sl
                  triggerPriceE6: 125000000
              update:
                summary: update, move a GMTrade limit to $89 000
                value:
                  wallet: bJx6noQaPDTCQ2vxn2dMX1nYbTKhgprcj3bfAvYemky
                  op: update
                  marketId: gmtrade:BTC-USDC-USDC-PERP
                  side: short
                  clientOrderId: doc-gm-upd-1
                  orderId: 3Wz7PMY9NDFnMyXwjXG4bC4iojvTeHdyGfqnZ8DPnpVo
                  triggerPriceE6: 89000000000
              cancel:
                summary: cancel a Jupiter request
                value:
                  wallet: 4sKjF436KAHyZQFCCuHCx4UhrMBKGmUtA2ZT9bg7voPC
                  op: cancel
                  marketId: jupiter:SOL-PERP
                  side: long
                  clientOrderId: doc-cancel-1
                  orderId: 7ULCZGPipZWdfn1ELE1Qbd867rR9WD6cxeoxosbzEGzT
              deposit:
                summary: deposit $10 of collateral
                value:
                  wallet: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                  op: deposit
                  marketId: jupiter:ETH-PERP
                  side: long
                  clientOrderId: doc-dep-1
                  amountUsd: 10000000
              withdraw:
                summary: withdraw $10 of collateral
                value:
                  wallet: bJx6noQaPDTCQ2vxn2dMX1nYbTKhgprcj3bfAvYemky
                  op: withdraw
                  marketId: gmtrade:BTC-USDC-USDC-PERP
                  side: short
                  clientOrderId: doc-gm-wd-1
                  amountUsd: 10000000
      responses:
        '200':
          description: The operation, its accounts and its transaction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstructionsResponse'
              examples:
                open:
                  summary: open on Jupiter, serialized
                  value:
                    quoteId: 94c3676a00000016
                    buildId: cdc33084209b52e0a7f7ff3c54bc603f
                    op: open
                    marketId: jupiter:SOL-PERP
                    venue: jupiter
                    side: long
                    atomic:
                      funding: false
                      deposit: true
                      register: false
                    detail:
                      account: 8TAdVT4B9jR6z6gnRKzCJ1ZsWvrNGGy1TZ7ZbKE9yqUu
                      request: 9949qyXjDWccT5o3xkaNgBMPHsDXSHnKVJiKRb74kfzf
                      counter: 5333879070272630000
                    computeUnits: 300000
                    loadedAccountsDataSize: 10852242
                    txVersion: v1
                    instructions:
                      - accounts:
                          - isSigner: true
                            isWritable: false
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                        data: ZGFkLXBlcnA6b3Blbjpkb2Mtb3Blbi0x
                        programId: MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                          - isSigner: false
                            isWritable: false
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: false
                            pubkey: So11111111111111111111111111111111111111112
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        data: AQ==
                        programId: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                          - isSigner: false
                            isWritable: false
                            pubkey: H4ND9aYttUVLFmNypZqLjZ52FYiGvdEB45GmwNoKEjTj
                          - isSigner: false
                            isWritable: false
                            pubkey: 5BUwFW4nRbftYTDMbgxykoFWqWHPzahFSNAaaaJtVKsq
                          - isSigner: false
                            isWritable: true
                            pubkey: 8TAdVT4B9jR6z6gnRKzCJ1ZsWvrNGGy1TZ7ZbKE9yqUu
                          - isSigner: false
                            isWritable: true
                            pubkey: 9949qyXjDWccT5o3xkaNgBMPHsDXSHnKVJiKRb74kfzf
                          - isSigner: false
                            isWritable: true
                            pubkey: 9gXuSKGcHQhHJXZCXxoxGY5BPV5dJ7HtmDVHPDSFECfc
                          - isSigner: false
                            isWritable: false
                            pubkey: 7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz
                          - isSigner: false
                            isWritable: false
                            pubkey: 7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz
                          - isSigner: false
                            isWritable: false
                            pubkey: So11111111111111111111111111111111111111112
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                          - isSigner: false
                            isWritable: false
                            pubkey: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: 37hJBDnntwqhGbK7L6M1bLyvccj4u55CCUiLPdYkiqBN
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                        data: >-
                          uFXHGGmrnDjAaHgEAAAAAN/IrgwAAAAAARS+CQcAAAAAAKusfRrBvgVK
                        programId: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                    addressLookupTableAddresses: []
                    transaction: gQEACgwAAAAUAMYb70MYZoCQ…
                    lastValidBlockHeight: 430450388
                    quote:
                      mark:
                        priceE6: 117491539
                        slot: 452411405
                        publishTime: 1790890924
                        source: doves
                      collateralMint: So11111111111111111111111111111111111111112
                      collateralAmount: 212781279
                      collateralUsdE6: 25000000
                      notionalUsdE6: 75000000
                      leverageBps: 30000
                      initialMarginUsdE6: 25000000
                      feeUsdE6: 45000
                      estLiquidationE6: 79036558
                    venueForm: >-
                      keeper: the request lands now, the keeper executes it;
                      cancellable after 45s
                openNative:
                  summary: open paid in native SOL (wrap before, unwrap after)
                  value:
                    quoteId: 94c3676a00000017
                    buildId: 0150f081be6cc0d98470f5c4cec21b9d
                    op: open
                    marketId: jupiter:SOL-PERP
                    venue: jupiter
                    side: long
                    atomic:
                      funding: false
                      deposit: true
                      register: false
                    detail:
                      account: 8TAdVT4B9jR6z6gnRKzCJ1ZsWvrNGGy1TZ7ZbKE9yqUu
                      request: ERZ5EYAVxDfiJ3H8729gbr7VetQopmdwRaATdY3KgQ1i
                      counter: 7327130259694757000
                    computeUnits: 300000
                    loadedAccountsDataSize: 10852242
                    txVersion: v1
                    instructions:
                      - accounts:
                          - isSigner: true
                            isWritable: false
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                        data: ZGFkLXBlcnA6b3Blbjpkb2Mtb3Blbi0y
                        programId: MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                          - isSigner: false
                            isWritable: false
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: false
                            pubkey: So11111111111111111111111111111111111111112
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        data: AQ==
                        programId: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                        data: AgAAAN/IrgwAAAAA
                        programId: '11111111111111111111111111111111'
                      - accounts:
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                        data: EQ==
                        programId: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                          - isSigner: false
                            isWritable: false
                            pubkey: H4ND9aYttUVLFmNypZqLjZ52FYiGvdEB45GmwNoKEjTj
                          - isSigner: false
                            isWritable: false
                            pubkey: 5BUwFW4nRbftYTDMbgxykoFWqWHPzahFSNAaaaJtVKsq
                          - isSigner: false
                            isWritable: true
                            pubkey: 8TAdVT4B9jR6z6gnRKzCJ1ZsWvrNGGy1TZ7ZbKE9yqUu
                          - isSigner: false
                            isWritable: true
                            pubkey: ERZ5EYAVxDfiJ3H8729gbr7VetQopmdwRaATdY3KgQ1i
                          - isSigner: false
                            isWritable: true
                            pubkey: 8TkHu6M6c7Nt9R9sgPzVtp5qRK6a71JVFTDTSh5uQXsk
                          - isSigner: false
                            isWritable: false
                            pubkey: 7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz
                          - isSigner: false
                            isWritable: false
                            pubkey: 7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz
                          - isSigner: false
                            isWritable: false
                            pubkey: So11111111111111111111111111111111111111112
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                          - isSigner: false
                            isWritable: false
                            pubkey: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: 37hJBDnntwqhGbK7L6M1bLyvccj4u55CCUiLPdYkiqBN
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                        data: >-
                          uFXHGGmrnDjAaHgEAAAAAN/IrgwAAAAAARS+CQcAAAAAAI0jH4AmMq9l
                        programId: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                      - accounts:
                          - isSigner: false
                            isWritable: true
                            pubkey: jTtzz4pMLoG4YpfbLmmXWxhbWMDFdqE2UPLAiKVJAEs
                          - isSigner: false
                            isWritable: true
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                          - isSigner: true
                            isWritable: false
                            pubkey: CqChmhst66ZW8jkwWcXS3BmDt577dVHNSyv8QbSb8FiX
                        data: CQ==
                        programId: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                    addressLookupTableAddresses: []
                    quote:
                      mark:
                        priceE6: 117491539
                        slot: 452411405
                        publishTime: 1790890924
                        source: doves
                      collateralMint: So11111111111111111111111111111111111111112
                      collateralAmount: 212781279
                      collateralUsdE6: 25000000
                      notionalUsdE6: 75000000
                      leverageBps: 30000
                      initialMarginUsdE6: 25000000
                      feeUsdE6: 45000
                      estLiquidationE6: 79036558
                    venueForm: >-
                      keeper: the request lands now, the keeper executes it;
                      cancellable after 45s
                openGmtrade:
                  summary: >-
                    open on GMTrade for a wallet without a GMTrade account
                    (register)
                  value:
                    quoteId: 38a66df90000000e
                    buildId: 6de46e0779b21e812e5044b9d7922997
                    op: open
                    marketId: gmtrade:SOL-USDC-USDC-PERP
                    venue: gmtrade
                    side: long
                    atomic:
                      funding: false
                      deposit: true
                      register: true
                    detail:
                      account: BHbaZeASZMYSgC16HJeDFz44yLC5yw8WwiXEsNFCTjf
                      request: CWauEmZF7MbhUdekToBez2suvtX8Ri9pehcFo4RVvAqo
                    computeUnits: 400000
                    loadedAccountsDataSize: 4726071
                    txVersion: v1
                    instructions:
                      - accounts:
                          - isSigner: true
                            isWritable: false
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                        data: ZGFkLXBlcnA6b3Blbjpkb2MtZ20tb3Blbi0x
                        programId: MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: true
                            pubkey: 4YHW2KzwHjvrBUmdYRqRgu6cDQCk9TTNaofqmbmtc2cH
                          - isSigner: false
                            isWritable: false
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        data: AQ==
                        programId: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: false
                            pubkey: CTDLvGGXnoxvqLyTpGzdGLg9pD6JexKxKXSV8tqqo8bN
                          - isSigner: false
                            isWritable: true
                            pubkey: 5APUrXrtLA2r9pxgpNv5si1yEq9ruV3kH4bT52EQCNpJ
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                        data: vq2PwYtQ54U=
                        programId: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: false
                            pubkey: CTDLvGGXnoxvqLyTpGzdGLg9pD6JexKxKXSV8tqqo8bN
                          - isSigner: false
                            isWritable: false
                            pubkey: CJg17Dn4xgUyEW3gKSSyteNw7LhP1o9pzm9eLtvuNjkQ
                          - isSigner: false
                            isWritable: true
                            pubkey: BHbaZeASZMYSgC16HJeDFz44yLC5yw8WwiXEsNFCTjf
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                        data: >-
                          stc3WokPbA8DAOCTBAAAAAAAAFp8fQEAAAAAAADQXin8WKClAgAAAAAAAAEBAAABgJHT5LwKAAAAAAAAAAAAAAAA
                        programId: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: true
                            pubkey: 23exo98UP38RTmLENmu6GbLWqBzYNCpzZn8w2L7toQMR
                          - isSigner: false
                            isWritable: false
                            pubkey: CWauEmZF7MbhUdekToBez2suvtX8Ri9pehcFo4RVvAqo
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        data: AQ==
                        programId: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: false
                            pubkey: S263mtzoAxJZ4kydoaYDHqrTWHwdQGqGdEa1iNEai7M
                          - isSigner: false
                            isWritable: false
                            pubkey: CTDLvGGXnoxvqLyTpGzdGLg9pD6JexKxKXSV8tqqo8bN
                          - isSigner: false
                            isWritable: true
                            pubkey: CJg17Dn4xgUyEW3gKSSyteNw7LhP1o9pzm9eLtvuNjkQ
                          - isSigner: false
                            isWritable: true
                            pubkey: 5APUrXrtLA2r9pxgpNv5si1yEq9ruV3kH4bT52EQCNpJ
                          - isSigner: false
                            isWritable: true
                            pubkey: CWauEmZF7MbhUdekToBez2suvtX8Ri9pehcFo4RVvAqo
                          - isSigner: false
                            isWritable: true
                            pubkey: BHbaZeASZMYSgC16HJeDFz44yLC5yw8WwiXEsNFCTjf
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: true
                            pubkey: 23exo98UP38RTmLENmu6GbLWqBzYNCpzZn8w2L7toQMR
                          - isSigner: false
                            isWritable: true
                            pubkey: 23exo98UP38RTmLENmu6GbLWqBzYNCpzZn8w2L7toQMR
                          - isSigner: false
                            isWritable: true
                            pubkey: 23exo98UP38RTmLENmu6GbLWqBzYNCpzZn8w2L7toQMR
                          - isSigner: false
                            isWritable: true
                            pubkey: 23exo98UP38RTmLENmu6GbLWqBzYNCpzZn8w2L7toQMR
                          - isSigner: false
                            isWritable: true
                            pubkey: 4YHW2KzwHjvrBUmdYRqRgu6cDQCk9TTNaofqmbmtc2cH
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                          - isSigner: false
                            isWritable: false
                            pubkey: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                          - isSigner: false
                            isWritable: false
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: false
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: true
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: true
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: false
                            pubkey: 8a4wJ2bMiH6XWDZ7biTnejkss8VG7GMwd9Mg6F5fDfHF
                          - isSigner: false
                            isWritable: false
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                        data: >-
                          yJ0DtgOkovC8f8Kd4KQe31xNNjLn/+h3rrXmqNYlEwCNeKBoAA/+JgMA4JMEAAAAAAAAWnx9AQAAAAAAANBeKfxYoKUCAAAAAAAAAQEAAAGAkdPkvAoAAAAAAAAAAAAAAAAA
                        programId: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                    addressLookupTableAddresses: []
                    transaction: gQEABwwAAAAvvWNdY3w8g09r…
                    lastValidBlockHeight: 430451085
                    quote:
                      mark:
                        priceE6: 117476709
                        slot: 452412103
                        publishTime: 1790891038
                        source: chainlink
                      collateralMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      collateralAmount: 25001050
                      collateralUsdE6: 25000000
                      notionalUsdE6: 125000000
                      leverageBps: 50000
                      initialMarginUsdE6: 25000000
                      feeUsdE6: 0
                      estLiquidationE6: 94686227
                    venueForm: >-
                      keeper: the order lands now, the keeper executes it;
                      cancellable while pending
                tpsl:
                  summary: tpsl on Jupiter
                  value:
                    quoteId: 94c3676a00000019
                    buildId: 245541eefe68a5e74d2d56a6ec80b7d0
                    op: tpsl
                    marketId: jupiter:SOL-PERP
                    venue: jupiter
                    side: short
                    atomic:
                      funding: false
                      deposit: false
                      register: false
                    detail:
                      account: EkMmjYJi93EDayRAGNHCuJon2Xi7qq9NFbarSSEKaK75
                      request: 535wivH3zTG4w7qQasEvn7EDYHVH5Ut7drJ2E8uPAEuS
                      counter: 6442471086452069000
                    computeUnits: 300000
                    loadedAccountsDataSize: 10854764
                    txVersion: v1
                    instructions:
                      - accounts:
                          - isSigner: true
                            isWritable: false
                            pubkey: 3yrYgLhLRa9G2tsmMHecPXk2iY1Ks1rhsLEeYEbasGif
                        data: ZGFkLXBlcnA6dHBzbDpkb2Mtc2wtMQ==
                        programId: MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: 3yrYgLhLRa9G2tsmMHecPXk2iY1Ks1rhsLEeYEbasGif
                          - isSigner: false
                            isWritable: true
                            pubkey: Vi2wZxTJsBh1NBkybtURonRQxSgWMxrDVa86bEqKemo
                          - isSigner: false
                            isWritable: false
                            pubkey: 3yrYgLhLRa9G2tsmMHecPXk2iY1Ks1rhsLEeYEbasGif
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        data: AQ==
                        programId: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: 3yrYgLhLRa9G2tsmMHecPXk2iY1Ks1rhsLEeYEbasGif
                          - isSigner: false
                            isWritable: true
                            pubkey: Vi2wZxTJsBh1NBkybtURonRQxSgWMxrDVa86bEqKemo
                          - isSigner: false
                            isWritable: false
                            pubkey: H4ND9aYttUVLFmNypZqLjZ52FYiGvdEB45GmwNoKEjTj
                          - isSigner: false
                            isWritable: false
                            pubkey: 5BUwFW4nRbftYTDMbgxykoFWqWHPzahFSNAaaaJtVKsq
                          - isSigner: false
                            isWritable: true
                            pubkey: EkMmjYJi93EDayRAGNHCuJon2Xi7qq9NFbarSSEKaK75
                          - isSigner: false
                            isWritable: true
                            pubkey: 535wivH3zTG4w7qQasEvn7EDYHVH5Ut7drJ2E8uPAEuS
                          - isSigner: false
                            isWritable: true
                            pubkey: A4y361hkgB8RE45yJUfSYNRtM5D3ajKB6cEUPZxR8Qxc
                          - isSigner: false
                            isWritable: false
                            pubkey: 7xS2gz2bTp3fwCC7knJvUWTEU9Tycczu6VhJYKgi1wdz
                          - isSigner: false
                            isWritable: false
                            pubkey: FYq2BWQ1V5P1WFBqr3qB2Kb5yHVvSv7upzKodgQE5zXh
                          - isSigner: false
                            isWritable: false
                            pubkey: FYq2BWQ1V5P1WFBqr3qB2Kb5yHVvSv7upzKodgQE5zXh
                          - isSigner: false
                            isWritable: false
                            pubkey: G18jKKXQwBbrHeiK3C9MRXhkHsLHf7XgCSisykV46EZa
                          - isSigner: false
                            isWritable: false
                            pubkey: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                          - isSigner: false
                            isWritable: false
                            pubkey: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: 37hJBDnntwqhGbK7L6M1bLyvccj4u55CCUiLPdYkiqBN
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                        data: >-
                          aUDJUvoObU0AAAAAAAAAAAAAAAAAAAAAAQAAAUBZcwcAAAAAAQEBAU1Vs8dRQWhZ
                        programId: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                    addressLookupTableAddresses: []
                    venueForm: >-
                      keeper: the request lands now, the keeper executes it;
                      cancellable after 45s
                update:
                  summary: update on GMTrade
                  value:
                    quoteId: 38a66df90000000a
                    buildId: 9c39f7232e1e386d1c4b83ce1b4ec120
                    op: update
                    marketId: gmtrade:BTC-USDC-USDC-PERP
                    venue: gmtrade
                    side: short
                    atomic:
                      funding: false
                      deposit: false
                      register: false
                    detail:
                      account: 27stKrvjdgVWA2gGfjxhznUwsEDHSmwpbPB5toRsXXqV
                      request: 3Wz7PMY9NDFnMyXwjXG4bC4iojvTeHdyGfqnZ8DPnpVo
                    computeUnits: 400000
                    loadedAccountsDataSize: 4506641
                    txVersion: v1
                    instructions:
                      - accounts:
                          - isSigner: true
                            isWritable: false
                            pubkey: bJx6noQaPDTCQ2vxn2dMX1nYbTKhgprcj3bfAvYemky
                        data: ZGFkLXBlcnA6dXBkYXRlOmRvYy1nbS11cGQtMQ==
                        programId: MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: bJx6noQaPDTCQ2vxn2dMX1nYbTKhgprcj3bfAvYemky
                          - isSigner: false
                            isWritable: false
                            pubkey: CTDLvGGXnoxvqLyTpGzdGLg9pD6JexKxKXSV8tqqo8bN
                          - isSigner: false
                            isWritable: true
                            pubkey: 4tM9cPqNpEYmstNdJMCc6rwdq42939w1SRFYoqMsqPQF
                          - isSigner: false
                            isWritable: true
                            pubkey: 3Wz7PMY9NDFnMyXwjXG4bC4iojvTeHdyGfqnZ8DPnpVo
                          - isSigner: false
                            isWritable: false
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: false
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: true
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: true
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                          - isSigner: false
                            isWritable: false
                            pubkey: 8a4wJ2bMiH6XWDZ7biTnejkss8VG7GMwd9Mg6F5fDfHF
                          - isSigner: false
                            isWritable: false
                            pubkey: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                        data: >-
                          w6/PIav2KbAAAQDQ2oAxPjsBAAAAAAAAAAABAIACSQcxPAEAAAAAAAAAAAAA
                        programId: Gmso1uvJnLbawvw7yezdfCDcPydwW2s2iqG3w6MDucLo
                    addressLookupTableAddresses: []
                    venueForm: >-
                      keeper: the order lands now, the keeper executes it;
                      cancellable while pending
                cancel:
                  summary: cancel on Jupiter
                  value:
                    quoteId: 94c3676a00000020
                    buildId: 7522347801eebbde76a3028b51f80498
                    op: cancel
                    marketId: jupiter:SOL-PERP
                    venue: jupiter
                    side: long
                    atomic:
                      funding: false
                      deposit: false
                      register: false
                    detail:
                      account: AQMo3i1EGtfL85NqJ9ZUE1yjEpzjVTPpntkrfGTWbzD2
                      request: 7ULCZGPipZWdfn1ELE1Qbd867rR9WD6cxeoxosbzEGzT
                      counter: 355285864
                    computeUnits: 300000
                    loadedAccountsDataSize: 10849994
                    txVersion: v1
                    instructions:
                      - accounts:
                          - isSigner: true
                            isWritable: false
                            pubkey: 4sKjF436KAHyZQFCCuHCx4UhrMBKGmUtA2ZT9bg7voPC
                        data: ZGFkLXBlcnA6Y2FuY2VsOmRvYy1jYW5jZWwtMQ==
                        programId: MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
                      - accounts:
                          - isSigner: true
                            isWritable: true
                            pubkey: 4sKjF436KAHyZQFCCuHCx4UhrMBKGmUtA2ZT9bg7voPC
                          - isSigner: false
                            isWritable: true
                            pubkey: 6EbbTNQ3251xSiPU4cFFdmr9zVgn7zM1J5HJ2LyRZCSS
                          - isSigner: false
                            isWritable: false
                            pubkey: 4sKjF436KAHyZQFCCuHCx4UhrMBKGmUtA2ZT9bg7voPC
                          - isSigner: false
                            isWritable: false
                            pubkey: So11111111111111111111111111111111111111112
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        data: AQ==
                        programId: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                      - accounts:
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                          - isSigner: true
                            isWritable: true
                            pubkey: 4sKjF436KAHyZQFCCuHCx4UhrMBKGmUtA2ZT9bg7voPC
                          - isSigner: false
                            isWritable: true
                            pubkey: 6EbbTNQ3251xSiPU4cFFdmr9zVgn7zM1J5HJ2LyRZCSS
                          - isSigner: false
                            isWritable: true
                            pubkey: 5BUwFW4nRbftYTDMbgxykoFWqWHPzahFSNAaaaJtVKsq
                          - isSigner: false
                            isWritable: true
                            pubkey: 7ULCZGPipZWdfn1ELE1Qbd867rR9WD6cxeoxosbzEGzT
                          - isSigner: false
                            isWritable: true
                            pubkey: CHpqg1LbE9n8qTdFs6c9Zs7wQSdb6m3u5ZbcY8KHkcgD
                          - isSigner: false
                            isWritable: false
                            pubkey: AQMo3i1EGtfL85NqJ9ZUE1yjEpzjVTPpntkrfGTWbzD2
                          - isSigner: false
                            isWritable: false
                            pubkey: So11111111111111111111111111111111111111112
                          - isSigner: false
                            isWritable: false
                            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                          - isSigner: false
                            isWritable: false
                            pubkey: '11111111111111111111111111111111'
                          - isSigner: false
                            isWritable: false
                            pubkey: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL
                          - isSigner: false
                            isWritable: false
                            pubkey: 37hJBDnntwqhGbK7L6M1bLyvccj4u55CCUiLPdYkiqBN
                          - isSigner: false
                            isWritable: false
                            pubkey: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                        data: eUSiHNgvyEI=
                        programId: PERPHjGBqRHArX4DySjwM6UJHiR3sWAatqfdBS2qQJu
                    addressLookupTableAddresses: []
                    venueForm: >-
                      keeper: the request lands now, the keeper executes it;
                      cancellable after 45s
        '400':
          description: A field is missing or wrong, or the order named cannot be acted on
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                op:
                  summary: Unknown op
                  value:
                    error: bad_request
                    reason: >-
                      op: open | close | tpsl | cancel | deposit | withdraw |
                      limit | update
                    quoteId: 23e14e01000044fd
                txVersion:
                  summary: v0 asked
                  value:
                    error: bad_request
                    reason: 'txVersion 0 is not served: this router emits v1'
                    quoteId: 23e14e01000044fe
                clientOrderId:
                  summary: clientOrderId over 64 bytes
                  value:
                    error: bad_request
                    reason: 'bad request: clientOrderId: 1..64 bytes'
                    quoteId: 94c3676a0000002c
                triggerSide:
                  summary: A stop loss on a short below the mark
                  value:
                    error: bad_request
                    reason: 'bad request: trigger is not above the mark'
                    quoteId: 38a66df90000000d
                tooYoung:
                  summary: Jupiter request created less than 45 s ago
                  value:
                    error: request
                    reason: >-
                      request: position_request younger than 45s: the keeper's
                      window
                    quoteId: 94c3676a0000001a
                notYours:
                  summary: orderId of another wallet
                  value:
                    error: request
                    reason: 'request: position_request belongs to another wallet'
                    quoteId: 94c3676a0000001f
                wrongMarket:
                  summary: update with a marketId that is not the order's
                  value:
                    error: request
                    reason: 'request: marketId is not the order''s market'
                    quoteId: 94c3676a0000002b
        '409':
          description: >-
            The `routeTicket` expired, or the collateral moved more than
            `slippageBps` since the quote: quote again
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            The venue is off, cannot express this, there is no position, the
            amount does not fit, or the funding route or transaction was
            declined
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                venueDisabled:
                  summary: Venue not in ROUTER_PERP
                  value:
                    error: venue_disabled
                    reason: gmtrade is not enabled on this host (ROUTER_PERP)
                    quoteId: 23e14e01000044ff
                venueForm:
                  summary: limit on Jupiter
                  value:
                    error: venue_form
                    reason: >-
                      not expressible on this venue: jupiter has no user-signed
                      limit increase: instantCreateLimitOrder also wants the
                      keeper
                    quoteId: 94c3676a0000001d
                noPosition:
                  summary: close with no open position on that market and side
                  value:
                    error: no_position
                    reason: 'no position: position is flat'
                    quoteId: 94c3676a0000001e
        '503':
          $ref: '#/components/responses/StateUnavailable'
components:
  schemas:
    InstructionsRequest:
      type: object
      description: >
        One body for every operation and venue. Fields an operation does not use
        are ignored.

        Always required: `wallet`, `op`, `marketId`, `side`, `clientOrderId`.
      required:
        - wallet
        - op
        - marketId
        - side
        - clientOrderId
      properties:
        wallet:
          type: string
          description: Fee payer, owner and only signer of the transaction (base58)
        op:
          type: string
          enum:
            - open
            - close
            - tpsl
            - cancel
            - deposit
            - withdraw
            - limit
            - update
        marketId:
          type: string
          description: '`<venue>:<SYMBOL>-PERP`'
          example: jupiter:SOL-PERP
        side:
          type: string
          enum:
            - long
            - short
          description: >-
            The position's side (`buy`/`sell` accepted). For close, tpsl,
            deposit, withdraw, cancel and update, the side of the existing
            position or order
        clientOrderId:
          type: string
          minLength: 1
          maxLength: 64
          description: >-
            Your id, 1 to 64 bytes. Goes in the memo and derives the
            request/order address: use a new one per operation
        collateralUsd:
          type: integer
          format: int64
          minimum: 1
          description: '`open`, `limit` (required): collateral in micro-USD'
        leverageBps:
          type: integer
          format: int32
          minimum: 10000
          description: '`open`, `limit` (required): leverage in bps'
        slippageBps:
          type: integer
          format: int32
          default: 50
          minimum: 0
          maximum: 9999
          description: >-
            Price band around the mark (around the trigger for `limit`; unused
            by `tpsl`) the keeper may execute at; the funding route's slippage;
            and how far the collateral may move from a `routeTicket` before
            `409`
        fundingMint:
          type: string
          description: >-
            `open`, `limit`, `deposit`: what the wallet pays with; see
            `/perp/quote`
        routeTicket:
          type: string
          description: >-
            `open`, `limit`, `deposit` with a routed `fundingMint`: the
            `funding.routeTicket` of a `/perp/quote`. Without it the route is
            quoted again
        closeBps:
          type: integer
          format: int32
          default: 10000
          minimum: 1
          maximum: 10000
          description: '`close`, `tpsl`: share of the position, 10000 = all'
        trigger:
          type: string
          enum:
            - tp
            - sl
          description: >-
            `tpsl` (required). TP of a long and SL of a short must be above the
            mark, the other two below
        triggerPriceE6:
          type: integer
          format: int64
          minimum: 1
          description: '`limit`, `tpsl` (required), `update` (optional): price × 10^6'
        orderId:
          type: string
          description: >-
            `cancel`, `update` (required): the request/order address, from
            `/perp/account` `orders[].orderId` or a build's `detail.request`
        amountUsd:
          type: integer
          format: int64
          minimum: 1
          description: >-
            `deposit`, `withdraw` (required): micro-USD. `update`: the new size
            in micro-USD (how much a TP/SL closes, or a limit's notional)
        serialize:
          type: boolean
          default: false
          description: >-
            Also return the unsigned transaction (`transaction`,
            `lastValidBlockHeight`)
        transactionsFeeLamports:
          type: integer
          format: int64
          description: >-
            Priority fee for the whole transaction in lamports (set in the
            serialized transaction's message)
        txVersion:
          type: integer
          enum:
            - 1
          default: 1
          description: Transaction format. Only v1 is served; 0 is refused
    InstructionsResponse:
      type: object
      required:
        - quoteId
        - buildId
        - op
        - marketId
        - venue
        - side
        - atomic
        - detail
        - computeUnits
        - loadedAccountsDataSize
        - txVersion
        - instructions
        - addressLookupTableAddresses
        - venueForm
      properties:
        quoteId:
          type: string
        buildId:
          type: string
          description: >-
            Id of the built transaction (32 hex), joined with the landed
            transaction through the memo
        op:
          type: string
        marketId:
          type: string
        venue:
          type: string
          enum:
            - jupiter
            - gmtrade
        side:
          type: string
          enum:
            - long
            - short
        atomic:
          $ref: '#/components/schemas/Atomic'
        detail:
          $ref: '#/components/schemas/Detail'
        computeUnits:
          type: integer
          description: >-
            Compute unit limit of the transaction (funding route + 300 000 on
            Jupiter, 400 000 on GMTrade)
        loadedAccountsDataSize:
          type: integer
          description: Bytes of accounts the transaction loads, declared in a v1 message
        txVersion:
          type: string
          enum:
            - v1
        instructions:
          type: array
          items:
            $ref: '#/components/schemas/Instruction'
          description: >-
            In execution order. No ComputeBudget instruction: in v1 the limits
            are `computeUnits` and `loadedAccountsDataSize`, which you must set
            yourself if you assemble the transaction
        addressLookupTableAddresses:
          type: array
          items:
            type: string
          description: Always empty
        transaction:
          type: string
          description: >-
            With `serialize`: the unsigned v1 transaction, base64. The wallet
            signs it
        lastValidBlockHeight:
          type: integer
          format: int64
          description: 'With `serialize`: the blockhash expires after this block height'
        quote:
          $ref: '#/components/schemas/OpenQuote'
          description: '`open` and `limit` only: the numbers the order was built with'
        funding:
          $ref: '#/components/schemas/Funding'
          description: Only with a routed `fundingMint`; `routeTicket` is not repeated here
        venueForm:
          type: string
          description: How the venue executes the operation (by its keeper)
    Error:
      type: object
      required:
        - error
        - reason
      properties:
        error:
          type: string
          description: >
            The label. 400: `bad_request`, `unknown_market`, `request` (the
            order named cannot be acted

            on), `invalid_route_ticket`, `route_ticket_mismatch`. 404:
            `not_found`. 409:

            `route_expired`. 422: `venue_disabled`, `venue_form`, `no_position`,
            `size`, `layout`,

            `wire`, `declined`. 503: `missing_state`, `oracle`, `rpc`,
            `declined` (funding route accounts

            could not be fetched). 500: `internal`.
          enum:
            - bad_request
            - unknown_market
            - request
            - invalid_route_ticket
            - route_ticket_mismatch
            - not_found
            - route_expired
            - venue_disabled
            - venue_form
            - no_position
            - size
            - layout
            - wire
            - declined
            - missing_state
            - oracle
            - rpc
            - internal
        reason:
          type: string
          description: What exactly; free text for humans and logs
        quoteId:
          type: string
          description: >-
            Id of this call in the router's logs (16 hex). Absent when the body
            does not parse
          example: 94c3676a00000002
    Atomic:
      type: object
      description: What else this one transaction carries besides the order
      properties:
        funding:
          type: boolean
          description: A swap route into the collateral
        deposit:
          type: boolean
          description: Collateral moves from the wallet into the venue
        register:
          type: boolean
          description: >-
            The venue's user account is created (GMTrade, first order of a
            wallet)
    Detail:
      type: object
      description: The accounts this operation creates or acts on
      properties:
        account:
          type: string
          description: The position account
        request:
          type: string
          description: >-
            The request (Jupiter) or order (GMTrade) created, cancelled or
            updated: the `orderId` to cancel it
        counter:
          type: integer
          format: uint64
          description: >-
            Jupiter only: the request's counter. A full 64-bit integer, larger
            than JavaScript's safe integers
    Instruction:
      type: object
      properties:
        programId:
          type: string
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/AccountMeta'
        data:
          type: string
          description: Instruction data, base64
    OpenQuote:
      type: object
      required:
        - mark
        - collateralMint
        - collateralAmount
        - collateralUsdE6
        - notionalUsdE6
        - leverageBps
        - initialMarginUsdE6
        - feeUsdE6
      properties:
        mark:
          $ref: '#/components/schemas/Mark'
        collateralMint:
          type: string
          description: The mint deposited
        collateralAmount:
          type: integer
          format: int64
          description: >-
            Raw units of `collateralMint` the order deposits (USD converted at
            the collateral token's price; USDC is 1:1 on Jupiter and at its
            Chainlink price on GMTrade)
        collateralUsdE6:
          type: integer
          format: int64
        notionalUsdE6:
          type: integer
          format: int64
          description: Position size added, collateral × leverage
        leverageBps:
          type: integer
          format: int32
        initialMarginUsdE6:
          type: integer
          format: int64
          description: Equal to the collateral
        feeUsdE6:
          type: integer
          format: int64
          description: >-
            Opening fee estimate. Jupiter: the custody's open fee on the
            notional. GMTrade: always 0 (its fee depends on price impact and is
            not estimated)
        estLiquidationE6:
          type: integer
          format: int64
          description: >-
            Indicative liquidation price (isolated margin, 0.6 % maintenance),
            not the venue's rule. For a limit, computed at the trigger
        maxLeverageBps:
          type: integer
          description: Reserved; not emitted today
    Funding:
      type: object
      description: >-
        The exact-out swap route into the collateral mint, present only when
        `fundingMode` is `routed`
      required:
        - inputMint
        - outputMint
        - amountIn
        - amountOut
        - maxAmountIn
        - route
      properties:
        inputMint:
          type: string
          description: The mint the wallet pays with (wSOL for native SOL)
        outputMint:
          type: string
          description: The collateral mint
        amountIn:
          type: integer
          format: int64
          description: Expected input, raw units
        amountOut:
          type: integer
          format: int64
          description: >-
            Collateral delivered, raw units; the venue instruction deposits
            exactly this
        maxAmountIn:
          type: integer
          format: int64
          description: Most the route may take (slippage included)
        route:
          type: array
          items:
            $ref: '#/components/schemas/FundingHop'
        routeTicket:
          type: string
          description: >-
            `/perp/quote` only, when the router has `ROUTER_TICKET_SECRET`: pass
            it to `/perp/instructions` to build this route (valid
            `ROUTER_TICKET_TTL_S`, default 60 s)
    NotReady:
      type: object
      required:
        - error
        - reasons
      properties:
        error:
          type: string
          const: not_ready
        reasons:
          type: array
          items:
            type: string
          description: Every reason the router is not ready
        quoteId:
          type: string
    AccountMeta:
      type: object
      properties:
        pubkey:
          type: string
        isSigner:
          type: boolean
        isWritable:
          type: boolean
    Mark:
      type: object
      description: The reference price of the market's index token
      required:
        - priceE6
        - slot
        - source
      properties:
        priceE6:
          type: integer
          format: int64
          description: USD per whole token × 10^6
          example: 117432055
        slot:
          type: integer
          format: int64
          description: Slot of the oracle account the price was read from
        publishTime:
          type: integer
          format: int64
          description: >-
            When the price was published, Unix seconds. On GMTrade the older of
            the report's signing and its landing
        source:
          type: string
          enum:
            - doves
            - chainlink
          description: >-
            `doves` (Jupiter's oracle) or `chainlink` (GMTrade's Chainlink Data
            Streams feed)
    FundingHop:
      type: object
      properties:
        dex:
          type: string
          description: Venue of the hop, as in the router's `/venues`
        pool:
          type: string
        inputMint:
          type: string
        outputMint:
          type: string
        inputAmount:
          type: integer
          format: int64
        outputAmount:
          type: integer
          format: int64
        priceBasis:
          type: string
          enum:
            - curve_exact
            - vault_reserves
            - bin_walk
            - tick_walk
            - template_replay
            - flat_fallback
            - ticket
        exact:
          type: string
          enum:
            - exact
            - bounded_below
            - approx
            - ticket
        feeBps:
          type: integer
        feeSource:
          type: string
          enum:
            - on_chain
            - default
            - ticket
  responses:
    StateUnavailable:
      description: >
        Ours, not yours: retry later. `not_ready` (the router is not ready, no
        blockhash for

        `serialize`, or the swap program is paused for a routed funding leg),
        `oracle` (the mark is

        stale: Doves older than 90 s, a GMTrade feed older than its heartbeat),
        `missing_state` (a venue

        account is not loaded yet), `rpc` (the wallet's accounts could not be
        read).
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/Error'
              - $ref: '#/components/schemas/NotReady'
          examples:
            oracle:
              summary: GMTrade feed past its heartbeat
              value:
                error: oracle
                reason: 'oracle: price feed older than the venue''s heartbeat'
                quoteId: 94c3676a00000009

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.