Get the inbound retention

See how long your inbound mail is kept: the workspace setting, the effective values after your plan cap and per-domain overrides.

Stored messages are kept 30 days and forward-only messages 72 hours unless you choose otherwise. This call returns your workspace setting (null = the default), the effective values after your plan cap, the longest retention your plan allows (plan_max) and every domain that overrides it.

GET /v3/inbound/retention

Responses

StatusDescription
200{ workspace, effective, plan_max, domains } — values in days (stored_retention_days) and hours (forward_only_retention_hours).
401Missing or invalid API key.
403insufficient_scope — a send_only key cannot read inbound settings.

Code examples

cURL
curl https://api.wemail.io/v3/inbound/retention \
  -H "Authorization: Bearer afn_live_…"
# 200 {"workspace":{"stored_retention_days":null,"forward_only_retention_hours":null},
#      "effective":{"stored_retention_days":30,"forward_only_retention_hours":72},
#      "plan_max":{"stored_retention_days":365,"forward_only_retention_hours":720},"domains":[]}
Node.js
const res = await fetch("https://api.wemail.io/v3/inbound/retention", {
  headers: { Authorization: `Bearer ${process.env.WEMAIL_API_KEY}` },
});
const { effective } = await res.json();
console.log(effective.stored_retention_days); // 30
Python
import os, requests

r = requests.get("https://api.wemail.io/v3/inbound/retention",
                 headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"})
print(r.json()["effective"])