Overview
Official documentation for @bento.fun/sdk — prediction markets, packs, parlays, tournaments, fantasy, and realtime.
@bento.fun/sdk is the TypeScript SDK for building on Bento: prediction markets, packs, parlays, bracket tournaments, F1, fantasy, portfolio, social, and realtime.
The SDK is designed for:
- browser apps (React, Next.js)
- React Native / Expo
- backend jobs and scripts
- agents and server-to-server integrations
- tests and CI
What we standardize around
createBentoSdk()— top-level factory- Two API hosts — markets (
baseUrl) and tournaments (tournamentsBaseUrl) public/user/realtimeon the markets hosttournamentsnamespace when the parlay/tournaments host is configuredonchainoptional orchestration (parlay placement, vault deposit/claim, LP)- OpenAPI-contract types — pinned snapshots for both hosts
- HTTP acceptance ≠ chain finality — poll reads,
waitFor*helpers, or websocket
Wallet UX (Privy, Wagmi, Turnkey, server signers) stays in your app. The SDK accepts headers and viem-compatible wallets — it does not embed a wallet provider.
Shape of the product
A typical integrator flow:
- Configure
createBentoSdk({ baseUrl, tournamentsBaseUrl, auth, tournamentsAuth }) - Discover —
public.listDuels,tournaments.parlay.listMarkets, analytics - Authenticate —
public.auth.eoaLoginor wallet headers; JWT on tournaments host - Participate (HTTP) —
user.placeBet,parlay.createQuote,tournaments.enter - Participate (on-chain) —
onchain.placeParlayFromQuoteId, vault deposit, LP - Realtime —
realtimewebsocket +subscribeTournamentAblyChat - Create — duels, parent markets, bracket tournaments, F1/fantasy (creator paths)
Current primitives
| Layer | What it is today |
|---|---|
| Markets host | Duels, bets, packs, portfolio, withdrawals, Polymarket bridge |
| Tournaments host | Parlay engine, bracket tournaments, F1, fantasy, social, agents |
| On-chain | Parlay router, tournament vault, LP via OnchainOrchestrator + viem |
| Not in public SDK | Bot API, inbound webhooks, infra meta (/api/meta/*) |
Recommended reading order
New to Bento (app integrator):
- Quickstart
- Common patterns
- TypeScript SDK
- SDK API reference
- Two API hosts
- Authentication
- Place a bet
- Place a parlay
- Test the SDK
Creators and operators:
- Create a market
- Create a tournament
- Enter a tournament — player flow
- Mutation semantics
- OpenAPI reference
Agents and server-to-server:
- Authentication —
agentV1AuthProvider,bulkRegisterAuthProvider - TypeScript SDK —
agentsV1,agentsExternal,bulkRegister
Install
npm install @bento.fun/sdkCurrent SDK version: 0.5.3
Next steps
Quickstart
Install and make your first API calls in minutes.
TypeScript SDK
Integration modes, clients, and module reference.
SDK API reference
All SDK methods with routes, auth, and code snippets.
Markets API
Interactive OpenAPI reference for the markets host.
Tournaments API
Interactive OpenAPI reference for parlays and tournaments.
Authentication
Wallet, JWT, agent keys, and API keys.
Place a parlay
Quote → on-chain placement → claim.
Create a market
Submit a new prediction or versus market.
Create a tournament
Bracket tournament creator lifecycle.
Common patterns
duelId vs id, auth, response shapes, errors.
Test the SDK
npm integration sandbox against live APIs.