Skip to main content

Get Order History

Retrieve your orders with optional filters for state, mint, and pagination.
const historyResponse = await fetch(
  'https://api.jup.ag/trigger/v2/orders/history?state=active&limit=20&offset=0',
  {
    headers: {
      'x-api-key': 'your-api-key',
      'Authorization': `Bearer ${token}`,
    },
  }
);

const history = await historyResponse.json();

Query Parameters

ParameterTypeDefaultDescription
statestringactive (open orders) or past (filled/cancelled/expired)
mintstringFilter by token mint address (input or output)
limitnumber20Results per page (1-100)
offsetnumber0Number of results to skip
sortstringupdated_atSort field: updated_at, created_at, expires_at
dirstringdescSort direction: asc or desc

Response

{
  "orders": [
    {
      "id": "order-uuid",
      "orderType": "single",
      "orderState": "open",
      "rawState": "open",
      "userPubkey": "YourWalletPublicKey...",
      "privyWalletPubkey": "VaultPublicKey...",
      "inputMint": "So11111111111111111111111111111111111111112",
      "initialInputAmount": "1000000000",
      "remainingInputAmount": "1000000000",
      "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "triggerMint": "So11111111111111111111111111111111111111112",
      "triggerCondition": "above",
      "triggerPriceUsd": 200.00,
      "slippageBps": 100,
      "expiresAt": 1704067200000,
      "createdAt": 1704000000000,
      "updatedAt": 1704000000000,
      "events": [
        {
          "type": "deposit",
          "timestamp": 1704000000000,
          "txSignature": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d...",
          "mint": "So11111111111111111111111111111111111111112",
          "amount": "1000000000",
          "state": "success"
        }
      ]
    }
  ],
  "pagination": {
    "total": 50,
    "limit": 20,
    "offset": 0
  }
}

Additional Fields for Filled Orders

Orders that have been fully or partially filled include extra fields:
FieldDescription
triggeredAtTimestamp when the price condition was met
outputAmountTotal output tokens received
inputUsedTotal input tokens consumed
fillPercentFill ratio (1.0 = fully filled)

Execution Attempts

Order history includes execution attempts for each order. When an order fails to execute (due to slippage, quote generation failure, or other reasons), the attempt is recorded in the history. The reason for failure is not included in the response. Users can adjust slippage settings via the update endpoint if execution keeps failing due to slippage.

Event Types

Each order includes an events array tracking its lifecycle:
Event TypeDescription
depositTokens deposited into vault
fillOrder executed (full or partial)
withdrawalTokens withdrawn back to wallet
cancelledOrder cancelled by user
expiredOrder expired
Each event includes type, timestamp, and state. Events that involve token movement (deposit, fill, withdrawal) also include:
FieldDescription
txSignatureOn-chain transaction signature
mintToken mint address
amountToken amount (in smallest unit)
Fill events include additional fields:
FieldDescription
outputMintOutput token mint address
outputAmountOutput amount received
orderContextSemantic order type: take_profit, stop_loss, buy_above, or buy_below

Order States

Orders follow a state machine from creation to completion. The orderState field provides a human-friendly state, while rawState shows the exact internal state.

Display States

StateDescription
pendingDeposit is being processed
openActive and waiting for price trigger
executingPrice condition met, swap in progress
filledOrder completed successfully
pending_withdrawCancellation initiated, awaiting signed withdrawal
cancelledUser cancelled the order
expiredOrder expired before execution
failedExecution failed

Raw States

The rawState field exposes the internal processing state. Multiple raw states map to each display state:
orderStaterawStateMeaning
pendingpending_depositDeposit transaction not yet submitted
pendingdepositingDeposit transaction submitted, awaiting confirmation
openopenActive and monitoring price
executingready_executePrice condition met, preparing swap
executingready_expireOrder expiry detected, processing
executingexecutingSwap transaction in flight
executingexecute_successSwap landed, validating output
executingexecute_failedSwap attempt failed, may retry
executingready_withdraw_outputOutput ready to withdraw to wallet
executingwithdrawingWithdrawal transaction in flight
filledfill_successOrder fully filled and output withdrawn
executingpartial_fill_successOrder partially filled, may continue filling
pending_withdrawready_to_cancelCancellation initiated, awaiting signed withdrawal
cancelledcancelledUser cancelled the order
cancelledoco_cancelledAutomatically cancelled because the other side of an OCO pair filled
expiredexpiredOrder expired before execution
faileddeposit_failedDeposit transaction failed on-chain (e.g. insufficient balance)
failedwithdraw_failedOutput withdrawal failed after execution
failedfill_failedFill validation failed after execution

State Flow

pending ──→ open ──→ executing ──→ filled
   │          │          │
   │          │          └──→ failed
   └──→ failed│
   (deposit)  ├──→ expired

              └──→ pending_withdraw ──→ cancelled
For OCO orders, when one side fills, the other transitions to cancelled automatically (displayed as oco_cancelled in the raw state). For OTOCO orders, the child OCO pair only activates after the parent order reaches filled. If the parent expires or fails, the children are never created.