Token Creation
PumpSwapApi provides an API for creating new tokens on the Pump.fun. This allows you to programmatically create tokens, ensuring full token lifecycle automatization
Endpoint
POST
https://pumpswapapi.fun/api/create/create-local
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
publicKey | string | Yes | bs58 public key of the creator wallet |
mint | string | Yes | bs58 public key for the mint |
metadata | object | Yes | Token metadata object |
metadata.name | string | Yes | The name of the token - must match one posted to pump.fun |
metadata.symbol | string | Yes | The token symbol (ticker) - must match one posted to pump.fun |
metadata.uri | string | Yes | The IPFS URL received from posting metadata to pump.fun |
devBuy | number | Yes | Amount of SOL to buy on the dev wallet after creation |
slippage | number | No | Slippage tolerance in percent (default: 1) |
priorityFee | number | No | Priority fee in SOL (default: 0.0001) |
Response
The API returns a serialized transaction that must be signed by the client wallet before submission to the Solana network.
{
"transaction": "base64_encoded_serialized_transaction"
}
Complete Example
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
const fetch = require('node-fetch');
const { Keypair, VersionedTransaction } = require('@solana/web3.js');
async function createToken() {
try {
// Step 1: Provide a mint keypair(either grind vanity pump adress or generate, for test we will just gen new one)
const mintKeypair = Keypair.generate();
// Step 2: Upload metadata
const formData = new FormData();
formData.append("file", await fs.openAsBlob("./logo.png")), // Image file
formData.append("name", "PSATest"),
formData.append("symbol", "PSA"),
formData.append("description", "This is an example token created via PumpSwapApi"),
formData.append("twitter", "https://x.com/PumpSwapApi"),
formData.append("telegram", "https://t.me/PumpSwapApi"),
formData.append("website", "https://pumpswapapi.fun"),
formData.append("showName", "true");
// Create IPFS metadata storage
const metadataResponse = await fetch("https://pump.fun/api/ipfs", {
method: "POST",
body: formData,
});
const metadataResponseJSON = await metadataResponse.json();
const metadataUri = metadataResponseJSON.uri;
// Step 3: Create the token
const response = await axios.post('https://pumpswapapi.fun/api/create/create-local', {
publicKey: 'YOUR_PUBLIC_KEY', // Replace with your wallet's public key
mint: mintKeypair.publicKey.toString(),
metadata: {
name: metadataResponseJSON.metadata.name,
symbol: metadataResponseJSON.metadata.symbol,
uri: metadataResponseJSON.uri
},
devBuy: 0.1 // Amount of SOL to buy on the dev wallet after creation
});
const { transaction: serializedTransaction } = response.data;
// Deserialize the transaction
const transaction = web3.VersionedTransaction.deserialize(
Buffer.from(serializedTransaction, 'base64')
);
// Connect to your preferred RPC endpoint
const connection = new web3.Connection('YOUR_RPC_ENDPOINT', 'confirmed');
// Important: For token creation, BOTH the user wallet and mint keypair must sign
const wallet = web3.Keypair.fromSecretKey(YOUR_PRIVATE_KEY);
// Sign the transaction with BOTH signers - the wallet and mint keypair
transactionVersioned.sign([wallet, mintKeypair]);
// Send the transaction
const signature = await connection.sendTransaction(transaction);
console.log('Transaction sent:', signature);
// Wait for confirmation
await connection.confirmTransaction(signature, 'confirmed');
console.log('Transaction confirmed!');
console.log('Token created successfully! Transaction signature:', signature);
console.log('Token mint address:', mintKeypair.publicKey.toString());
} catch (error) {
console.error('Error creating token:', error.response?.data || error.message);
}
}
Fee Structure
When creating tokens through PumpSwapApi, there are two fee components to be aware of:
Token Creation Fees: Standard fees charged by pump.fun for token creation. These are the same fees you would pay when creating a token directly on the pump.fun website.
Dev Buy Fees: If you choose to make a dev purchase after token creation (using the
devBuy
parameter), this transaction will incur the standard transaction fees on the Solana network plus any applicable pump.fun trading fees.
Note: The token creation itself only incurs the standard fees charged by pump.fun. There are no additional service fees for using the PumpSwapApi beyond what you would pay on pump.fun directly.
Token Metadata
POST
https://pump.fun/api/ipfs
Parameters
The metadata is uploaded as multipart/form-data
with the following fields:
Parameter | Type | Required | Description |
---|---|---|---|
file | File | Yes | The token image file |
name | string | Yes | The name of the token |
symbol | string | Yes | The token symbol (ticker) |
description | string | No | Description of the token |
twitter | string | No | Twitter/X URL |
telegram | string | No | Telegram URL |
website | string | No | Website URL |
Response
The API returns a JSON object containing the URI for the uploaded metadata:
{
"metadata": {
"name": "Test Token",
"symbol": "TEST",
"description": "Test Token Description",
"image": "https://ipfs.io/ipfs/foobarhashpumpfunimg",
"showName": true,
"createdOn": "https://pump.fun",
"twitter": "https://twitter.com/test",
"telegram": "https://t.me/test",
"website": "https://example.com"
},
"metadataUri": "https://ipfs.io/ipfs/foobarhashpumpfunuri"
}