Skip to main content

Documentation Index

Fetch the complete documentation index at: https://dev.jup.ag/docs/llms.txt

Use this file to discover all available pages before exploring further.

Ultra Swap API is no longer actively maintained and has been superseded by Swap V2.
After signing the transaction from /order, submit it to POST /ultra/v1/execute with the signedTransaction and requestId. Jupiter broadcasts the transaction via its proprietary engine and returns the swap status.

Sign Transaction

Using the Solana web3.js@1 library, you can sign the transaction as follows: For wallet setup details, see Environment Setup.
Set up dependencies for signing
npm install @solana/web3.js@1
Set up Development Wallet
You can paste in your private key for testing but this is not recommended for production.
  • Either use your private key in the project directly, you can do it via a .env file.
  • Or set up your private key in the Solana CLI.
// In your .env file
PRIVATE_KEY=""

// In your index.js (or any file that needs the private key)
import { Keypair } from '@solana/web3.js';
import dotenv from 'dotenv';
require('dotenv').config();

const wallet = Keypair.fromSecretKey(bs58.decode(process.env.PRIVATE_KEY || '')));
Deserialize, sign, and re-serialize the transaction:
Sign Transaction
import { VersionedTransaction } from '@solana/web3.js';

// ... Get Order's response

// Extract the transaction from the order response
const transactionBase64 = orderResponse.transaction

// Deserialize, sign and serialize the transaction
const transaction = VersionedTransaction.deserialize(Buffer.from(transactionBase64, 'base64'));
transaction.sign([wallet]);
const signedTransaction = Buffer.from(transaction.serialize()).toString('base64');

Execute Order

By making a post request to the /execute endpoint, Jupiter executes the swap transaction on behalf of you/your users through our own proprietary transaction sending infrastructure. This already includes handling of slippage, priority fees, transaction landing and more. To make a post request to execute a swap order, you need to pass in the required parameters,:
  • signedTransaction: The signed and serialized base64 encodedtransaction like above
  • requestId: The order response’s request ID from Get Order
Submit the signed transaction to the execute endpoint:
Execute Order
const executeResponse = await (
    await fetch('https://api.jup.ag/ultra/v1/execute', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'x-api-key': 'your-api-key',
        },
        body: JSON.stringify({
            signedTransaction: signedTransaction,
            requestId: orderResponse.requestId,
        }),
    })
).json();

Transaction Status Polling

After our transaction sending service has submitted your swap, we will actively poll for your transaction status as part of the /execute endpoint. You will receive a response with the status of the swap.
  • You can submit with the same signedTransaction and requestId for up to 2 minutes regardless of state, to poll for the transaction status.
  • The transaction will not double execute since it has the same signature.
  • If connection got dropped, you can try again with the same signedTransaction and requestId to poll for the status of the swap.
  • If there is no status, the order likely expired (did not get processed onchain and failed), but reach out to us if cases like this happen.
Check the execute response status:
Transaction Status Polling
if (executeResponse.status === "Success") {
    console.log('Swap successful:', JSON.stringify(executeResponse, null, 2));
    console.log(`https://solscan.io/tx/${executeResponse.signature}`);
} else {
    console.error('Swap failed:', JSON.stringify(executeResponse, null, 2));
    console.log(`https://solscan.io/tx/${executeResponse.signature}`);
}