API reference · WebSocket
Stream events over SSE
GET/v1/stream/sse
The same stream as the WebSocket over Server-Sent Events, for networks that block WebSockets.
On this page
Auth. None. Without a token the call is served as Free (the Free delay and request budget, shared per IP); send Authorization: Bearer lb_… for your plan's.
Limits. Counts toward your plan's concurrent streams, WebSocket and SSE together (1, 5 or 20). Served at your plan's delay (+60 s Free, +10 s Builder, +2 s Standard).
Parameters
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
events | string | no | Comma-separated event ids (ev_…). |
phrases | string | no | Comma-separated phrase keys. |
types | string | no | Comma-separated event types. |
subjects | string | no | Comma-separated typed-fact subjects. |
context | string | no | Context kinds to opt in to: on_air, topic, near_miss, typed or all. |
Request
curl -N -H "Authorization: Bearer $LANGBOT_API_TOKEN" \
"https://api.langbot.ai/v1/stream/sse?phrases=tariff&types=phrase_detected"from langbot import LangbotClient
async with LangbotClient() as lb:
async for evt in lb.stream_sse(phrases=["tariff"], types=["phrase_detected"]):
print(evt.event_id, evt.phrase, evt.t_spoken)import { LangbotClient } from "@langbotai/sdk";
const lb = new LangbotClient();
for await (const evt of lb.streamSSE({ phrases: ["tariff"], types: ["phrase_detected"] })) {
console.log(evt.event_id, evt.phrase);
}Response
200 OK
event: hello
data: {"type":"hello","seq":9032,"delay_ms":60000,"plan":"anonymous","effective_plan":"free",…}
event: phrase_detected
data: {"id":"evt_01M6…","type":"phrase_detected","phrase":"tariff",…}text/event-stream: the event type is the SSE event: and the JSON is data:; keep-alives are SSE comments (: ping).
Errors
| Status | code | When |
|---|---|---|
| 401 | token_invalid | A token was sent and not recognised. Send a valid one, or none to call anonymously. |
| 422 | validation_error | A parameter failed validation; detail[].loc names it. |
| 429 | rate_limited | Over your request budget; wait Retry-After seconds. |
Every error body is {"detail": …, "code": "…"}; branch on code. All codes: Errors.