Skip to main content

Get Order

The root URL of the Ultra API's order endpoint is as such.

https://api.jup.ag/ultra/v1/order
API Reference

To fully utilize the Ultra API, check out the Ultra API Reference.

Get Order

To get a swap order, you need to pass in the required parameters such as:

  • inputMint: The input token mint address
  • outputMint: The output token mint address
  • amount: The amount of input token to swap
  • taker: The user's wallet address
    • Note: If the taker is not provided, there will still be an Order Response with no transaction field.
const orderResponse = await (
await fetch(
'https://api.jup.ag/ultra/v1/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=100000000&taker=3X2LFoTQecbpqCR7G5tL1kczqBKurjKPHhKSZrJ4wgWc'
)
).json();

console.log(JSON.stringify(orderResponse, null, 2));

Order Response

In the order response, you will receive a number of fields that are important to note of, such as the swapType, slippageBps, etc.

The main fields you should need:

  • transaction: The base64 encoded transaction that you need to sign before submitting to the network.
  • requestId: The request ID of the order to be used in the Execute Order endpoint.

Now, you are able to get a swap order, next steps is to make a post request to the Execute Order endpoint. Let's go!

Example response of Aggregator Swap:

{
"swapType": "aggregator",
"environment": "production",
"requestId": "668e8b71-a5ab-424e-83d6-51c9239e8bb5",
"inAmount": "100000000",
"outAmount": "12698391",
"otherAmountThreshold": "12577697",
"swapMode": "ExactIn",
"slippageBps": 100,
"priceImpactPct": "0.0000261921556639999999999997",
"routePlan": [
{
"swapInfo": {
"ammKey": "HTvjzsfX3yU6BUodCjZ5vZkUrAxMDTrBs3CJaq43ashR",
"label": "Meteora DLMM",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "100000000",
"outAmount": "12704744",
"feeAmount": "30003",
"feeMint": "So11111111111111111111111111111111111111112"
},
"percent": 100
}
],
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"feeBps": 5,
"taker": "3X2LF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amports": 72329,
"lastValidBlockHeight": 301856775,
"dynamicSlippageReport": {
"slippageBps": 75,
"otherAmount": null,
"simulatedIncurredSlippageBps": null,
"amplificationRatio": null,
"categoryName": "solana",
"heuristicMaxSlippageBps": 100,
"rtseSlippageBps": 75,
"failedTxnEstSlippage": 55,
"priceMovementEstSlippage": 75,
"emaEstSlippage": 0
},
"totalTime": 549
}

Example response of RFQ Swap:

{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "100000000",
"outAmount": "12619939",
"otherAmountThreshold": "12626253",
"swapMode": "ExactIn",
"slippageBps": 0,
"priceImpactPct": "0",
"routePlan": [
{
"swapInfo": {
"ammKey": "96ywtMs5KJNt2iAinr1U8KMzxjcY1FUEpgKHMYNz818g",
"label": "RFQ",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "100000000",
"outAmount": "12619939",
"feeAmount": "0",
"feeMint": "11111111111111111111111111111111"
},
"percent": 100
}
],
"feeBps": 5,
"transaction": null,
"gasless": true,
"prioritizationType": "None",
"prioritizationFeeLamports": 0,
"requestId": "0abacc75-6a3c-d688-b633-ce2c14cef0fd",
"swapType": "rfq",
"quoteId": "25e8fc14-15f9-522d-8e18-5130e273b90f",
"maker": "96ywtMs5KJNt2iAinr1U8KMzxjcY1FUEpgKHMYNz818g",
"taker": null,
"expireAt": null,
"contextSlot": 0,
"platformFee": {
"amount": "6313",
"feeBps": 5
},
"totalTime": 425
}