Pumpfun API
  • πŸ’ŠPumpfun API – Your Unofficial Gateway to Effortless Token Trading
  • Api Endpoints
    • πŸ’΅Buy Tokens
    • πŸ’΅Sell Tokens
    • πŸ’ŠCreate Token
    • Stream New Tokens
    • πŸ“ˆToken Price
Powered by GitBook
On this page
  1. Api Endpoints

Buy Tokens

Seamlessly purchase tokens from the latest bonding curves on Pump.fun through PumpfunApi. This robust and user-friendly API is designed for speedy, efficient, and convenient trading on the Solana

PreviousPumpfun API – Your Unofficial Gateway to Effortless Token TradingNextSell Tokens

Last updated 5 months ago

WHY USE THE PUMP.FUN BUY API? The Pump.fun Buy API from PumpfunApi allows you to acquire tokens with a simple POST request. This streamlined process ensures rapid transaction confirmations, low overhead, and minimal hassle for individuals or developers who want to integrate token purchases on Pump.fun.

KEY FEATURES:

  1. Fast and Efficient Trading Experience rapid transaction processing that keeps you ahead in the competitive Solana ecosystem.

  2. Easy Integration Effortlessly incorporate the API into any programming language or development environment, making setup and usage as smooth as possible.

  3. Customizable Parameters Tailor your token purchases by configuring slippage rates and fee settings according to your needs.

HOW TO BUY TOKENS ON PUMP.FUN USING PUMPFUNAPI: Send a POST request to the Pump.fun Buy API endpoint with the following parameters:

  1. private_key Your main wallet key, which covers transaction costs and fees.

  2. mint The token mint address for the asset you intend to buy.

  3. amount The amount in SOL you plan to spend (e.g., 0.001 or 1.0).

  4. microlamports (Default: 433000) Manages the base fee for the transaction.

  5. units (Default: 300000) Works in tandem with microlamports to determine transaction speed and cost.

  6. slippage A rate set in whole numbers. For example, 10 denotes 10% slippage, 1 denotes 1%, etc.

API ENDPOINT Buy API Endpoint:

OPTIMIZING YOUR TRANSACTIONS The default fee settings are microlamports=1000000 and units=1000000, resulting in approximately 0.001 SOL per transaction. If you require even faster processing, consider raising the fee and slippage settings to meet your specific trading needs.

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.pumpfunapi.org/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.pumpfunapi.org/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: '', txid: '' }

CONCLUSION The Pump.fun Buy API provided by PumpfunApi offers a powerful, straightforward approach for purchasing tokens on Pump.fun via the Solana blockchain. Whether you’re integrating it into a larger application or simply looking for an easy way to buy tokens, this API delivers the speed, reliability, and flexibility you need for optimal trading. Take advantage of these features today to enhance your Solana-based token purchasing experience.

πŸ’΅
https://api.pumpfunapi.org/pumpfun/buy