Skip to Content

The Retention type of the TypeScript SDK, which mailboxes.getRetention and 2 more methods take or answer.

type Retention = {
  accountRetentionDays: number | null
  minDays: number
  nextRunAt: number | null
  oldestReceivedAt: number | null
  ownRetentionDays: number | null
  previews: RetentionPreview[]
  retentionDays: number | null
  source: ('own' | 'account' | 'none')
}

Fields

FieldTypeDescription
accountRetentionDaysnumber | nullThe owning account's default window (null = none)
minDaysnumberThe platform floor (RETENTION_MIN_DAYS): no window may be shorter
nextRunAtnumber | nullEpoch seconds at which the oldest live message becomes due under the window in force — the duty's next scheduled wake; null when no window is in force or nothing is live
oldestReceivedAtnumber | nullArrival time (epoch seconds) of the oldest live message, or null on an empty mailbox
ownRetentionDaysnumber | nullThe mailbox's own window (null = none set; the account default applies if any)
previewsRetentionPreview[]What each previewed window would expunge: the windows named by ?days=, else the window in force (one entry), else empty
retentionDaysnumber | nullThe window in force: the mailbox's own, else the account default, else null (off)
source('own' | 'account' | 'none')Where the window in force came from: the mailbox's own setting, the account default, or none

Used by

MethodWhat it does
mailboxes.getRetentionGet retention policy and preview
mailboxes.setRetentionSet retention window
mailboxes.clearRetentionClear retention window

On this page