Streaming
A single long-lived Server-Sent Events connection that delivers the same envelope shape as outgoing webhooks — handy for CLI tooling, dashboards, or anywhere you don't want to host a public webhook endpoint.
#Endpoint
/api/v1/streamResponse content type is
text/event-stream. The connection stays open until the client closes it or the server restarts.Query parameters
eventsstring[]optionalCSV of event-type names. Unknown names are silently dropped.
gamesstring[]optionalCSV of game ids.
sportsstring[]optionalCSV of league keys.
teamsstring[]optionalCSV of team ids; matches any event whose
data.team_ids intersects.min_strengthnumberoptionalDecimal in
[0, 1]. Out-of-range values are silently dropped.curl -N "https://api.closeline.io/v1/stream?events=signal.fired,live.signal" \
-H "Authorization: Bearer $CLOSELINE_API_KEY" \
-H "Accept: text/event-stream"#Frame format
Standard SSE:
id: evt_01HXY...
event: signal.fired
data: {"id":"evt_01HXY...","type":"signal.fired","created_at":"2026-04-17T22:10:03Z","data":{}}
- On connect the server emits a single
:connected request_id=…comment so proxies commit the 200. - A keep-alive comment ships every 25s to keep nginx/CF from reaping the connection.
ev.datais parsed JSON where possible; the SDK falls back to the raw string if parsing fails.
#Event types
brief.publishedbrief.regeneratedbrief.supersededsignal.firedsignal.fired.highstrengthlive.signallive.injurylive.stateline.material_movegame.lineup_confirmedgame.startedgame.finalmethodology.top_match
#SDK
import { Closeline } from "@closeline/sdk";
const cl = new Closeline({ apiKey: process.env.CLOSELINE_API_KEY! });
const ac = new AbortController();
setTimeout(() => ac.abort(), 60_000); // stop after 60s
for await (const ev of cl.stream({
events: ["signal.fired", "signal.fired.highstrength"],
games: [gameId],
signal: ac.signal,
})) {
// ev.event — event type string
// ev.data — parsed JSON payload (falls back to raw string on parse failure)
console.log(ev.event, ev.data);
}The SDK stream is lazy — the HTTP request is issued only when the returned async iterator is first iterated, and the underlying connection closes when the loop exits or the AbortSignal aborts. See Webhooks for the push-based alternative.