Events and polling

The account's event log: what an event is, its seq, paging back through the log with cursor, and polling it forward with after.

On this page
  1. The event log
  2. Event types and boundaries
  3. Paging back: cursor
  4. Polling forward: after
  5. Which way to be told

The event log

Everything a subscriber is told goes through one log per account. Each entry is an Event: its id, its type (message.received, message.sent, thread.updated, inbox.created, inbox.deleted, delivery.failed, message.held, send.held, send.discarded, sign_in.requested, sign_in.completed), the inbox it concerns, when it occurred, and a compact summary. Sender, subject, message and thread ids may be null for non-mail events. The summary holds no body text; the full payload is one call away.

An event

{
  "id": "evt_01jc5e5f6g7h8j9k0m1n2p3q4r",
  "seq": 1042,
  "type": "message.received",
  "inboxId": "inb_01jc4q7w9k2m5n8p3r6t1v4x7z",
  "occurredAt": "2026-11-05T10:05:00.000Z",
  "summary": {
    "from": "sam@example.com",
    "subject": "Invoice 2847",
    "messageId": "msg_01jc5a6g7h8j9k0m1n2p3q4r5s",
    "threadId": "thr_01jc5a1b2c3d4e5f6g7h8j9k0m"
  }
}

seq is the event's position in the account's log, a number that only grows. It is the cursor for both directions below. An inbox-scoped key sees its inbox's events only.

Event types and boundaries

message.received
An inbound message was classified and stored. Its existing payload is unchanged.
message.sent
The sending provider accepted the message and its outbound record was stored. This is not a final delivery receipt.
thread.updated
A thread edit changed read state, metadata, labels or trash state, or incoming/outgoing mail changed its read state. The payload snapshots the resulting extension state. No-op edits emit nothing.
inbox.created
An inbox was issued. The payload includes metadata but never the issued API key or webhook secret.
inbox.deleted
An inbox was deleted through the API. Matching account endpoints receive it, not the removed inbox webhook.
delivery.failed
A webhook delivery reached terminal failure, including a target that became unavailable. This does not report outbound mail failures. Failure notifications never create further failure notifications.
message.held
An inbound message was held for owner review under the security policy. The payload carries who sent it, when, and its RiskAssessment, and never the subject, body, thread id or attachments. See Security and sender trust.
send.held
A message an app or a key asked to send waits for the owner under the security policy (sendApproval). The payload carries who it is to, the thread a reply was written into and whether an app or a key asked, and never the subject, body or attachments. See Sends that wait for the owner.
send.discarded
A held send ended without being sent: reason is discarded when the owner said no and expired when nobody decided in time. A held send the owner sends emits message.sent instead.
sign_in.requested
An address asked to sign in to a service for the first time and waits for the owner to allow it. Asking again while it waits emits nothing. The payload carries the sign-in's id, the service, the relying party's name and host, and who asked. Only where Sign in with Doorman is switched on.
sign_in.completed
An address signed in to a service: the relying party exchanged its code for tokens. The payload names the service and the relying party and never carries a link, a code, a token or a claim.

Events and their database mutations commit together; live delivery starts after commit. If fan-out could not finish, the scheduled sweep retries it. Account endpoint failure events have inbox_id: null and require account scope, so inbox keys and inbox-filtered subscriptions do not learn account endpoint details.

Webhook and stream payloads are discriminated by event; read only the fields for that type. A stream event adds delivered_at and attempt: 1. An empty event-type filter includes new types as they are added; subscribe to explicit types when a consumer handles only some.

Paging back: cursor

GET /v1/events without after answers the newest events first as an EventPage: data and nextCursor, the seq to pass as cursor for the next page, which holds the events with a smaller seq. nextCursor is null on the last page. inboxId, threadId and type narrow the log before paging; limit is 50 by default and at most 100.

The newest events, then the page before

curl -s "https://api.doorman.fyi/v1/events?inboxId=inb_01jc4q7w9k2m5n8p3r6t1v4x7z" \
  -H "authorization: Bearer $DOORMAN_API_KEY"

curl -s "https://api.doorman.fyi/v1/events?inboxId=inb_01jc4q7w9k2m5n8p3r6t1v4x7z&cursor=1041" \
  -H "authorization: Bearer $DOORMAN_API_KEY"

This is the shape for a person looking back: the console's events page, an audit, a search for what happened to one inbox last week.

To read a conversation's complete event history, pass threadId on every page until nextCursor is null. It searches all stored events, not a recent inbox window. The same filter works with after for polling. A valid id with no visible matching events gives an empty result; an invalid id gives 400 validation_error. Event details keep historical deliveries even after their endpoint changes or is removed.

Polling forward: after

With after=<seq> the same route answers the events with a larger seq, oldest first, as an EventPoll: data and latestSeq, the seq to poll from next. latestSeq is the last event of a full page, otherwise the account's newest seq. Start from the newest seq you successfully handled, or from 0 for everything the log holds.

What happened since seq 1042

curl -s "https://api.doorman.fyi/v1/events?after=1042" \
  -H "authorization: Bearer $DOORMAN_API_KEY"
  • After handling the page successfully, keep latestSeq somewhere durable and pass it as after on the next poll. Do not advance it past failed work.
  • Handle data in order. A full page (limit events) means there may be more: poll again at once rather than waiting for the next tick.
  • For the payload of an event, read GET /v1/events/{eventId}, which also lists the deliveries the event produced; or read the thread and message by the ids in the summary.

Which way to be told

NeedUse
An agent that runs on a server and should react within secondsA webhook, with the log as the way to catch up after an outage.
An agent that wakes on a schedule, or runs where it cannot be reachedPolling with after, once per run.
An agent that keeps a connection open and wants the lowest latencyThe stream, with last_event_id to replay what it missed.
Finding out what happened, by hand or from the consolePaging with cursor, and the event's deliveries.

Up Down to move, Enter to open, Esc to close