Jupiter Swap icon

Jupiter Swap

Jupiter Swap API operations

Overview

The "Jupiter Swap" node integrates with the Jupiter Swap API to facilitate token swap operations on the Solana blockchain. It supports obtaining swap quotes, generating swap transactions, retrieving swap instructions for custom transaction building, and fetching program ID to label mappings.

This node is beneficial in scenarios where users want to automate or integrate token swaps within their workflows, such as decentralized finance (DeFi) applications, portfolio rebalancing, or liquidity management on Solana.

Practical examples:

  • Getting a quote for swapping one SPL token to another to estimate output amount and slippage.
  • Generating a signed swap transaction ready to be submitted to the Solana network.
  • Retrieving detailed swap instructions to build custom transactions or integrate with other Solana programs.

Properties

Name Meaning
Base URL Base URL for Jupiter Swap API (default: https://lite-api.jup.ag/swap/v1)
Operation The action to perform:
- Program ID to Label
- Quote
- Swap
- Swap Instructions
Input Mint Input token mint address (required for quote, swap, swapInstructions)
Output Mint Output token mint address (required for quote, swap, swapInstructions)
Amount Amount in smallest unit (lamports/atoms) to swap (required for quote, swap, swapInstructions)
Slippage BPS Slippage tolerance in basis points (default: 50)
User Public Key User's public key for the swap (required for swap, swapInstructions)
Wrap and Unwrap SOL Whether to wrap and unwrap SOL during swap (default: true)
Use Shared Accounts Whether to use shared accounts for the swap (default: true)
Fee Account Optional fee account address
Compute Unit Price Micro Lamports Optional compute unit price in micro lamports
Swap Mode Swap mode for quote operation:
- Exact In
- Exact Out
DEXes Comma-separated list of decentralized exchanges (DEXes) to include (optional)
Exclude DEXes Comma-separated list of DEXes to exclude (optional)
Restrict Intermediate Tokens Whether to restrict intermediate tokens in routing (default: false)
Only Direct Routes Whether to only use direct routes (default: false)
As Legacy Transaction Whether to return the quote as a legacy transaction (default: false)
Platform Fee BPS Platform fee in basis points (optional)
Max Accounts Maximum number of accounts to consider (default: 64)

Output

The node outputs JSON data corresponding to the selected operation:

  • Quote: Returns a JSON object containing swap quote details such as expected output amount, routes, fees, and slippage information.
  • Swap: Returns a JSON object representing the generated swap transaction, typically including serialized transaction data ready for submission.
  • Swap Instructions: Returns JSON-formatted instructions detailing how to build the swap transaction manually.
  • Program ID to Label: Returns a mapping of program IDs to human-readable labels.

No binary data output is produced by this node.

Dependencies

  • Requires access to the Jupiter Swap API endpoint (default base URL: https://lite-api.jup.ag/swap/v1).
  • Optionally uses an API key credential for authenticated requests via an HTTP header x-api-key.
  • No additional external dependencies beyond standard HTTP request capabilities.

Troubleshooting

  • Common issues:

    • Invalid or missing required parameters such as input/output mint addresses or user public key.
    • Network connectivity problems reaching the Jupiter API endpoint.
    • API rate limits or authentication errors if using an API key.
    • Incorrect slippage or amount values causing swap failures.
  • Error messages:

    • "Unknown operation": Occurs if an unsupported operation is selected; ensure the operation property is set correctly.
    • HTTP errors from the API (e.g., 400 Bad Request, 401 Unauthorized): Check parameter validity and API key configuration.
    • JSON parsing errors: Usually indicate malformed responses or connectivity issues.
  • Resolutions:

    • Verify all required inputs are provided and correctly formatted.
    • Confirm network access to the configured Base URL.
    • Provide a valid API key credential if required by the Jupiter API.
    • Adjust slippage and amount parameters to reasonable values.

Links and References

Discussion