Skip to main content
Every POST /api/chat/v2 request runs on a durable workflow. If your client disconnects mid-stream — network switch, app backgrounded, tab reload — you can reconnect and continue receiving events without re-asking the question.

1. Capture the run ID

Early in the stream you’ll receive:
Persist workflowRunId somewhere your client can read it after a reconnect.

2. Reconnect when needed

Reconnect when both are true:
  1. Your stream ended without a finish event.
  2. You have the saved workflowRunId.
Call GET /api/chat/v2/stream/{runId} with the same API key that started the run:
The server replays any events buffered during the disconnect, then continues delivering live events. The event format is identical to the original stream — see streaming events.

3. JavaScript example

Authorization

Reconnection requires the same API key that originated the run. Calls made with any other key return 404 — the same response returned for runs that don’t exist.

Retrying

Reconnects are safe to retry with exponential backoff while the workflow is still running.