Skip to content

Memecoin data in JavaScript

Updated

Plain fetch is all it takes. Keep the key on a server in production; the browser examples are for trying it out.

Key

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

A two-line client

JavaScript
const KEY = process.env.MEMECOIN_API_KEY;
const meme = async (path, init = {}) => {
  const r = await fetch("https://api.crypto2api.com/v1/memecoin" + path, { ...init, headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json", ...init.headers } });
  if (!r.ok) throw new Error((await r.json()).error?.message);
  return (await r.json()).data;
};

Launches, graduations, one coin

JavaScript
const { launches } = await meme("/launches?limit=10");
const { graduating } = await meme("/graduating");
const coin = await meme(`/token/${launches[0].mint}`);
console.log(coin);

Stream

Node 22+ has WebSocket built in.

JavaScript
const ws = new WebSocket("wss://api.crypto2api.com/v1/memecoin/stream?key=" + KEY);
ws.onopen = () => ws.send(JSON.stringify({ subscribe: "launches" }));
ws.onmessage = (m) => console.log(JSON.parse(m.data));

Endpoints in this guide

Questions

Does it work in the browser?
Yes, CORS is open. Do not ship your key in public front-end code; call it from your server.
Is there an OpenAPI spec?
Yes, at /openapi.json on the API host, so you can generate a typed client.

More guides

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