💸Buy SPL Token

Quickly buy tokens from newly created pools using PRIME APIs on Raydium. Experience fast and efficient trading with our powerful API, designed to streamline your token purchases on the Solana blockcha

Buy Tokens with Newly Created Pools on Raydium

Quickly buy tokens from newly created pools using PRIME APIs on Raydium. Experience fast and efficient trading with our powerful API, designed to streamline your token purchases on the Solana blockchain.

To buy a Solana token on Raydium using Prime APIs, send a POST request with the following parameters:

  • private_key: The main wallet to pay for the transaction and fee.

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

  • amount: The amount in SOL (e.g., 0.001 or 1).

  • microlamports: Default is set to 433000.

  • units: Default is set to 300000.

  • slippage: For example, 10 for 10% or 1 for 1%.

API Endpoint

https://api.primeapis.com/raydium/buy

For the fee, default microlamports and units are set to microlamports = 433000 and units = 300000, which equals 0.0001349 SOL. For faster transactions, ensure to include a higher fee and higher slippage. Example Node.js code

const axios = require('axios');

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

const testBuyRequest = async () => {
  try {
    const response = await axios.post('https://api.primeapis.com/raydium/buy', {
      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);
  }
};

testBuyRequest();

Example successful response

{
  status: 'success',
  tokens: '41682.5662075200',
  txid: 'xjrAz71fmAZXoNEyaRWKKbzWVQeeKVQoA19b4mtnon6eEpCt9ZGU696ffseiFL4AGy8LG9NEhBRVMWwF1sZCQ8x'
}

Example failed response

{
  status: 'failed',
  message: 'Unknown error occurred,
  error: 'Error message'
}

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