Skip to content
The Chat Archive
sonar-pro-high LMArena Search Arena 24K

https://betastation.jup.ag/docs/apis/swap-api

  1. User
  2. Assistant

    The provided URL leads to the documentation for the Jupiter Swap API, which is part of the Jupiter platform for decentralized finance (DeFi) on Solana. The Swap API enables developers to interact with the Jupiter Swap Aggregator program to perform token swaps efficiently. Below is an overview of the key features and functionalities of the Jupiter Swap API:

    Key Features of the Jupiter Swap API

    1. Token Swaps:

      • The API allows users to swap tokens by providing a serialized transaction that can be executed on the Solana blockchain.
      • Developers can specify parameters such as input/output tokens, slippage tolerance, and transaction prioritization.
    2. Endpoints:

      • /swap: This endpoint returns a serialized transaction based on a quote obtained from the /quote endpoint. It requires parameters like the user's public key and the quote response.
      • /swap-instructions: Instead of a serialized transaction, this endpoint provides individual instructions for composing custom transactions.
    3. Advanced Features:

      • Dynamic Compute Unit Limit: Adjusts compute resources dynamically for optimal transaction execution.
      • Dynamic Slippage: Automatically adjusts slippage to improve transaction success rates.
      • Prioritization Fees: Allows users to pay additional fees to prioritize their transactions on the network.
    4. Integration Options:

      • The API supports integration with custom Solana programs using Cross Program Invocation (CPI) or Flash Fill methods.
      • Address Lookup Tables (ALTs) are used to manage transaction size limits effectively.
    5. Customization:

      • Developers can customize transactions by adding additional accounts or using shared accounts.
      • Optional parameters like wrapAndUnwrapSol simplify handling of wrapped SOL (wSOL).
    6. Error Handling:

      • The API provides mechanisms to exclude specific decentralized exchanges (DEXes) that may cause errors during swaps.
    7. Versioned Transactions:

      • The API supports Solana's versioned transactions, which are compatible with wallets that support this feature. For wallets that do not, the asLegacyTransaction parameter can be used.

    Example Workflow

    1. Get a Quote:
      • Use the /quote endpoint to obtain a quote for the desired token swap.
    2. Build a Transaction:
      • Use the /swap endpoint to get a serialized transaction or /swap-instructions for individual instructions.
    3. Sign and Execute:
      • Deserialize the transaction, sign it with the user's private key, and send it to the Solana network.

    API Access and Updates

    • API Keys: Starting in 2025, API keys are required for accessing certain endpoints. Free and paid plans are available, with different rate limits.
    • Migration: Developers using free endpoints must migrate to lite-api.jup.ag by May 1, 2025, as the main API (api.jup.ag) will require API keys for all usage.

    For more detailed information, developers can refer to the full documentation available on the Jupiter platform.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.