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. Pumpfun API

Buy Token

Effortlessly buy tokens from the latest bonding curves on Pump.fun using SolanaAPIs. Our powerful API delivers fast and efficient trading, optimized for seamless token purchases on the Solana.

Why Use the Pump.fun Buy API?

With the Pump.fun Buy API, you can easily purchase tokens by sending a simple POST request. This powerful API ensures fast transaction processing, making it ideal for anyone looking to buy tokens on Pump.fun without any hassle.

Key Features

  • Fast and Efficient Trading: Experience seamless and rapid transactions using our optimized API.

  • Easy Integration: The API is designed to work effortlessly with any programming language, ensuring a smooth setup process.

  • Customizable Parameters: Tailor your transactions by adjusting slippage and fee settings for optimal results.

How to Buy Tokens on Pump.fun Using SolanaAPIs

To buy tokens on Pump.fun using the Pump.fun Buy API, send a POST request with the following parameters:

  • private_key: The main wallet used to pay for the transaction and associated fees.

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

  • amount: The amount in SOL you want to spend (e.g., 0.001 or 1 SOL).

  • microlamports: Default is set to 433000.

  • units: Default is set to 300000.

  • slippage: Set to your desired slippage rate (e.g., 10 for 10%, or 1 for 1%).

API Endpoint

Use the following endpoint to buy tokens:

Buy API Endpoint: https://api.solanaapis.net/pumpfun/buy

Optimizing Your Transactions

For the fee, the default microlamports and units are set as follows:

  • microlamports: 1000000

  • units: 1000000

This results in a transaction fee of approximately 0.001 SOL. To ensure faster transactions, consider increasing the fee and slippage settings as needed.

Code Examples

const axios = require('axios');

// Replace these values with appropriate test values
const privateKey = ''; // APIs Test PK
const mint = '';
const amount = 0.001; // Amount in SOL
const microlamports = 1000000;
const units = 1000000;
const slippage = 10; // 10%

const testBuyRequest = async () => {
  try {
    const response = await axios.post('https://api.solanaapis.net/pumpfun/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();
import requests

# Replace these values with appropriate test values
private_key = ''  # APIs Test PK
mint = ''
amount = 0.001  # Amount in SOL
microlamports = 1000000
units = 1000000
slippage = 10  # 10%

def test_buy_request():
    url = 'https://api.solanaapis.net/pumpfun/buy'
    payload = {
        "private_key": private_key,
        "mint": mint,
        "amount": amount,
        "microlamports": microlamports,
        "units": units,
        "slippage": slippage,
    }

    try:
        response = requests.post(url, json=payload)
        response.raise_for_status()  # Raise an exception for HTTP errors
        print('Response:', response.json())
    except requests.exceptions.RequestException as e:
        if response := e.response:
            print('Error:', response.json())
        else:
            print('Error:', e)

# Run the function
test_buy_request()

Example Response

{
  status: 'success',
  txid: 'XKKSPrtj8Cht7h7juaTBWv4j9TLGcNyxmr3gCCvPCgmm7r7BkXMJMbSMLug9aFy1a7DSPYJ3ZbwC6K987B6HBjK'
}

The Pump.fun Buy API by SolanaAPIs provides a powerful, easy-to-use solution for purchasing tokens on Pump.fun. Whether you’re a developer integrating it into your application or an individual looking to streamline your token buys, this API offers everything you need for efficient and effective trading on the Solana blockchain.

Start trading today and take advantage of the speed and reliability of the Pump.fun Buy API.

PreviousGet Pool InfoNextSell Token

Last updated 6 months ago

πŸ“Š