Supermail
API reference

Event types

Every event type Supermail emits, its payload, and the shared value types they carry.

Every event shares one envelope; type selects which payload field is present. Types are dotted noun.past_tense strings. Skip any type you do not recognize — the set is additive.

typePayload fieldMeaning
email.receivedemail_receivedA message newly appeared in the account's view
email.updatedemail_updatedA provider-side change to an existing message
email.deletedemail_deletedA message was removed/expunged
email.placement_upsertedemail_placement_upsertedA message gained or changed one mailbox occurrence
email.placement_removedemail_placement_removedA message lost one mailbox occurrence
email.sentemail_sentA durable submission reached the provider
email.send_failedemail_send_failedA durable submission ended in permanent failure
mailbox.changedmailbox_changedA folder was created, removed, renamed, or updated
label.changedlabel_changedA label was created, updated, or removed through Supermail
sync.startedsync_startedA sync began
sync.progresssync_progressChunk-level progress during a (back)fill
sync.completedsync_completedA sync finished
sync.failedsync_failedA sync ended in failure

Message events

Message events are thin change notifications. They identify the message and its mailbox occurrences and carry no addresses, dates, flags, attachments, or content references; mail content and metadata are replicated to authorized consumers through the content lane.

email.received

FieldTypeNotes
provider_idProviderIdWhich message
placementsMailboxOccurrence[]Mailboxes it appeared in
thread_idstring, optionalThe provider's own conversation: Gmail threadId, Outlook conversationId. Opaque, scoped to the account and fixed for the message's lifetime; absent when the provider has none (IMAP)

Messages with the same thread_id in one account belong to one provider conversation. There are no thread-level writes: act on each message.

The native Rust event DTO has one JSON wire representation, used for retained event reads and signed webhook delivery.

Example event (JSON)
{
  "id": "event_3Nq7...",
  "seq": "128",
  "type": "email.received",
  "account_id": "account_01H9X...",
  "created": "2026-07-12T09:15:00+00:00",
  "idempotency_key": "INBOX:12345:98",
  "provenance": {
    "channel_id": "channel_01H...",
    "provider": { "mailbox": "INBOX", "uidvalidity": "98", "uid": "12345" },
    "cause": "sync.managed"
  },
  "email_received": {
    "provider_id": {
      "object_id": "...",
      "rfc_message_id": "<abc@example.com>"
    },
    "placements": [{ "mailbox_id": "...", "occurrence_id": "..." }],
    "thread_id": "18cafe00..."
  }
}

email.updated

FieldTypeNotes
provider_idProviderIdWhich message
placementsMailboxOccurrence[]Its current mailbox occurrences
changesstring[]What changed, e.g. ["flags"]

email.deleted

FieldTypeNotes
provider_idProviderIdWhich message
placementsMailboxOccurrence[]Occurrences it was removed from

email.placement_upserted

FieldTypeNotes
provider_idProviderIdWhich message
mailbox_idstringThe mailbox holding the occurrence
occurrence_idstringThe upserted occurrence

email.placement_removed

FieldTypeNotes
provider_idProviderIdWhich message
mailbox_idstringThe mailbox that held the occurrence
occurrence_idstringThe removed occurrence

email.sent

FieldTypeNotes
submission_idstringThe terminal sub_… submission
message_idstringIts RFC 5322 Message-ID
operation_idstring (optional)The owning operation

email.send_failed

FieldTypeNotes
submission_idstringThe terminal sub_… submission
failureFailureStable failure code and recommended action
operation_idstring (optional)The owning operation

Mailbox events

mailbox.changed

FieldTypeNotes
mailbox_idstringThe affected folder/label
kindChangeKindCHANGE_KIND_CREATED, CHANGE_KIND_REMOVED, CHANGE_KIND_RENAMED, or CHANGE_KIND_UPDATED
previous_mailbox_idstring (optional)The prior id, when the change replaced it

Read the folder's current name, role and parent with Folders/list.

label.changed

FieldTypeNotes
label_idstringThe provider label: a Gmail label id, an Outlook category name or an IMAP keyword
kindChangeKindCHANGE_KIND_CREATED, CHANGE_KIND_UPDATED (renamed or recolored; the id is kept), or CHANGE_KIND_REMOVED

Emitted when a Labels/create, Labels/update or Labels/delete operation is confirmed by the provider. Labels changed in another client emit no event; read the current catalog with Labels/list.

Sync events

These carry no provider coordinates.

sync.started

FieldTypeNotes
job_idstringThe synchronization job
selectionSyncSelectionExactly one of changes, history, or snapshot, as requested
operation_idstring (optional)The owning operation

sync.progress

FieldTypeNotes
doneint64Items processed so far
totalint64 (optional)Total, when known
chunkint64The current chunk index
job_idstringThe synchronization job
operation_idstring (optional)The owning operation

sync.completed

FieldTypeNotes
countint64Items observed
job_idstringThe synchronization job
operation_idstringThe owning operation, also reported by operation.succeeded

sync.failed

FieldTypeNotes
job_idstringThe synchronization job
failureFailureStable failure code and recommended action; retry_after is never set
operation_idstring (optional)The owning operation

Value types

ProviderId

Opaque provider message coordinates — match, never parse.

FieldType
object_idstring
rfc_message_idstring (optional)

MailboxOccurrence

One occurrence of a message in a mailbox.

FieldType
mailbox_idstring
occurrence_idstring

Content references

Events carry no content_ref. Gateway exposes no public endpoint that resolves event payloads to bytes; raw content is served only through the content lane to authorized DUCS consumers.

On this page