Skip to content

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

Type: Duration? · default: 2592000000

How long to keep messages in the Trash and Junk Mail folders before auto-expunging

Type: Duration? · default: 259200000

How long to keep sent e-mail submissions before auto-expunging

Type: Duration? · default: 2592000000

Specifies the duration for which the JMAP share notification history is retained before it is automatically purged.

Type: Duration? · default: 2592000000

Sets the duration after which the iTIP inbox will automatically expunge old messages.

Type: Cron · default: {"@type":"Daily","hour":0,"minute":0}

Specifies when to run the auto-expunge process

Type: Cron · default: {"@type":"Daily","hour":2,"minute":0}

How often to purge the data store. Expects a cron expression.

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.

Type: UnsignedInt? · default: 10000

How 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.

Type: Duration? · enterprise

How 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.

Type: Duration? · enterprise

How long to keep deleted accounts in the archive before they are permanently deleted. If null, deleted accounts will be permanently deleted immediately.

Type: Duration? · default: 2592000000

The duration for which MTA reports should be stored before being deleted, or None to disable storage

Type: Duration? · enterprise · default: 2592000000

How long to keep message delivery history before it is permanently deleted.

Type: Duration? · enterprise · default: 7776000000

How long to keep metrics history before it is permanently deleted.

Type: BackupTarget · default: {"@type":"Disabled"}

Where data store backups are written. Backups are supported for RocksDB and SQLite data stores only.

Type: CompressionAlgo · default: "zstd"

Compression applied to backup files

Type: Id<SymmetricKey>?

Key used to encrypt backup files. If empty, backups are not encrypted.

Type: Cron · default: {"@type":"Daily","hour":3,"minute":0}

When to back up the data store. Ignored when backups are disabled.

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.

Type: Cron · enterprise · default: {"@type":"Hourly","minute":0}

Specifies how often to collect metrics history.

The DataRetention singleton is available via the urn:stalwart:jmap capability.

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.

Terminal window
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"
]
}'

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.

Terminal window
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.

Terminal window
stalwart-cli get DataRetention
Terminal window
stalwart-cli update DataRetention --field expungeTrashAfter=2592000000

Defines a recurring schedule.

  • Daily: Every day. Carries the fields of CronDaily.
  • Weekly: Every week. Carries the fields of CronWeekly.
  • Hourly: Every hour. Carries the fields of CronHourly.

A daily recurring schedule at a specific time.

Type: UnsignedInt · default: 0 · max: 23

Hour

Type: UnsignedInt · default: 0 · max: 59

Minute

A weekly recurring schedule on a specific day and time.

Type: UnsignedInt · default: 0 · max: 6

Day

Type: UnsignedInt · default: 0 · max: 23

Hour

Type: UnsignedInt · default: 0 · max: 59

Minute

An hourly recurring schedule at a specific minute.

Type: UnsignedInt · default: 0 · max: 59

Minute

Destination of data store backups.

  • Disabled: Disabled. No additional fields.
  • FileSystem: Directory. Carries the fields of BackupTargetFileSystem.
  • S3: S3-compatible storage. Carries the fields of S3Store.

Writes backups to a directory on the server.

Type: String · required

Directory where backups are written; it should be on a different disk from the data store

S3-compatible blob store.

Type: S3StoreRegion · default: {"@type":"UsEast1"}

The S3 region where the bucket resides

Type: String · required

The S3 bucket where blobs (e-mail messages, Sieve scripts, etc.) will be stored

Type: PublicStringOptional · default: {"@type":"None"}

Access key ID that identifies the S3 account

Type: SecretKeyOptional · default: {"@type":"None"}

The secret access key for the S3 account

Type: SecretKeyOptional · default: {"@type":"None"}

Session token for temporary credentials, sent as the x-amz-security-token header

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

Type: Duration · default: 30000

Request timeout for S3 operations

Type: UnsignedInt · default: 3 · max: 10

The maximum number of times to retry failed requests. Set to 0 to disable retries

Type: String?

A prefix that will be added to the keys of all objects stored in the blob store

Type: Boolean · default: false

Allow invalid TLS certificates when connecting to the S3 service

Type: Boolean · default: true

After 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.

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 of S3StoreCustomRegion.

Custom S3-compatible endpoint.

Type: Uri · required

Endpoint URL

Type: String · required

Region name

An optional public value, or none.

A public value provided directly.

Type: String · required

Value

A secret value read from an environment variable.

Type: String · required

Environment variable name to read the secret from

A secret value read from a file.

Type: String · required

File path to read the secret from

An optional secret value, or none.

  • None: No secret. No additional fields.
  • Value: Secret value. Carries the fields of SecretKeyValue.
  • EnvironmentVariable: Secret read from environment variable. Carries the fields of SecretKeyEnvironmentVariable.
  • File: Secret read from file. Carries the fields of SecretKeyFile.

A secret value provided directly.

Type: String · required · secret

Password or secret value

ValueLabel
lz4LZ4
noneNone
zstdZstandard
ValueLabel
noneDo not verify
sizeCheck that every file was written with the expected size
fullRead every file back and check its contents