POST /v1/watch opens a Server-Sent Events stream of mail events for the mailboxes your key can read: mail arriving, a send leaving, a hold waiting on somebody, a delivery outcome for a message you sent. Calendar and contact changes are not on this stream.
Opening a stream counts as one request, however long you keep it open.
Request
The stream
The stream is three kinds of line:- An
openframe, once, carrying the cursor you supplied. batchframes, each carryingeventsand the cursor after them, pluserrorwhen a failure ends the stream.: keepalivecomments while nothing is happening, so a silent connection is distinguishable from a dead one.
batch arrives.
Reconnecting
The stream stays open until you disconnect or the server is replaced. Reconnect with the last cursor you received and nothing is lost.Before the stream opens
A request that’s wrong is refused before the stream opens, as an ordinary JSON error: a cursor that doesn’t parse is400 invalid, and a key that reaches no mailbox is 403 forbidden_scope. See Errors.
An error that happens after open is a failure in flight: it arrives as a batch frame carrying error and ends the stream.
Scope
The stream reports mail events for the mailboxes your key can read, and needs themail scope. Calendar and contact changes are not reported.
Delivery to a webhook endpoint instead of a stream is arranged through support; watch itself is self-service.
Example
Next
Errors
The error envelope, retryable codes, and correlating a failure.
Bud quickstart
Make your first calls, step by step.

