GET /api/v1/r/tasks/{taskId}/events opens a Server-Sent Events
stream that emits one event per status change or progress tick. The
connection stays open until the task reaches a terminal state
(completed, failed, cancelled), then closes.
Prefer this over polling GET /r/tasks/{taskId} — lower latency,
fewer requests.
Connect
Use a Bearer token (JWT,sk-, or dk-):
EventSource does not support custom
headers, which means it can’t carry an Authorization header.
Server-side runtimes (Node fetch, Python requests, httpx),
React Native, or libraries like eventsource work fine. In a
browser, proxy through your own backend.
Event types
status
progress
stage (download, process_data, train,
export, upload) and a human-readable message to the payload.
Terminal events
error
Example stream
A typical ComfyUI task end-to-end:Polling fallback
If your network drops SSE, or you’d rather not hold a connection open, pollGET /r/tasks/{taskId} until task_status is one of
completed, failed, cancelled. Three seconds between polls is
a reasonable default.
completed, fetch the artifact links via
GET /r/tasks/{taskId}/result.
Consume the stream
Related
- Generate an API key — issue an
sk-credential. - API reference — the full endpoint catalog.
- Webhooks — push delivery of terminal events instead of streaming.
