For developers
REST API
The public read API for tokens, pools, trades, candles, quotes and wallets, with real example responses.
On this page
The REST API serves the data service's copy of what happened on chain. It is what the web app uses for lists, charts, history and quotes.
| Devnet base URL | https://api-devnet.poffertswap.fun |
| Format | JSON. Every response is JSON, including errors. |
| Method | GET for reads. The only POST endpoints are the two uploads. |
The API is a convenient copy of the chain, kept in sync within seconds. For anything that moves money, such as the exact reserves to quote against, read the accounts on chain (see The program). Quotes from this API are for bots and for checking, not a substitute for the on-chain minimum you set on a trade.
Conventions#
- Amounts are strings in raw units (lamports for SOL, base units for tokens), so large numbers never lose precision. Convenience values such as
priceSolandmarketCapSolare plain numbers. - Addresses are base58 strings.
SOLis accepted as an alias for wrapped SOL where a mint is expected. - Times are Unix seconds.
- Lists return
{ "items": [...], "nextCursor": "..." }. PassnextCursorback ascursorfor the next page. WhennextCursorisnull, you are at the end. Treat cursors as opaque. - Limits:
limitdefaults to 50 and may be 1 to 100 (candles: up to 1,000). Token and pool lists page up to 1,000 items deep. - Errors:
{ "error": { "code": "NOT_FOUND", "message": "…" } }with a matching HTTP status. Codes you may see:BAD_REQUEST(400, with a message that names the bad parameter),NOT_FOUND(404),FORBIDDEN(403, a browser origin that is not allowed),RATE_LIMITED(429). - Browsers: a browser may only call the API from an allowed origin (the PoffertSwap web app). Servers, scripts and bots that send no
Originheader are not restricted by this. - Caching: responses are cached at the edge for a few seconds (lists 3 s, a single token 2 s, candles 5 s for the open bar). Polling faster returns the same answer. For real-time data use the live feed.
Tokens#
| Request | Description |
|---|---|
GET /api/tokens |
List tokens. Query: sort = new, trending, mcap, graduating or last_trade (default new); status = curve or graduated; cursor; limit. |
GET /api/tokens/king |
The curve with the highest progress ("King of the hill"). |
GET /api/tokens/{mint} |
One token with its curve state and pool link. |
GET /api/tokens/{mint}/trades |
Trades of a token, newest first, curve and pool together. Query: cursor, limit. |
GET /api/tokens/{mint}/candles |
OHLCV bars, oldest first. Query: interval (1m, 5m, 15m, 1h, 4h, 1d), from, to (Unix seconds), limit (up to 1,000). Curve and pool bars are merged. |
GET /api/tokens/{mint}/holders |
The 20 largest holders, with the curve and pool vaults labeled. Cached for 30 seconds. |
GET /api/search?q= |
Search by name, ticker or mint. q needs at least 2 characters. % and _ are treated as plain characters. |
A token, as returned (shortened):
{
"mint": "4MrJugyJuSWnpPiLe7k3vkuCGGHfjg4cZFEjjFL3osJ7",
"name": "LiveUi",
"symbol": "LV228",
"uri": "https://assets-devnet.poffertswap.fun/m/test.json",
"imageUrl": null,
"description": null,
"socials": { "twitter": null, "telegram": null, "website": null },
"creator": "J8RafoRjUHfT9Fh6szrfAs65SRStZo3f6QFdnjKtMA6s",
"status": "curve",
"priceSol": 2.8879392827514068e-8,
"marketCapSol": 28.879392827514067,
"marketCapUsd": 1997.15,
"progressBps": 217,
"realSol": "489795918",
"realTokens": "775863052225657",
"virtualSol": "30489795918",
"virtualTokens": "1055763052225657",
"totalSupply": "1000000000000000",
"volume24hSol": 0.991685562,
"trades24h": 3,
"poolAddress": null,
"createdAt": 1795517525,
"lastTradeAt": 1795517532,
"graduatedAt": null
}
statusiscurve,complete(full, waiting for its pool) orgraduated.progressBpsis progress in basis points (217 means 2.17%).imageUrl,descriptionandsocialsare filled from the token's metadata when it points at the PoffertSwap asset domain. A token whoseuriis anywhere else has them empty, because the service only ever reads its own storage.
A trade (shortened):
{
"signature": "KZyNxwzg388Mz2dXjLrS5pwnvpPsCRP9tEoCbccESnCZv8asS2DsfavEgBgPpKbDZhuaWVgtGSqHVjangFw9iMS",
"eventIndex": 0,
"venue": "curve",
"market": "4MrJugyJuSWnpPiLe7k3vkuCGGHfjg4cZFEjjFL3osJ7",
"mint": "4MrJugyJuSWnpPiLe7k3vkuCGGHfjg4cZFEjjFL3osJ7",
"trader": "J8RafoRjUHfT9Fh6szrfAs65SRStZo3f6QFdnjKtMA6s",
"side": "sell",
"solAmount": "250944822",
"tokenAmount": "8618473887171",
"feeTotal": "3136811",
"priceSol": 2.911708328936786e-8,
"slot": 525766115,
"time": 1795517532
}
A candle response:
{ "interval": "1h", "bars": [ { "time": 1795514400, "open": 2.8887e-8, "high": 2.9357e-8, "low": 2.8879e-8, "close": 2.8879e-8, "volumeSol": 0.991685562, "trades": 3 } ] }
Pools#
| Request | Description |
|---|---|
GET /api/pools |
List pools. Query: sort = tvl, volume or new; mint (only pools containing this token); cursor; limit. |
GET /api/pools/{address} |
One pool: reserves, fee, LP supply, TVL. |
GET /api/pools/{address}/trades |
Swaps of a pool, newest first. |
GET /api/pools/{address}/candles |
OHLCV bars of a pool. |
GET /api/pools/{address}/liquidity |
History of liquidity added and removed. |
A pool (shortened):
{
"address": "3XMNs7vqBQ3xPtE8DxeQ3zdq3DLuFpAFmR2DhcJ5DFSX",
"mintA": "So11111111111111111111111111111111111111112",
"mintB": "7RzuGU7TBdjSKKvc1xLUog98XVAm9L1ETSgKnz1weC3c",
"lpMint": "ChKfFQc79HQWVLcnM1t3RTRPk5Fe3GEH1ykC3ecfxgqk",
"origin": "permissionless",
"creator": null,
"reserveA": "736213810",
"reserveB": "679976590",
"lpSupply": "707106781",
"feeBps": 25,
"isSolPool": true,
"priceRaw": 0.9236129243487025,
"priceSol": 0.00108270464134655,
"tvlSol": 1.47242762,
"tvlUsd": 101.83,
"volume24hUsd": 0,
"createdAt": 1795521411
}
priceRaw is reserveB / reserveA in raw units. For pools of two non-SOL tokens, adjust for each token's decimals yourself.
Quotes#
GET /api/quote?input=<mint|SOL>&output=<mint|SOL>&amount=<raw>&mode=exact_in&slippageBps=100
| Parameter | Meaning |
|---|---|
input, output |
The two mints. SOL is an alias for wrapped SOL. |
amount |
A whole number in raw units. |
mode |
exact_in (default) or exact_out. |
slippageBps |
Slippage used to compute minAmountOut. |
{
"venue": "curve",
"route": ["4MrJugyJuSWnpPiLe7k3vkuCGGHfjg4cZFEjjFL3osJ7"],
"mode": "exact_in",
"amountIn": "100000000",
"amountOut": "3408885195664",
"minAmountOut": "3374796343707",
"fee": "1234568",
"refund": "0",
"priceImpactBps": 32,
"slot": 525766115
}
venueiscurve,poolortwo_hop.- A token on its curve is quoted on the curve, and once graduated on its pool. A curve that is full but not yet migrated cannot be quoted. Selling into a curve is exact-in only.
- Two-hop: two tokens with no direct pool are routed through SOL (exact-in only). The response adds
legs(the sell and the buy quote),route(the markets in order), the compoundedpriceImpactBps, and applies the slippage once to the final output. - Quotes are computed from the service's indexed state with the shared math, so they are exact for the returned
slot. The indexer trails the chain by seconds, so a trade you send is always protected by its on-chain minimum.
Users#
| Request | Description |
|---|---|
GET /api/users/{wallet}/trades |
A wallet's trade history. |
GET /api/users/{wallet}/created |
Tokens the wallet launched. |
GET /api/users/{wallet}/liquidity |
Pools the wallet has added liquidity to, estimated from the recorded additions and removals. Read live LP balances from the chain for exact figures. |
Platform#
| Request | Description |
|---|---|
GET /api/stats |
Totals: tokens launched and graduated, pools, trades, 24-hour volume and trades, the SOL/USD price and the indexer's position. |
GET /api/config |
The program id, the cluster and the launch defaults (curve, fees and the minimum liquidity). This is not the live on-chain configuration: the response says "source": "defaults". |
GET /api/health |
ok, the cluster, the age of the indexer's heartbeat (backfillAgeSeconds), any maintenance notice and the health of the RPC providers. |
/api/stats looks like this:
{ "tokens": 4, "graduated": 0, "pools": 2, "trades": 41, "trades24h": 27, "volume24hSol": 4.749, "volume24hUsd": 328.45, "solUsd": 69.155, "indexedSlot": 525796984, "indexerLagSeconds": 45893 }
indexerLagSeconds is the age of the newest recorded transaction. On a quiet network that can be hours, so it is informational. The signal that the data service is stuck is backfillAgeSeconds in /api/health: it should stay well under five minutes.
Uploads#
Two endpoints support launching a token. They are built for the PoffertSwap web app.
POST /api/upload#
Stores a token picture. A multipart/form-data body with two parts:
| Part | Meaning |
|---|---|
file |
A square, non-animated WEBP from 64 to 1,024 pixels on a side, at most 2 MB. The web app converts any picked picture to 512 × 512 in the browser. |
turnstile |
A one-time human-verification token from Cloudflare Turnstile. |
It answers { "imageUrl": "https://assets-devnet.poffertswap.fun/i/<64 hex characters>.webp" }. The file is stored under the hash of its bytes with a one-year immutable cache, so uploading the same picture again returns the same address. Anything that is not a well-formed square WEBP (SVG, PNG, JPEG, GIF, animated files, wrong sizes) is refused with BAD_IMAGE. One connection may upload 10 pictures per hour.
The verification token only works from the PoffertSwap web app's own domains, so this endpoint is not meant to be called from outside it. If you launch tokens from your own code, host the picture and the metadata file yourself and pass its address to create_token. The token will work on chain, but PoffertSwap's own pages only show a picture and description for metadata stored on its asset domain.
POST /api/metadata#
Stores a token's metadata as an immutable JSON file. A JSON body:
{
"name": "Poffertje",
"symbol": "POFF",
"description": "Tiny pancakes.",
"imageUrl": "https://assets-devnet.poffertswap.fun/i/<hash>.webp",
"twitter": "https://x.com/poffert",
"telegram": "",
"website": "https://poffertswap.fun"
}
Rules: name 1 to 32 bytes, symbol 1 to 10 bytes, description up to 500 characters, links empty or https:// only. imageUrl must be a picture uploaded through /api/upload: the service checks that it exists in its storage. The answer is { "uri": "https://assets-devnet.poffertswap.fun/m/<hash>.json" }, where the file name is the hash of the content, so the same input always gives the same address. This endpoint allows 30 requests per hour per connection. The file follows the common token-metadata layout (name, symbol, description, image, properties.files, and an extensions object for the links).
Upload errors#
| Code | Status | Meaning |
|---|---|---|
CAPTCHA_REQUIRED |
400 | The turnstile part is missing. |
CAPTCHA_FAILED |
403 | The verification did not pass. |
BAD_IMAGE |
415 or 413 | The file is not an accepted image. |
INVALID |
400 | A metadata field breaks a rule. The message says which. |
TOO_LARGE |
413 | The request is too big. |
RATE_LIMITED |
429 | Too many requests this hour. |