Concepts
Two API hosts
You usually only need one host to start. Here's the split, and when to add the second.
Bento runs on two hosts, and the SDK routes each call to the right one. You only need the markets host to start. Add the tournaments host when you reach tournaments.
Markets host: baseUrl
https://internal-server.bento.fun (testnet). Where you start: bets, packs, create-market, and portfolio.
| Client | Products | Auth |
|---|---|---|
sdk.public | catalog, packs, analytics | None (open reads) |
sdk.public.auth | login, register | Builder API key |
sdk.user | bets, create market, withdraw | Builder API key + Bearer JWT |
Tournaments host: tournamentsBaseUrl
Set PARLAY_TOURNAMENT_URL only when you need bracket tournaments or F1. Testnet default: https://bento-fun-tournaments-backend-3nku.onrender.com. Omit it and sdk.tournaments / sdk.onchain are undefined. Full table: Environments.
| Client | Products |
|---|---|
sdk.tournaments | bracket tournaments, F1, LP pool |
HTTP /bento/sportmonks/* | Sportmonks sports data proxies (Builder key + rate limits; not on the SDK client) — guide |
Auth differs per host
- Builder key: required
apiKeyoncreateBentoSdk→x-builder-api-key(also required on tournaments sports proxies). Mint one. - Markets user: Bearer JWT from
eoaLogin/eoaRegister, viawalletAuthProvider. - Tournaments user: JWT on
tournamentsAuth(prefer over legacyx-wallet-*headers).
const sdk = createBentoSdk({
baseUrl: 'https://internal-server.bento.fun',
apiKey: process.env.BENTO_BUILDER_API_KEY!,
tournamentsBaseUrl: process.env.PARLAY_TOURNAMENT_URL, // optional
auth: walletAuthProvider(() => ({ Authorization: `Bearer ${token}` })),
tournamentsAuth: jwtAuthProvider({ getAccessToken: () => token }),
});Building only tournaments? Use createTournamentsSdk({ baseUrl: tournamentsBaseUrl, auth }).