Skip to main content
Sessions

Stream session events

Subscribe to a Forward session event stream with SSE.

GET /api/v1/forward/sessions/{session_id}/events/stream Streams session events as Server-Sent Events. The data payload uses the same Forward filtering model as the event history endpoint. New integrations that need streaming output should subscribe with event_deltas[].

Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or SAT>
AcceptYestext/event-stream
Last-Event-IDNoResume after this Event ID.

Path parameters

ParameterTypeRequiredDescription
session_idstringYesSession ID.

Query parameters

ParameterTypeRequiredDefaultDescription
event_deltas[]stringNo-Subscribe to streaming delta events for the specified public event types. Supports repeated parameters. Allowed values: agent.message, agent.thinking. See Event delta streaming.
include_tool_callsbooleanNotrueInclude tool call events.
include_thinkingbooleanNotrueInclude thinking events.

Example request

curl -s -X GET 'https://api.qoder.com/api/v1/forward/sessions/sess_xxx/events/stream' \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN" \
  -H "Accept: text/event-stream"
Subscribe to text and thinking streaming delta events:
curl -s -G 'https://api.qoder.com/api/v1/forward/sessions/sess_xxx/events/stream' \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN" \
  -H "Accept: text/event-stream" \
  --data-urlencode 'event_deltas[]=agent.message' \
  --data-urlencode 'event_deltas[]=agent.thinking'

Example response

HTTP 200 OK
id: evt_xxx
event: agent.message
data: {"id":"evt_xxx","type":"agent.message","session_id":"sess_xxx","content":[{"type":"text","text":"Here is the analysis result."}],"processed_at":"2026-06-22T11:00:03Z"}

Event delta streaming example

When event_deltas[] is provided, the stream includes event_start and event_delta frames before the final buffered event:
id: evt_xxx
event: event_start
data: {"id":"evt_xxx","type":"event_start","session_id":"sess_xxx","event":{"id":"evt_xxx","type":"agent.message"}}

id: evt_xxx
event: event_delta
data: {"id":"evt_xxx","type":"event_delta","session_id":"sess_xxx","event_id":"evt_xxx","delta":{"type":"content_delta","index":0,"content":{"type":"text","text":"Here"}}}

Model usage event example:
id: evt_xxx
event: span.model_request_end
data: {"id":"evt_xxx","type":"span.model_request_end","is_error":false,"model_request_start_id":"evt_yyy","model_usage":{"credits":0.42},"processed_at":"2026-06-22T11:00:01Z"}

Response fields

FieldDescription
idSSE event ID. Equals the Event ID.
eventEvent type.
dataFiltered Forward Event JSON. Standard public events follow the Event type matrix documented by List Session Events; event delta stream frames follow Event delta streaming.

Connection interruptions and reconnection

An SSE connection can close because of gateway timeouts, server restarts, or similar conditions. The server does not guarantee that a connection remains open indefinitely. Clients must implement their own reconnection and retry logic:
  • Continuously record the id of the last SSE frame received. This is the Event ID.
  • After a disconnect, reconnect with that ID in the Last-Event-ID header to resume from the last received Event and avoid missing Events.
  • If a reconnect request omits Last-Event-ID, replay starts from the first Event in the Session. No Events are missed, but already consumed Events are delivered again. Use the Event ID for idempotent processing.

Errors

HTTPTypeCodeTrigger
404not_found_error-Last-Event-ID references an Event that does not exist or does not belong to this Session.
401authentication_errorauthentication_requiredPAT or SAT invalid or expired.
404not_found_errorsession_not_foundSession does not exist.

Notes

  • event_deltas[] is the recommended way to enable streaming; when this parameter is not provided, only standard public events are returned.
  • After each model call completes, the stream emits a span.model_request_end model usage event. model_usage.credits is the incremental usage for that call. Read usage.total_credits from Get Session for the cumulative Session usage; see Model usage events in the data structure documentation.
  • Unknown Event types are forwarded as envelope-only events when available.
  • include_thinking=false filters thinking events, legacy thinking deltas, and new stream agent.thinking event start signals and delta.content.type=thinking fragments.
  • include_tool_calls=false filters tool-use events and legacy tool input/output deltas.