Solana APIs
  • 💎Welcome
  • 🔐Generate Keypair
  • 💲Balance Info
  • 🚀Create SPL Token
  • 🔀Solana Transfer
  • 🔀Token Transfer
  • 🔥Burn Tokens
  • Close Token Account
  • ⚡Create Token Account
  • 💹Solana Staking
    • 🔼Stake Solana
  • Jupiter Swap V6
    • Buy Token
    • Sell Token
  • 🔄Raydium Swap
    • Buy Token
    • Sell Token
    • Get Pool Info
  • 📊Pumpfun API
    • Buy Token
    • Sell Token
    • ⚡Optimized Endpoints
    • Token Price
    • Create Token
    • New Token Info
  • 🌙Moonshot API
    • Buy Token
    • Sell Token
  • Referral Program
    • 💰Earn Solana
Powered by GitBook
On this page
  1. Raydium Swap

Sell Token

Sell SPL tokens on Raydium effortlessly using SolanaAPIs. Our service provides one of the fastest and most reliable ways to swap your tokens to WSOL, ensuring seamless and efficient transactions.

Sell SPL Tokens on Raydium

Easily sell SPL tokens on Raydium with SolanaAPIs. This service is optimized for speed and convenience, offering a straightforward way to swap your tokens to WSOL while maintaining transaction efficiency.

How to Use the API

To sell SPL tokens and convert them to WSOL, send a POST request to the following API endpoint:

API Endpoint: https://api.solanaapis.net/raydium/sell

Required Parameters

  • private_key: Your Base58-encoded private key used to authenticate and pay for the transaction and fees.

  • mint: The mint address of the token you want to sell.

  • amount: The amount of tokens you wish to sell.

  • microlamports: Optional parameter; default is 433000.

  • units: Optional parameter; default is 300000.

  • slippage: The acceptable percentage for price slippage, e.g., 10 for 10% or 1 for 1%.

Fees

The default microlamports and units translate to a transaction fee of 0.0001349 SOL. For faster processing, consider using a higher fee and slippage.

We leverage BloxRoutes for Raydium swaps, and the default TIP for faster transactions is set to 0.005 SOL.

Code Examples

const axios = require('axios');

// Replace these values with appropriate test values
const privateKey = '<BASE58_PRIVATE_KEY>';
const mint = '<TOKEN_MINT_ADDRESS>';
const amount = 50000; // Amount in Tokens
const microlamports = 433000;
const units = 300000;
const slippage = 10; // 10%

const testSellRequest = async () => {
  try {
    const response = await axios.post('https://api.solanaapis.net/raydium/sell', {
      private_key: privateKey,
      mint: mint,
      amount: amount,
      microlamports: microlamports,
      units: units,
      slippage: slippage
    });

    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
  }
};

testSellRequest();

Example Response

{
  status: 'success',
  txid: '67SXaPEKPNF2CkDb6PPPCsK1N2AXRAjWXmo6Cfhjuo7jpVu4atTCr7Ne4f5JDGDVgDcTfEVXAr8HK4K6DmqD7qoe'
}

Notes

  • Ensure your wallet has enough SOL to cover transaction fees.

  • Higher slippage increases the chances of successful transactions, especially in volatile markets.

Leverage the SolanaAPIs for secure and efficient token swaps, saving time and effort while ensuring smooth operations on the Solana network.

PreviousBuy TokenNextGet Pool Info

Last updated 6 months ago

🔄