Skip to content

Build a memecoin bot: watch, filter, quote, swap

Updated

Every memecoin bot is the same four steps: hear about a coin, decide if it is worth touching, price the trade, send it. Memecoin API gives you each step as one call, and it never holds your keys: swaps come back unsigned, and your code signs them with your wallet.

1. Key

Free, one call.

curl
curl -X POST https://api.crypto2api.com/v1/keys
# {"key":"c2a_…", ...}  keep it: the first 100 calls every day are free

2. Hear about coins

Subscribe to graduations (coins that just left the pump.fun curve) or launches over the WebSocket stream.

JavaScript
const KEY = "c2a_your_key";
const ws = new WebSocket("wss://api.crypto2api.com/v1/memecoin/stream?key=" + KEY);
ws.onopen = () => ws.send(JSON.stringify({ subscribe: "graduations" }));
ws.onmessage = async (m) => {
  const e = JSON.parse(m.data);
  if (e.mint) await consider(e.mint);
};

3. Filter out the traps

Ask for the safety score and skip anything under your line. Cheap, and it removes most of the coins that cannot be sold.

JavaScript
const H = { Authorization: "Bearer " + KEY };
async function consider(mint) {
  const s = (await (await fetch(`https://api.crypto2api.com/v1/memecoin/token/${mint}/safety`, { headers: H })).json()).data;
  if (s.score < 60) return;
  const q = await (await fetch("https://api.crypto2api.com/v1/memecoin/quote", {
    method: "POST",
    headers: { ...H, "Content-Type": "application/json" },
    body: JSON.stringify({ mint, amount: 0.1, side: "buy", slippage_bps: 500 }),
  })).json();
  console.log(mint, s.score, q.data);
}

4. Get the swap and sign it

POST /v1/memecoin/swap with mint, wallet (your public address) and amount answers an unsigned transaction. It is simulated first; one that would fail is refused instead of returned. Sign it with your wallet library and send it to any Solana RPC.

Python
import base64, requests
from solders.keypair import Keypair
from solders.transaction import VersionedTransaction

me = Keypair.from_base58_string("YOUR_SECRET")  # stays on your machine
r = requests.post(
    "https://api.crypto2api.com/v1/memecoin/swap",
    headers={"Authorization": "Bearer c2a_your_key"},
    json={"mint": "MINT", "wallet": str(me.pubkey()), "amount": 0.1, "side": "buy"},
).json()["data"]
print(r)  # an unsigned transaction: sign it with `me`, then send it to your RPC

5. Know when to get out

/wallet/:wallet/pnl?mint= answers what your wallet spent and got back on one coin. /creator-trades tells you the moment the dev sells. /sell-test tells you whether a sell still goes through.

Endpoints in this guide

Questions

Does the API hold my private key?
Never. Swaps are returned unsigned; you sign them yourself.
What does a bot cost to run?
The first 100 calls each day are free. After that a safety check is $0.005, a quote $0.002, a swap $0.005 and the stream $0.002 a minute.
Is this financial advice?
No. It is a data and transaction-building API. Most memecoins go to zero.

More guides

All endpoints · Pricing · Compared with other APIs · Get a key