Bets
Log the bets you place so Closeline can surface your CLV, ROI by market, and predictiveness of signals you act on. All bet endpoints are owner-scoped — you only ever see your own data.
#List bets
/api/v1/betsPaginated list of the caller's bets. Filter by outcome, range, or sport.
Query parameters
rangeenumoptional7d | 30d | 90d | ytd | all.sportstringoptionalLeague key.
outcomeenumoptionalwin | loss | push | pending.limitintegeroptionalStandard pagination limit.
cursorstringoptionalStandard pagination cursor.
curl "https://api.closeline.io/v1/bets?range=30d&outcome=win" \
-H "Authorization: Bearer $CLOSELINE_API_KEY"#Create a bet
/api/v1/betsPersist a new bet. The body is validated by
@closeline/bets; validation errors come back as 422 invalid_request.curl -X POST https://api.closeline.io/v1/bets \
-H "Authorization: Bearer $CLOSELINE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"game_id": "game_01HXY...",
"market_type": "spread",
"side": "home",
"line_value_placed": -6.5,
"odds_placed": -110,
"stake_cents": 10000
}'Always pass an Idempotency-Key header on retries so duplicate network attempts don't create duplicate rows.
#Update / delete
/api/v1/bets/{id}Partial update. Typical use: set the outcome after the game settles.
/api/v1/bets/{id}Hard-delete a row. Returns
204 No Content on success.#CLV report
/api/v1/bets/clvClosing-line value summary, optionally broken down by
sport, market, or signal_type.#SDK
// List your bets
const recent = await cl.bets.list({ range: "30d", outcome: "win", limit: 50 });
// Log a new bet — always pass an Idempotency-Key when retrying.
// Stakes are in CENTS (integer). 10_000 = $100.00.
const bet = await cl.bets.create(
{
game_id: gameId,
market_type: "spread",
side: "home",
line_value_placed: -6.5,
odds_placed: -110,
stake_cents: 10_000,
},
{ idempotencyKey: crypto.randomUUID() },
);
// Update the outcome once the game settles
await cl.bets.update(bet.id, { outcome: "win" });
// CLV report
const clv = await cl.bets.clv({ range: "90d", breakdown: "sport" });