Create a token
Launch a pump.fun coin with its image, links and a first buy, in one transaction.
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.
POSThttps://api.trenchytools.lol/api/sol/trade-local
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 SOL. 0 for no buy. |
| denominatedInSol | "true" | Keep "true". |
| slippage | number | For the dev buy. Default 10. |
| priorityFee | number | SOL. Default 0.00005. |
Full example
import fs from 'node:fs'
import { Keypair, VersionedTransaction } from '@solana/web3.js'
import bs58 from 'bs58'
const BASE = 'https://api.trenchytools.lol', 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)
Coins are created as Token-2022 with the dev buy folded in, the same shape the pump.fun website makes.