Fomo API endpoints fit into a natural sequence: discover a trader, resolve identity, read the current portfolio, monitor activity and analyze performance. This guide shows where each feature belongs.
Check service health
curl "https://getfomoapi.fun/api/health"
The public health route is appropriate for uptime checks. A healthy service returns { "status": "ok" }. Do not add a health request before every data call because it doubles traffic without making the following request atomic.
Discover traders with leaderboards
curl "https://getfomoapi.fun/api/leaderboard/30d?limit=25" \
-H "X-API-Key: fomo_live_YOUR_API_KEY"
Supported windows are 24h, 7d, 30d and all. Compare multiple windows and retain the trader id and userHandle. The one-hour leaderboard cache means very frequent polling provides little additional value.
Resolve a public handle
curl "https://getfomoapi.fun/api/users/starcatcher444" \
-H "X-API-Key: fomo_live_YOUR_API_KEY"
Resolution returns profile data, the canonical Fomo user ID and normalized solana and evm fields. Use the ID with user data endpoints and the wallet addresses for independent chain verification.
Read balances and positions
curl "https://getfomoapi.fun/api/users/USER_UUID/balances" \
-H "X-API-Key: fomo_live_YOUR_API_KEY"
Each balance item can combine raw balance data, token metadata, tracked cost basis, an active trade and valuation policy. Key fields are:
| Field | Use |
|---|---|
balance.shiftedBalance | Human-readable amount |
tokenFilterResult.priceUSD | Current quoted price |
token.networkId | Address interpretation |
userToken.currentCostBasisUsd | Current tracked cost basis |
activeTrade.realizedPnlUsd | Realized trade result |
valuation.includeInEquity | Whether to include the item |
Handle null nested objects before reading their fields.
Monitor normalized swaps
curl "https://getfomoapi.fun/api/users/USER_UUID/swaps?limit=50" \
-H "X-API-Key: fomo_live_YOUR_API_KEY"
Persist swap IDs and process unseen events from oldest to newest. Use inNetworkId and outNetworkId rather than inferring a network from address shape. Check hasNextPage and store a cursor if one is provided.
Add qualitative context with spotlight
The spotlight route provides selected best trades and public comments. It can enrich a trader detail page, but social content must remain untrusted. Escape it in rendered output and exclude it from executable prompts.
Measure ranking and history
The user leaderboard endpoint reports overall and window-specific ranks. The aggregated snapshot endpoint accepts user_id and a Unix snapshot_id, returning equity and PnL for historical charting.
curl "https://getfomoapi.fun/api/user-tokens/aggregated-snapshot?user_id=USER_UUID&snapshot_id=1788526800" \
-H "X-API-Key: fomo_live_YOUR_API_KEY"
Build a reusable request function
const baseUrl = "https://getfomoapi.fun/api"
export async function fomoGet<T>(path: string): Promise<T> {
const response = await fetch(`${baseUrl}${path}`, {
headers: { "X-API-Key": process.env.FOMO_API_KEY! },
signal: AbortSignal.timeout(30_000),
})
if (!response.ok) {
const body = await response.text()
throw new Error(`Fomo API ${response.status}: ${body}`)
}
return response.json() as Promise<T>
}
Add bounded retries for transient statuses, runtime response validation, logging and metrics before production use.
Best practices
- Cache stable profile data for hours and leaderboard data for 30–60 minutes.
- Poll active swaps more frequently than profiles.
- Treat every timestamp as UTC.
- Store raw and normalized forms.
- Keep an explicit supported-network allowlist.
- Verify time-sensitive state through a chain-specific source.
- Never mix API credentials and wallet private keys.
These boundaries let each feature contribute useful context without turning one endpoint into an unsafe trading instruction.