DEV Community

Nationz
Nationz

Posted on

How to trade on Pump.fun using the API

How to

Key Features

The API offers a variety of tools to help you get the most out of Pump.fun, including:

Buy and Sell Trades

Place trades on Pump.fun programmatically, giving you the ability to automate your trading strategy and react quickly to market changes.

Newer Mints Details

Get access to details on new mints on Pump.fun, allowing you to stay ahead of the curve and make informed investment decisions.

Token Metadata Fetching

Fetch metadata for tokens on Pump.fun, providing you with valuable insights into the tokens you're interested in.

Pump.fun Specific Data

Query data specific to Pump.fun, giving you a deeper understanding of the platform and its inner workings.

Swap Quotes

Fetch swap quotes and input/output details, making it easier to make informed trading decisions.

Essential Links

To get started with our API, be sure to check out the following links:

API Endpoint: https://pumpapi.fun/api - Make API requests here

Documentation: https://docs.pumpapi.fun - Learn how to use our API

const axios = require('axios');



const url = "https://pumpapi.fun/api/trade";

const data = {
    trade_type: "sell",
    mint: "YOUR_MINT_ADDRESS",
    amount: 1000,  # Example amount of tokens
    slippage: 2,
    priorityFee: 500,  # Optional
    userPrivateKey: "WALLET_PRIVATEKEY"
};

axios.post(url, data)
  .then(response => {
    const transactionId = response.data.tx_hash;
    console.log(`Transaction ID: ${transactionId}`);
  })
  .catch(error => {
    console.error(error);
  });
Enter fullscreen mode Exit fullscreen mode

The response is:

{

  "tx_hash": "2wJWJW4Ln7N5EA8WnThaq4m4tgH6TPxcPYMP9ZN1VhyD...."

}}

Enter fullscreen mode Exit fullscreen mode

More endpoint details are on:

https://docs.pumpapi.fun/

Top comments (0)