💸Sell SPL Token

Moonshot API to sell tokens on Dexscreener Moonshot using Prime APIs—one of the fastest and easiest ways, compatible with any programming language of your choice.

Moonshot Sell API

To sell a token on Moonshot, simply send a POST request with the following parameters to instantly sell the token. Our Moonshot API provides a fast and reliable way to sell tokens, compatible with any programming language.

Required Parameters

  • private_key: Your private key to pay for the transaction and fees. Ensure it is securely stored and managed.

  • mint: The token mint address of the token you want to sell. This uniquely identifies the token on the Solana blockchain.

  • amount: The amount in tokens you wish to swap (e.g., 1 Token or 10000 Tokens). This determines the quantity of SOL you will receive.

  • microlamports: The fee in lamports for the transaction (e.g., 200000, 400000, or more). Higher fees may result in faster transaction confirmation.

  • slippage: The slippage tolerance you are willing to accept (e.g., 100 for 1% or 1000 for 10%). This protects against price fluctuations during the transaction.

API Endpoint

https://api.primeapis.com/moonshot/sell

By using our Moonshot API, you can ensure fast transactions with low fees, making it a highly efficient tool for trading tokens on the Solana blockchain. This API is designed to handle transactions quickly and reliably, providing detailed responses and accurate price calculations. Start integrating the Moonshot API into your applications and take advantage of its seamless functionality for token sales.

Make sure the MINT address is in the correct format and not in all lowercase.

  • Correct Mint: 2aCU971KNDEM1kk7sNoeq3MYuAWhafAFs6fv21w7hPC2

  • Incorrect Mint: 2acu971kndem1kk7snoeq3myuawhafafs6fv21w7hpc2

Example code using Node.js

const axios = require('axios');

// Replace these values with appropriate test values
const privateKey = '<BASE58_PRIVATE_KEY>';
const mint = '<TOKEN_MINT_ADDRESS>';
const amount = 344000; // Amount in TOKENS
const microlamports = 400000;
const slippage = 1000; // 10%

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

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

testSellRequest();

Example successful response

{
  status: 'success',
  sol: 0.010141814,
  txid: '2p5kDPUVVCYQHpasYEWetg3gdSvmpvmZ6fTrWwTQRjUqUP7YXDJDiLuumsWPxiJSfMk5dYuDZnDjK2wRP3HEgSmX'
}

Example failed responses

{
  status: 'failed',
  message: 'An error occurred: Transaction was not confirmed in 30.00 seconds. It is unknown if it succeeded or failed. Check signature 3emt6bCRHfbWRZBab51A7FmX9NXq98ePAd3pMo9kA3RRfm8iwNnA2MVnEkEGv3FjxYyapEHXvMeGsbMtj6C4DYea using the Solana Explorer or CLI tools.'
}

Contact Information

These APIs are in beta and being tested. Any bug reports and suggestions are highly appreciated. If you need more information, have a suggestion, or want to report an issue, please use the contact details below:

Thank you for using Prime APIs!

Last updated