DataRetention
Configures data retention policies, expunge schedules, and archival settings.
This object can be configured from the WebUI under Settings › Storage › Data Retention › Archiving, Settings › Storage › Data Retention › Backup, Settings › Storage › Data Retention › Data Cleanup, Settings › Storage › Data Retention › Auto-Expunge, Settings › Storage › Data Retention › Telemetry
Fields
Section titled “Fields”expungeTrashAfter
Section titled “expungeTrashAfter”Type:
Duration?· default:2592000000How long to keep messages in the Trash and Junk Mail folders before auto-expunging
expungeSubmissionsAfter
Section titled “expungeSubmissionsAfter”Type:
Duration?· default:259200000How long to keep sent e-mail submissions before auto-expunging
expungeShareNotifyAfter
Section titled “expungeShareNotifyAfter”Type:
Duration?· default:2592000000Specifies the duration for which the JMAP share notification history is retained before it is automatically purged.
expungeSchedulingInboxAfter
Section titled “expungeSchedulingInboxAfter”Type:
Duration?· default:2592000000Sets the duration after which the iTIP inbox will automatically expunge old messages.
expungeSchedule
Section titled “expungeSchedule”Type:
Cron· default:{"@type":"Daily","hour":0,"minute":0}Specifies when to run the auto-expunge process
dataCleanupSchedule
Section titled “dataCleanupSchedule”Type:
Cron· default:{"@type":"Daily","hour":2,"minute":0}How often to purge the data store. Expects a cron expression.
blobCleanupSchedule
Section titled “blobCleanupSchedule”Type:
Cron· default:{"@type":"Daily","hour":4,"minute":0}When to delete blobs that are no longer referenced, such as expired uploads and the contents of deleted messages. Expects a cron expression.
maxChangesHistory
Section titled “maxChangesHistory”Type:
UnsignedInt?· default:10000How many changes to keep in the history for each account. This is used to determine the changes that have occurred since the last time the client requested changes.
archiveDeletedItemsFor
Section titled “archiveDeletedItemsFor”Type:
Duration?· enterpriseHow long to keep deleted items in the archive before they are permanently deleted. If null, deleted items will not be archived and will be permanently deleted immediately.
archiveDeletedAccountsFor
Section titled “archiveDeletedAccountsFor”Type:
Duration?· enterpriseHow long to keep deleted accounts in the archive before they are permanently deleted. If null, deleted accounts will be permanently deleted immediately.
holdMtaReportsFor
Section titled “holdMtaReportsFor”Type:
Duration?· default:2592000000The duration for which MTA reports should be stored before being deleted, or None to disable storage
holdTracesFor
Section titled “holdTracesFor”Type:
Duration?· enterprise · default:2592000000How long to keep message delivery history before it is permanently deleted.
holdMetricsFor
Section titled “holdMetricsFor”Type:
Duration?· enterprise · default:7776000000How long to keep metrics history before it is permanently deleted.
backupTarget
Section titled “backupTarget”Type:
BackupTarget· default:{"@type":"Disabled"}Where data store backups are written. Backups are supported for RocksDB and SQLite data stores only.
backupCompression
Section titled “backupCompression”Type:
CompressionAlgo· default:"zstd"Compression applied to backup files
backupEncryptionKey
Section titled “backupEncryptionKey”Type:
Id<SymmetricKey>?Key used to encrypt backup files. If empty, backups are not encrypted.
backupSchedule
Section titled “backupSchedule”Type:
Cron· default:{"@type":"Daily","hour":3,"minute":0}When to back up the data store. Ignored when backups are disabled.
backupVerify
Section titled “backupVerify”Type:
BackupVerifyMode· default:"size"How to verify each backup after it is written. For S3 destinations, the backup is first written and verified in a temporary directory next to the data store.
metricsCollectionInterval
Section titled “metricsCollectionInterval”Type:
Cron· enterprise · default:{"@type":"Hourly","minute":0}Specifies how often to collect metrics history.
JMAP API
Section titled “JMAP API”The DataRetention singleton is available via the urn:stalwart:jmap capability.
x:DataRetention/get
Section titled “x:DataRetention/get”This is a standard Foo/get method as defined in RFC 8620, Section 5.1.
For singletons, the ids argument should be the literal singleton (or null to return the single instance).
This method requires the sysDataRetentionGet permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:DataRetention/get", { "ids": [ "singleton" ] }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'x:DataRetention/set
Section titled “x:DataRetention/set”This is a standard Foo/set method as defined in RFC 8620, Section 5.3.
For singletons, only the update argument with id singleton is accepted; create and destroy arguments are rejected.
This method requires the sysDataRetentionUpdate permission.
curl -X POST https://mail.example.com/jmap/ \ -H 'Authorization: Bearer $TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "methodCalls": [ [ "x:DataRetention/set", { "update": { "singleton": { "expungeTrashAfter": 2592000000 } } }, "c1" ] ], "using": [ "urn:ietf:params:jmap:core", "urn:stalwart:jmap" ] }'stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.
stalwart-cli get DataRetentionUpdate
Section titled “Update”stalwart-cli update DataRetention --field expungeTrashAfter=2592000000Nested types
Section titled “Nested types”Defines a recurring schedule.
Daily: Every day. Carries the fields ofCronDaily.Weekly: Every week. Carries the fields ofCronWeekly.Hourly: Every hour. Carries the fields ofCronHourly.
CronDaily
Section titled “CronDaily”A daily recurring schedule at a specific time.
Type:
UnsignedInt· default:0· max: 23Hour
minute
Section titled “minute”Type:
UnsignedInt· default:0· max: 59Minute
CronWeekly
Section titled “CronWeekly”A weekly recurring schedule on a specific day and time.
Type:
UnsignedInt· default:0· max: 6Day
Type:
UnsignedInt· default:0· max: 23Hour
minute
Section titled “minute”Type:
UnsignedInt· default:0· max: 59Minute
CronHourly
Section titled “CronHourly”An hourly recurring schedule at a specific minute.
minute
Section titled “minute”Type:
UnsignedInt· default:0· max: 59Minute
BackupTarget
Section titled “BackupTarget”Destination of data store backups.
Disabled: Disabled. No additional fields.FileSystem: Directory. Carries the fields ofBackupTargetFileSystem.S3: S3-compatible storage. Carries the fields ofS3Store.
BackupTargetFileSystem
Section titled “BackupTargetFileSystem”Writes backups to a directory on the server.
Type:
String· requiredDirectory where backups are written; it should be on a different disk from the data store
S3Store
Section titled “S3Store”S3-compatible blob store.
region
Section titled “region”Type:
S3StoreRegion· default:{"@type":"UsEast1"}The S3 region where the bucket resides
bucket
Section titled “bucket”Type:
String· requiredThe S3 bucket where blobs (e-mail messages, Sieve scripts, etc.) will be stored
accessKeyId
Section titled “accessKeyId”Type:
PublicStringOptional· default:{"@type":"None"}Access key ID that identifies the S3 account
secretKey
Section titled “secretKey”Type:
SecretKeyOptional· default:{"@type":"None"}The secret access key for the S3 account
sessionToken
Section titled “sessionToken”Type:
SecretKeyOptional· default:{"@type":"None"}Session token for temporary credentials, sent as the x-amz-security-token header
profile
Section titled “profile”Type:
String?Used when retrieving credentials from a shared credentials file. If specified, the server will use the access key ID, secret access key, and session token (if available) associated with the given profile
timeout
Section titled “timeout”Type:
Duration· default:30000Request timeout for S3 operations
maxRetries
Section titled “maxRetries”Type:
UnsignedInt· default:3· max: 10The maximum number of times to retry failed requests. Set to 0 to disable retries
keyPrefix
Section titled “keyPrefix”Type:
String?A prefix that will be added to the keys of all objects stored in the blob store
allowInvalidCerts
Section titled “allowInvalidCerts”Type:
Boolean· default:falseAllow invalid TLS certificates when connecting to the S3 service
verifyAfterWrite
Section titled “verifyAfterWrite”Type:
Boolean· default:trueAfter each successful write, verify the object is readable on the backend. Defends against the rare case where an S3-compatible backend returns success but does not actually persist the data. Adds one extra request per write.
S3StoreRegion
Section titled “S3StoreRegion”Predefined S3 regions.
UsEast1: us-east-1. No additional fields.UsEast2: us-east-2. No additional fields.UsWest1: us-west-1. No additional fields.UsWest2: us-west-2. No additional fields.CaCentral1: ca-central-1. No additional fields.AfSouth1: af-south-1. No additional fields.ApEast1: ap-east-1. No additional fields.ApSouth1: ap-south-1. No additional fields.ApNortheast1: ap-northeast-1. No additional fields.ApNortheast2: ap-northeast-2. No additional fields.ApNortheast3: ap-northeast-3. No additional fields.ApSoutheast1: ap-southeast-1. No additional fields.ApSoutheast2: ap-southeast-2. No additional fields.CnNorth1: cn-north-1. No additional fields.CnNorthwest1: cn-northwest-1. No additional fields.EuNorth1: eu-north-1. No additional fields.EuCentral1: eu-central-1. No additional fields.EuCentral2: eu-central-2. No additional fields.EuWest1: eu-west-1. No additional fields.EuWest2: eu-west-2. No additional fields.EuWest3: eu-west-3. No additional fields.IlCentral1: il-central-1. No additional fields.MeSouth1: me-south-1. No additional fields.SaEast1: sa-east-1. No additional fields.DoNyc3: Digital Ocean nyc3. No additional fields.DoAms3: Digital Ocean ams3. No additional fields.DoSgp1: Digital Ocean sgp1. No additional fields.DoFra1: Digital Ocean fra1. No additional fields.Yandex: Yandex Object Storage. No additional fields.WaUsEast1: Wasabi us-east-1. No additional fields.WaUsEast2: Wasabi us-east-2. No additional fields.WaUsCentral1: Wasabi us-central-1. No additional fields.WaUsWest1: Wasabi us-west-1. No additional fields.WaCaCentral1: Wasabi ca-central-1. No additional fields.WaEuCentral1: Wasabi eu-central-1. No additional fields.WaEuCentral2: Wasabi eu-central-2. No additional fields.WaEuWest1: Wasabi eu-west-1. No additional fields.WaEuWest2: Wasabi eu-west-2. No additional fields.WaApNortheast1: Wasabi ap-northeast-1. No additional fields.WaApNortheast2: Wasabi ap-northeast-2. No additional fields.WaApSoutheast1: Wasabi ap-southeast-1. No additional fields.WaApSoutheast2: Wasabi ap-southeast-2. No additional fields.Custom: Custom. Carries the fields ofS3StoreCustomRegion.
S3StoreCustomRegion
Section titled “S3StoreCustomRegion”Custom S3-compatible endpoint.
Type:
Uri· requiredEndpoint URL
region
Section titled “region”Type:
String· requiredRegion name
PublicStringOptional
Section titled “PublicStringOptional”An optional public value, or none.
None: No value. No additional fields.Value: Value. Carries the fields ofPublicStringValue.EnvironmentVariable: Value read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Value read from file. Carries the fields ofSecretKeyFile.
PublicStringValue
Section titled “PublicStringValue”A public value provided directly.
Type:
String· requiredValue
SecretKeyEnvironmentVariable
Section titled “SecretKeyEnvironmentVariable”A secret value read from an environment variable.
variableName
Section titled “variableName”Type:
String· requiredEnvironment variable name to read the secret from
SecretKeyFile
Section titled “SecretKeyFile”A secret value read from a file.
filePath
Section titled “filePath”Type:
String· requiredFile path to read the secret from
SecretKeyOptional
Section titled “SecretKeyOptional”An optional secret value, or none.
None: No secret. No additional fields.Value: Secret value. Carries the fields ofSecretKeyValue.EnvironmentVariable: Secret read from environment variable. Carries the fields ofSecretKeyEnvironmentVariable.File: Secret read from file. Carries the fields ofSecretKeyFile.
SecretKeyValue
Section titled “SecretKeyValue”A secret value provided directly.
secret
Section titled “secret”Type:
String· required · secretPassword or secret value
CompressionAlgo
Section titled “CompressionAlgo”| Value | Label |
|---|---|
lz4 | LZ4 |
none | None |
zstd | Zstandard |
BackupVerifyMode
Section titled “BackupVerifyMode”| Value | Label |
|---|---|
none | Do not verify |
size | Check that every file was written with the expected size |
full | Read every file back and check its contents |