Curve API
Discover Legendary launches, read market data, and build unsigned curve swaps on Solana mainnet.
Use https://api.legendary.fun as the base URL. Requests need no API key or Legendary account. Try launch discovery.
Endpoints
GET /v1/launches- Search and page through indexed Legendary launches.
GET /v1/launches/{mint}- Read market state, metadata, and the canonical pool after graduation.
GET /v1/launches/{mint}/chart- Read historical prices and volume.
GET /v1/launches/{mint}/trades- Read finalized fills from the shared index.
POST /v1/quotes/buy- Quote a curve buy in SOL lamports.
POST /v1/quotes/sell- Quote a curve sell in token base units.
POST /v1/transactions/trade- Build an unsigned curve swap from an accepted quote.
JSON responses identify schema: 1 and network: "solana:mainnet". Browser requests use credentials: 'omit'. Send POST bodies as application/json and leave out authorization headers.
Discover and track launches
curl 'https://api.legendary.fun/v1/launches?query=LMEOW&limit=20'Discovery automatically adds eligible finalized Legendary Factory launches, including inactive and graduated coins. A new coin can take a scan to appear. The catalog holds up to 1,024 launches. At capacity it retains the oldest eligible launches and reports coverage.truncated: true. Newer launches outside that window are unavailable for public lookup, quotes, and builds.
The optional query searches mint, name and ticker by case-insensitive substring after trimming, with an exact mint match taking priority. It accepts up to 96 characters. Results are ordered by mint. limit accepts 20 or 50 and defaults to 50.
Pass nextCursor as cursor with the same query and limit until it is null. On 409 MAINNET_DISCOVERY_CURSOR, restart at the first page and deduplicate by mint. Use coverage.complete, coverage.stale, coverage.truncated and coverage.skipped to judge catalog coverage. coverage.metadataComplete describes metadata coverage, and an individual metadata can be null. asOfMs is the response time. Read coverage.observedSlot for the observed chain slot.
Market data and history
- Launch detail
- Use
market.phaseto check for an open curve,market.decimalsfor token precision, andmarket.observedAtMsandmarket.observedSlotfor the observation. Prices are ratios of integer strings with an explicit unit. Anullprice means it is unavailable. Keep the same mint across graduation and usemarket.poolfor the canonical Raydium pool when available. - Chart
- Choose
intervalfrom1m,5m,15m(default),1h,4h,24h, or7d. Each page contains up to 200 buckets in ascending time order. PassnextBeforeas the exclusivebeforeboundary with the same interval. Anullcontinuation ends the available history. - Trades
- Set
limitto 1–50 (default 50). The feed contains finalized fills ordered by descending minute and event ID. PassnextCursorascursorwith the same mint and limit until it isnull. On409 CURSOR_CHANGED, restart and deduplicate by tradeid.
Candle and trade time, before and coverage.finalizedThroughTime use Unix seconds. Chart OHLC ratios use integer strings in SOL per whole token and use the swap-movement price series. baseVolume and trade baseUnits are token base units. quoteVolume and trade quoteLamports are lamports and use the indexed execution convention. The chart can include provisional fills. Check freshness and history coverage before displaying a series as current or complete. Discovery coverage is separate.
Quote and build a swap
Replace the wallet placeholder with the trader’s public signing address. That wallet funds the swap, pays fees and any required token-account rent, and owns the receiving account. For a sell, change side to sell and specify an amount the trader holds in the required token account.
Use a positive integer string for amount. A buy uses lamports (1 SOL equals 1,000,000,000 lamports). A sell uses token base units (one whole token equals 10 raised to market.decimals). slippageBps is an integer from 10 to 1500. The quote and build apply current curve, balance and Shield checks.
1. Get and present the quote
The JavaScript example uses fetch and top-level await.
const api = 'https://api.legendary.fun/v1';
async function post(path, body) {
const response = await fetch(api + path, {
method: 'POST',
credentials: 'omit',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
const data = await response.json().catch(() => null);
if (!response.ok) {
throw new Error(data?.error?.code ?? String(response.status));
}
return data;
}
const side = 'buy';
const trade = {
wallet: '<trader-public-key>',
mint: '422DqsfnCANTP7vNToY7hdBaEXPE1qoc6CD9QyDGLGND',
amount: '10000000', // 0.01 SOL
slippageBps: 100, // 1%
};
const { quote } = await post('/quotes/' + side, trade);
console.log(quote);Review quote.inputBaseUnits, acceptedInputBaseUnits, refundBaseUnits, outputBaseUnits and minimumOutputBaseUnits. Input, accepted input and refund use the input asset’s units. Output and minimum use the output asset’s units. feeLamports, networkFeeLamports and ataRentLamports are separate.
2. Build after the trader accepts the quote
const build = await post('/transactions/trade', {
...trade,
side,
minimumOutputBaseUnits: quote.minimumOutputBaseUnits,
});
console.log(build.transaction.version, build.transaction.lastValidBlockHeight);The builder checks a fresh quote against the accepted minimum. On 409 QUOTE_MOVED, fetch and present a fresh quote for approval. Curve builds stop during migration and after graduation.
3. Verify, sign and submit in the wallet
Check the returned wallet, mint, side, inputAsset, outputAsset and quote.minimumOutputBaseUnits against the trader’s intent. transaction.wire is Base64. Verify the decoded message’s payer and instructions against the approved trade. transaction.packetSha256 hashes the decoded unsigned bytes. transaction.version is the number 0 with an available verified lookup table or the string "legacy".
Keep transaction.blockhash with its packet. Respect the top-level expirySlot and transaction.lastValidBlockHeight. These limits are decimal strings. Compare them numerically to their respective chain counters. The first limit reached governs. Have the specified trader sign and submit through their wallet or RPC. If a packet was already submitted, check its signature status before building a replacement.
Errors and retries
API errors include error.code, error.message, error.retryable and error.requestId. Use the code for branching and the request ID when reporting an issue. Allow for an upstream failure with no JSON response.
- 400, 405, 413, 415
- Check the parameters, HTTP method, 2 KiB request-body limit, and JSON content type.
- 404
- Check the route or mint. Consult catalog coverage if the mint is missing or newly launched.
- 409
- Restart changed cursors or request a fresh quote after
QUOTE_MOVED. HandleCURVE_UNAVAILABLE,BALANCE,REGISTRY,SHIELDandSLIPPAGEbefore trying again. - 429, 503
- Respect
Retry-Afteron 429 and use bounded backoff for transient failures. Keep requests sequential within a quote and build flow.
On-chain indexing
Indexers such as DEX Screener can cross-check fills using the public signature, slot, instruction, eventIndex, market and venue from trades. For a curve fill, market is the Factory launch address. After graduation it is the Raydium pool. The Solana mainnet Factory program is Fkeuw75FEAYUpudPNqFqMv2m2KzhSiLYArp1rd8baH1i.
Validate the finalized V0 buy, finalized V0 sell and atomic launch and first buy. Resolve loaded addresses when decoding V0 transactions. Count an atomic first buy in the final launch, and derive fills from executed balance changes. Third-party indexing and listing are managed by each platform.