Jupiter Swap icon

Jupiter Swap

Jupiter Swap API operations

Overview

The node interacts with the Jupiter Swap API to perform various operations related to token swaps on the Solana blockchain. Specifically, for the Quote operation, it fetches a swap quote that estimates the output amount and route details for swapping one token to another.

This node is useful in scenarios where you want to:

  • Get real-time price quotes before executing a token swap.
  • Evaluate different swap routes and slippage settings.
  • Integrate Solana token swap capabilities into automated workflows without manually querying the API.

Practical example:
You want to swap SOL tokens to USDC tokens and need to know how much USDC you will receive for a given amount of SOL, considering slippage and preferred decentralized exchanges (DEXes). This node's Quote operation provides that information so you can decide whether to proceed with the swap.


Properties

Name Meaning
Base URL The base URL endpoint for the Jupiter Swap API (default: https://lite-api.jup.ag/swap/v1).
Input Mint The mint address of the input token you want to swap from (required).
Output Mint The mint address of the output token you want to swap to (required).
Amount The amount of input token to swap, specified in the smallest unit (e.g., lamports or atoms) (required).
Slippage BPS Allowed slippage in basis points (default 50 bps = 0.5%).
Swap Mode Whether the swap is "Exact In" (input amount fixed) or "Exact Out" (output amount fixed). Options: Exact In, Exact Out.
DEXes Optional comma-separated list of decentralized exchanges to include in routing (e.g., Raydium,Orca,Phoenix).
Exclude DEXes Optional comma-separated list of decentralized exchanges to exclude from routing.
Restrict Intermediate Tokens Boolean flag to restrict intermediate tokens used in routing (true/false).
Only Direct Routes Boolean flag to only consider direct swap routes without intermediates (true/false).
As Legacy Transaction Boolean flag indicating whether to return results as legacy transactions (true/false).
Platform Fee BPS Optional platform fee in basis points to apply on the swap.
Max Accounts Maximum number of accounts to use in the swap process (default 64).

Output

The output JSON contains the response from the Jupiter Swap API's quote endpoint. It typically includes:

  • Estimated output amount for the swap.
  • Route details including which DEXes and pools are involved.
  • Price impact and fees.
  • Other metadata about the swap quote.

The exact structure depends on the Jupiter API but generally provides all necessary data to understand the swap terms before execution.

No binary data output is produced by this operation.


Dependencies

  • Requires access to the Jupiter Swap API endpoint (default https://lite-api.jup.ag/swap/v1).
  • Optionally uses an API key credential if provided, sent via the x-api-key HTTP header.
  • No other external dependencies are required.
  • Network connectivity to the API endpoint is necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing token mint addresses will cause the API to reject the request.
    • Incorrect amount format (not smallest unit) may lead to unexpected quotes.
    • Network errors or unreachable API endpoint.
    • API rate limits if no API key or insufficient quota.
  • Error messages:

    • "Unknown operation": Occurs if an unsupported operation is selected; ensure "Quote" is chosen.
    • HTTP errors from the API (e.g., 400 Bad Request) usually indicate invalid parameters.
    • Authentication errors if API key is required but not provided or invalid.
  • Resolutions:

    • Verify all required fields are correctly filled.
    • Use valid Solana token mint addresses.
    • Check network connectivity.
    • Provide a valid API key credential if needed.
    • Adjust slippage and amount values within reasonable ranges.

Links and References

Discussion