Skip to main content

Introduction

In this tutorial, you’ll learn how to retrieve Pump.fun token data using the Moralis Solana API. Pump.fun is a popular token launchpad on Solana where new tokens go through bonding curve phases before graduating to DEXs. You’ll learn how to fetch newly created tokens, tokens in bonding phase, and graduated tokens. We’ll use the following Moralis API endpoint:

Prerequisites

Step 1: Set Up Your Project

Create a new directory for your project and initialize it:
mkdir pump-fun-tokens && cd pump-fun-tokens
npm init -y

Step 2: Create the Script

Create a file called index.js and add the following code:
// index.js
const API_KEY = 'YOUR_API_KEY';

async function getNewPumpFunTokens() {
  const response = await fetch(
    'https://solana-gateway.moralis.io/token/mainnet/exchange/pumpfun/new',
    {
      headers: {
        'X-API-Key': API_KEY,
      },
    }
  );

  const data = await response.json();
  console.log(JSON.stringify(data, null, 2));
}

getNewPumpFunTokens();
Replace YOUR_API_KEY with your actual Moralis API key.

Step 3: Run the Script

node index.js

Example Response

{
  "result": [
    {
      "tokenAddress": "ABC123...",
      "name": "Example Token",
      "symbol": "EXT",
      "logo": "https://...",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "marketCap": 15000,
      "priceUsd": 0.000015,
      "volume24h": 5000,
      "holders": 150,
      "bondingProgress": 5.5,
      "isGraduated": false
    }
  ]
}

Understanding the Response

FieldDescription
tokenAddressThe Solana token mint address
nameToken name
symbolToken symbol
createdAtWhen the token was created
marketCapCurrent market cap in USD
priceUsdCurrent price in USD
volume24h24-hour trading volume
holdersNumber of unique holders
bondingProgressProgress through bonding curve (0-100%)
isGraduatedWhether token has graduated to DEX

Understanding Pump.fun Token States

StateDescription
NewRecently created tokens (less than 24 hours old)
BondingTokens in bonding curve with 20%+ progress
GraduatedTokens that completed bonding and are on DEXs

Next Steps