Create a token
Launch a pump.fun coin with its image, links and a first buy, in one transaction: priced in SOL, or in a custom pair (USDC, a tokenized stock, another coin), with Mayhem mode and holder rewards as options.
Three calls: POST /api/ipfs for the metadata URI, a fresh mint keypair (generated locally, it co-signs), then trade-local with action: "create". The create and the dev buy are one transaction.
Upload the image and details
Send them to POST /api/ipfs. You get back a
metadataUri.Make a mint keypair
A brand-new keypair that becomes the coin's address. It must sign the create too.
Ask for the create transaction
Use
action: "create"withtokenMetadataand the mint's public key.
Request fields
| Field | Type | Description |
|---|---|---|
| publicKey | string | Your wallet (the creator). |
| action | string | create. |
| mint | string | The public key of the new mint keypair. |
| tokenMetadata | object | { name, symbol, uri }: uri is the metadataUri from /api/ipfs. Name up to 32 characters, symbol up to 10. |
| amount | number | Your dev buy, in the quote asset (SOL by default; USDC / the stock / the coin on a custom pair). 0 for no buy. |
| denominatedInSol | "true" | Keep "true" (alias of denominatedInQuote: the dev buy is in the quote asset). |
| slippage | number | For the dev buy. Default 10. |
| priorityFee | number | SOL. Default 0.00005. |
| denominatedInQuote | "true" | Same as denominatedInSol, the name that reads right on a custom pair. |
| quoteMint | string | What the coin is priced and traded in: a symbol or mint from GET /api/sol/pairs (USDC, SPYx, WBTC, PUMP…) or any pump.fun coin's mint. Default SOL. See Custom pairs. |
| mayhemMode | boolean | pump.fun's trading agent trades the coin for its first 24 h (2 B supply, no synthetic migration). SOL or USDC quotes only (422 mayhem_quote_not_allowed). See Mayhem mode. |
| creatorFeeBps | number | Your own creator fee in basis points (100 = 1 %), custom pairs only and within the on-chain range (422 creator_fee_not_allowed otherwise). Omit for pump.fun's schedule. Fixed at creation. |
| holderReward | boolean | The creator fee goes to the coin's holders instead of you, forever (the creator becomes the holder-rewards PDA). 422 holder_reward_disabled while pump.fun has it off. |
Full example
import fs from 'node:fs'
import { Keypair, VersionedTransaction } from '@solana/web3.js'
import bs58 from 'bs58'
const BASE = 'https://api.trenchy.tools', API_KEY = 'YOUR_API_KEY'
const wallet = Keypair.fromSecretKey(bs58.decode(process.env.SOL_PRIVATE_KEY))
// 1. Upload image + details
const form = new FormData()
form.append('file', new Blob([fs.readFileSync('./logo.png')], { type: 'image/png' }), 'logo.png')
form.append('name', 'My Coin')
form.append('symbol', 'MYC')
form.append('description', 'The best coin')
form.append('twitter', 'https://x.com/mycoin')
form.append('website', 'https://mycoin.fun')
const { metadataUri } = await fetch(`${BASE}/api/ipfs?api-key=${API_KEY}`, { method: 'POST', body: form }).then((r) => r.json())
// 2. A new mint keypair (this becomes the coin's address)
const mint = Keypair.generate()
// 3. Create + dev buy in one transaction
const res = await fetch(`${BASE}/api/sol/trade-local?api-key=${API_KEY}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
publicKey: wallet.publicKey.toBase58(),
action: 'create',
mint: mint.publicKey.toBase58(),
tokenMetadata: { name: 'My Coin', symbol: 'MYC', uri: metadataUri },
amount: 0.1, // dev buy: 0.1 SOL
denominatedInSol: 'true',
slippage: 10,
priorityFee: 0.0005,
}),
})
const tx = VersionedTransaction.deserialize(new Uint8Array(await res.arrayBuffer()))
tx.sign([wallet, mint]) // both must sign
const sent = await fetch(`${BASE}/api/sol/send?api-key=${API_KEY}`, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ transaction: Buffer.from(tx.serialize()).toString('base64') }),
}).then((r) => r.json())
console.log('https://pump.fun/coin/' + mint.publicKey.toBase58(), sent.signature)
Custom pairs, Mayhem mode, holder rewards
A coin can be priced in something other than SOL: USDC, an xStocks tokenized stock (SPYx, NVDAx…), WBTC, PUMP or another pump.fun coin. Pass the pair as quoteMint; amount is then in that asset and your wallet must hold it (we answer 409 no_quote_balance with needed, have and the token account to fund). Our fee is still a small SOL transfer. The list of pairs is live on GET /api/sol/pairs.
{
"publicKey": "YOUR_WALLET",
"action": "create",
"mint": "NEW_MINT_PUBLIC_KEY",
"tokenMetadata": { "name": "Dollar Dog", "symbol": "DDOG", "uri": "https://ipfs.io/ipfs/…" },
"quoteMint": "USDC",
"amount": 10,
"denominatedInQuote": "true",
"slippage": 10
}
// priced in SPYx (an xStocks S&P 500 token); the dev buy is 2 SPYx; creator fee 1 %
{ "publicKey": "YOUR_WALLET", "action": "create", "mint": "NEW_MINT", "tokenMetadata": { "name": "Spy Cat", "symbol": "SPYCAT", "uri": "…" },
"quoteMint": "SPYx", "amount": 2, "creatorFeeBps": 100 }
// Mayhem mode on a plain SOL coin: pump.fun's agent trades it for 24 h
{ "publicKey": "YOUR_WALLET", "action": "create", "mint": "NEW_MINT", "tokenMetadata": { "name": "Chaos", "symbol": "CHAOS", "uri": "…" },
"amount": 0.5, "mayhemMode": true }
{
"transaction": "AQAAAAAAAAAAAAAA…", // base64, unsigned: sign with the wallet AND the mint keypair
"encoding": "base64",
"expected": { "tokens": 32258064.51, "quoteAmount": 10 }, // "sol" is added for SOL coins
"feeSol": 0.0001, // our fee, always SOL
"mint": "NEW_MINT",
"quote": { "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "symbol": "USDC", "decimals": 6 },
"venue": "pump",
"mayhem": { "enabled": false }, "holderReward": false, "creatorFeeBps": 0, "depth": 0
}
creatorFeeBps works on custom pairs only (SOL and USDC coins pay pump.fun's schedule). Holder rewards are permanent.