Skip to Content

Query domain delivery event log.

Returns paginated detailed delivery events and attempt history for a domain with filtering by time range, outcome, source, mailbox, or the prepared email that sent it.

openemail.domains.listEvents(
  domain: string,
  options?: DomainsListEventsOptions,
): PagePromise<DomainEvents, TrafficEvent>

It calls GET /domains/{domain}/events: Query domain delivery event log in the API reference.

Example

for await (const trafficEvent of openemail.domains.listEvents(domain)) {
  // every item of every page (await the call instead for one page)
}

Arguments

ArgumentTypeDescription
domainstringDomain name (e.g. 'example.com'). The path's {domain}.

Options

The last argument, options, a DomainsListEventsOptions, takes:

OptionTypeSent asDescription
range('1h' | '6h' | '24h' | '7d' | '30d')query rangeTime window range ('1h', '6h', '24h', '7d', '30d')
outcome(typeof ACCOUNTS_LIST_EVENTS_OUTCOMES)[number]query outcomeFilter by delivery outcome ('delivered', 'bounced', 'deferred', 'rejected', 'suppressed', 'dropped')
source(typeof ACCOUNTS_LIST_EVENTS_SOURCES)[number]query sourceFilter by traffic source ('smtp_in', 'submission', 'forward', 'webhook', 'scheduled', 'pop3')
kind('mail' | 'all')query kind'mail' shows only rows where a message moved — arrived, left, reached a member or a webhook route, was collected from another provider, or its sender was told it failed. 'all' (the default, so no client changes behaviour) adds the rows where the platform describes itself: IMAP uploads, Sent copies, report ingestion, event-webhook batches and the per-RCPT gate. A customer-facing delivery log wants 'mail' — one inbound message writes a gate row AND a delivery row, so 'all' counts it twice.
deliveryIdstringquery deliveryIdFilter by exact delivery ID
mailboxIdstringquery mailboxIdFilter by mailbox ULID identifier
envelopeFromstringquery envelopeFromFilter by envelope sender email address
detailstringquery detailFilter by the row's detail marker — e.g. 'junk' for messages the platform filed into Junk, or a failure reason like 'sender_blocked'.
templatestringquery templateFilter to the rows a prepared email (tenant template) wrote, by its slug: the admission of each recipient, every relay attempt after it, and a dead letter if the attempts ran out. Each row names its template and language in template.
limitnumberquery limitMaximum events per page
cursorstringquery cursorPagination cursor

Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).

Answer

It is a listing, a PagePromise. Awaited, it is one page as the API answers it, DomainEvents. Iterated with for await, it is every TrafficEvent of every page, each page fetched as the loop reaches it.

Errors

StatusWhat it means
400validation_failed or invalid_cursor
401unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge
404Domain not found or not accessible to this principal
502analytics_query_failed
503analytics_unavailable. Or temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.

Types

ACCOUNTS_LIST_EVENTS_OUTCOMES

const ACCOUNTS_LIST_EVENTS_OUTCOMES = [
  'delivered',
  'duplicate',
  'queued',
  'filtered',
  'rejected',
  'bounced',
  'deferred',
  'relayed',
  'relay_rejected',
  'relay_suppressed',
  'relay_indeterminate',
  'relay_content_lost',
  'webhook_delivered',
  'webhook_route_gone',
  'event_delivered',
  'event_hook_disabled',
  'event_hook_gone',
  'member_skipped',
  'member_failed',
  'fbl_recorded',
  'fbl_content_lost',
  'dmarc_recorded',
  'dmarc_content_lost',
  'dmarc_unreadable',
  'dmarc_unparseable',
  'dmarc_rejected',
  'dead_lettered',
  'internal_error',
  'check_refused',
  'check_accepted',
  'blob_missing',
  'rate_limited',
  'limiter_unavailable',
  'auth_failed',
  'storage_warning',
  'mail_refused',
  'mail_accepted',
] as const

Its 37 values; the package exports it: import { ACCOUNTS_LIST_EVENTS_OUTCOMES } from '@openemail/sdk'.

ACCOUNTS_LIST_EVENTS_SOURCES

const ACCOUNTS_LIST_EVENTS_SOURCES = [
  'inbound',
  'outbound',
  'sent_copy',
  'append',
  'expansion',
  'relay',
  'webhook',
  'pickup',
  'edge',
  'fbl',
  'dmarc',
  'bounce',
  'events',
  'api',
  'check',
  'read',
  'auth',
  'store',
  'platform_mail',
] as const

Its 19 values; the package exports it: import { ACCOUNTS_LIST_EVENTS_SOURCES } from '@openemail/sdk'.

It names these types of the API, each on a page of its own: DomainEvents, TrafficEvent.