1. Issue a stream token
Use an API key withemails:send:
2. Open the stream
data field:
type values are sent, delivered, bounced, complained, opened, clicked, and unsubscribed. The data map contains event-specific string values when available.
Reconnect and recovery
The token cannot be reused, so the browser’s defaultEventSource reconnect with the same URL cannot re-authenticate. When the stream closes, dispose of it, issue a new token, and create a new connection with capped backoff.
The stream is live and does not accept Last-Event-ID. After a disconnect, reconcile authoritative history with GET /v1/projects/{projectId}/emails/{emailId}/events for emails you track. Use webhooks when delivery across client disconnects must be durable.
Authentication errors returned before the stream opens are
application/problem+json. After it opens, handle disconnects through the SSE client’s network error path.