Bonk.fun API
New tokens, migrations, and price changes
The SolanaStreaming WebSocket API represents Bonk.fun launches as Raydium LaunchLab events. Filter with
subExchange: ["bonkfun"] to discover Bonk.fun pools and follow their swaps. Tokens that
migrate out of LaunchLab are reported as new pools with pair.migration set to
raydium_launchlab. See example code snippets for different use cases below.
Install ws with npm install ws and set
YOUR_API_KEY_HERE. Each example below opens its own authenticated connection.
Subscribe to new Bonk.fun pools
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
ws.send(JSON.stringify({
method: "newPairSubscribe",
params: { include: { subExchange: ["bonkfun"] } }
}));
console.log("Listening for new Bonk.fun pools...");
});
ws.on("message", raw => {
const message = JSON.parse(raw.toString());
if (message.error) return console.error("API error:", message.error);
if (message.params)
console.log("New Bonk.fun pool:", message.params);
});
ws.on("error", console.error);
Subscribe to LaunchLab migrations
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
ws.send(JSON.stringify({
method: "newPairSubscribe",
params: { include: { migration: ["raydium_launchlab"] } }
}));
console.log("Listening for LaunchLab migrations...");
});
ws.on("message", raw => {
const message = JSON.parse(raw.toString());
if (message.error) return console.error("API error:", message.error);
if (message.params)
console.log("LaunchLab migration:", message.params);
});
ws.on("error", console.error);
Subscribe to a single Bonk.fun token for price changes by mint address
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
ws.send(JSON.stringify({
method: "swapSubscribe",
params: { include: { baseTokenMint: ["TOKEN_MINT_HERE"] } }
}));
console.log("Listening for Bonk.fun token price changes...");
});
ws.on("message", raw => {
const message = JSON.parse(raw.toString());
if (message.error) return console.error("API error:", message.error);
if (message.params)
console.log("Bonk.fun token price change:", message.params);
});
ws.on("error", console.error);
Subscribe to a single Bonk.fun token for price changes by pool address
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
ws.send(JSON.stringify({
method: "swapSubscribe",
params: { include: { ammAccount: ["POOL_ADDRESS_HERE"] } }
}));
console.log("Listening for Bonk.fun pool price changes...");
});
ws.on("message", raw => {
const message = JSON.parse(raw.toString());
if (message.error) return console.error("API error:", message.error);
if (message.params)
console.log("Bonk.fun pool price change:", message.params);
});
ws.on("error", console.error);
Subscribe to all Bonk.fun pool price changes
const WebSocket = require("ws");
const ws = new WebSocket("wss://api.solanastreaming.com/", {
headers: { "X-API-KEY": "YOUR_API_KEY_HERE" }
});
ws.on("open", () => {
ws.send(JSON.stringify({
method: "swapSubscribe",
params: { include: { subExchange: ["bonkfun"] } }
}));
console.log("Listening for Bonk.fun price changes...");
});
ws.on("message", raw => {
const message = JSON.parse(raw.toString());
if (message.error) return console.error("API error:", message.error);
if (message.params)
console.log("Bonk.fun price change:", message.params);
});
ws.on("error", console.error);
The pair filter uses OR matching; check pair.subExchange or
pair.migration to classify notifications. LaunchLab migration events can have a different
destination exchange, so check pair.sourceExchange to determine where a pool was created.
Swap notifications contain the observed price in swap.quotePrice. QuotePrice
is denoted in the quote token of the swap. To get the usdPrice you must convert the quoteToken to USD.
See the new-pair reference and swap reference.
Bonk.fun WebSocket API FAQ
How do I subscribe only to Bonk.fun pools?
Send newPairSubscribe with
params.include.subExchange: ["bonkfun"]. Bonk.fun is a LaunchLab sub-exchange, so its
sourceExchange value is raydium_launchlab.
How do I track Bonk.fun swaps?
Send swapSubscribe with params.include.subExchange: ["bonkfun"]. Read
swap.quotePrice from each swapNotification for the observed trade price.