/order + /execute flow is the recommended way to swap on Jupiter. You get the best price (all routers compete, including RFQ market makers), and Jupiter handles transaction landing for you.
Quick start
Three steps: get an order, sign it, execute it.Prerequisites
Loading a wallet for testing
Loading a wallet for testing
There are several ways to load a wallet for testing. All examples on this page use
BS58_PRIVATE_KEY from your .env file.Imports, types, and constants
Imports, types, and constants
Code example
How it works
1. Get an order
GET /order returns a quote and an assembled transaction in a single call. All routers compete for the best price: Metis, JupiterZ, Dflow, and OKX.
Required parameters:
| Parameter | Description |
|---|---|
inputMint | Mint address of the token you are selling |
outputMint | Mint address of the token you are buying |
amount | Amount in the smallest unit of the input token |
taker | Your wallet address. Required to receive an assembled transaction. Without taker, you get a quote but no transaction. This is useful for price checks. |
| Field | Description |
|---|---|
transaction | Base64-encoded transaction to sign. Null if taker is not set. |
requestId | Pass this to /execute. |
outAmount | Expected output amount before slippage. |
router | Which router won the quote (iris, jupiterz, dflow, okx). |
mode | ”ultra” (no optional params) or “manual” (optional params used). |
2. Sign the transaction
- The transaction returned by
/orderis unsigned. Sign it with your wallet’s private key. The example above uses@solana/kit. The transaction is a versioned transaction (v0). - Note: we use the
partiallySignTransactionfor partial signing because when JupiterZ routing is provided, there is an additional signer which is the MM that will be required after sending the transaction to/executerequest.
3. Execute the transaction
POST /execute takes the signed transaction and the requestId from the order response. Jupiter handles:
- Optimised slippage via RTSE (Real-Time Slippage Estimator), which adjusts slippage at execution time to balance trade success and price protection
- Optimised priority fee strategy for current network conditions
- Jupiter Beam (our own proprietary transaction execution pipeline) for accelerated transaction sending and landing across multiple RPC providers
- Confirmation polling
- Parses both successful and failed transactions
| Field | Required | Description |
|---|---|---|
signedTransaction | Yes | Base64-encoded signed transaction |
requestId | Yes | The requestId from the /order response |
lastValidBlockHeight | No | Block height for nonce validation |
| Field | Description |
|---|---|
status | ”Success” or “Failed” |
signature | Transaction signature (present on both success and some failures) |
code | Error code. 0 = success. See error codes below. |
inputAmountResult | Amount of input token used for the swap |
outputAmountResult | Amount of output token received |
Error codes
| Code | Category | Meaning |
|---|---|---|
0 | Success | Transaction confirmed |
-1 | Execute | Missing cached order (requestId not found or expired) |
-2 | Execute | Invalid signed transaction |
-3 | Execute | Invalid message bytes |
-1000 | Aggregator | Failed to land |
-1001 | Aggregator | Unknown error |
-1002 | Aggregator | Invalid transaction |
-1003 | Aggregator | Transaction not fully signed |
-1004 | Aggregator | Invalid block height |
-2000 | RFQ | Failed to land |
-2001 | RFQ | Unknown error |
-2002 | RFQ | Invalid payload |
-2003 | RFQ | Quote expired |
-2004 | RFQ | Swap rejected |
Related
- Routing for optional parameters and their routing impact
- Fees for adding integrator fees to
/order - Advanced Techniques for gasless swaps, priority fees, and CU optimisation
- API Reference: GET /order for the full OpenAPI specification
- API Reference: POST /execute for the full OpenAPI specification
