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

GET/api/v1/bets
Auth requiredPro
Paginated list of the caller's bets. Filter by outcome, range, or sport.

Query parameters

rangeenumoptional
7d | 30d | 90d | ytd | all.
sportstringoptional
League key.
outcomeenumoptional
win | loss | push | pending.
limitintegeroptional
Standard pagination limit.
cursorstringoptional
Standard pagination cursor.
bash
curl "https://api.closeline.io/v1/bets?range=30d&outcome=win" \
  -H "Authorization: Bearer $CLOSELINE_API_KEY"

#Create a bet

POST/api/v1/bets
Auth requiredPro
Persist a new bet. The body is validated by @closeline/bets; validation errors come back as 422 invalid_request.
bash
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

PATCH/api/v1/bets/{id}
Auth requiredPro
Partial update. Typical use: set the outcome after the game settles.
DELETE/api/v1/bets/{id}
Auth requiredPro
Hard-delete a row. Returns 204 No Content on success.

#CLV report

GET/api/v1/bets/clv
Auth requiredPro
Closing-line value summary, optionally broken down by sport, market, or signal_type.

#SDK

ts
// 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" });