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 / weblink | login, register, exchange | Builder API key |
sdk.user | bets, create market, withdraw | Builder API key + Bearer JWT |
Tournaments host: tournamentsBaseUrl
Set it (via the PARLAY_TOURNAMENT_URL env var) only when you need bracket tournaments or F1. Omit it and sdk.tournaments / sdk.onchain are undefined.
| Client | Products |
|---|---|
sdk.tournaments | bracket tournaments, F1, LP pool |
Auth differs per host
- Builder key: required
apiKeyoncreateBentoSdk→x-builder-api-keyfor auth + user routes (catalog reads skip it). Mint one. - Markets user: a Bearer JWT from
eoaLogin, injected viawalletAuthProvider. - Tournaments user: a JWT (
tournamentsAuth) orx-wallet-address+x-signature+x-timestampsignature headers.
const sdk = createBentoSdk({
baseUrl: 'https://internal-server.bento.fun',
apiKey: process.env.BENTO_BUILDER_API_KEY!,
tournamentsBaseUrl: process.env.PARLAY_TOURNAMENT_URL, // optional: add when you need it
auth: walletAuthProvider(() => ({ Authorization: `Bearer ${token}` })),
tournamentsAuth: jwtAuthProvider({ getAccessToken: () => token }),
});Building only tournaments? Use createTournamentsSdk({ baseUrl: tournamentsBaseUrl, auth }).