# Owner Notifications

A scheduled message that records a new failure, or is removed by a proven
pre-provider policy denial, contributes to a `message.scheduled_failed` digest.
Accepted transmissions are not classified as failed, and historical failures
are not backfilled.

## Scheduled-failure digest

Failures are grouped into one account digest per UTC hour. After the hour closes,
the outbox worker queues the digest. It normally polls every five seconds, but
queue load and retries can delay delivery. The email contains only the count and
window start, without recipients, subjects or message bodies. It directs you to
the API and audit log for review and does not claim a message was retried.

The recipient is the current account owner at delivery time. Ownership,
suspension, suppression, sender configuration, emergency pauses and budgets still
apply. Tracking is off. Infrastructure notification preferences and the
`message.scheduled_failed` granular override apply.

The outbox retries enqueue failures with bounded exponential delay. Notification
email jobs have three attempts, with exponential delay starting at one second.
Stable occurrence IDs and delivery reservations prevent resubmitting an already
claimed occurrence. Uncertain provider outcomes require review, not blind resend.
A notification queued successfully is not proof the email arrived.

## Account preferences

`GET /v1/notification-preferences` returns current account preferences:

- `security_enabled`, `billing_enabled`, `infrastructure_enabled`, `product_enabled`
- `digest_frequency`: `daily`, `weekly` or `off`
- `timezone`
- `granular_overrides`: event-specific values; boolean overrides take precedence
  over the category preference for events that can be disabled

Use `PATCH /v1/notification-preferences` with the fields you want to change.
For example, `{"infrastructure_enabled":false}` disables that category unless
an event's boolean override enables it. Certain existing security/billing events
are always on. The general `digest_frequency` and `timezone` fields do not
reschedule the scheduled-failure digest's UTC hourly window.

The approval email follows the `security` preference, like the key-limit email,
so it stays on unless you turn that category off.

Billing displays the infrastructure preference, scheduled-failure override and
stored general digest preference. It does not imply that every possible
notification producer exists.

## Coverage in this release candidate

Status below is **available in this release candidate and not yet deployed**.
Nothing here is live until a deployment says so.

| Notice | What the backend does | Preference category | Email |
|---|---|---|---|
| Scheduled send failed | Hourly digest per account, described above | `infrastructure` | Template in release candidate |
| Domain verification expired or out of date | Verification is re-checked hourly and lasts 7 days (`verification_expires_at`). When a re-check finds the DNS records no longer verify and the domain was not already failed, the event `domain.verification_stale` is recorded once per check. A failed DNS lookup (`check_error`) is not reported, and `checked_at` is a check time, not a registration expiry | `infrastructure` | Template in release candidate |
| Message waiting for approval | `message.awaiting_approval` is recorded once per held message. It waits up to 24 hours and is not sent until approved | `security` | Template in release candidate |
| API key nearing its limit | `api_key.limit_threshold` is recorded once per UTC hour or day when a key reaches its warning percentage (default 80) of its own hourly or daily budget | `security` | Template in release candidate |

For the last three the backend records the event, queues a notification job and
the notification worker has an email template for it. The email names the item
(draft identifier, key name and prefix, or domain) and points to the dashboard or
API; it does not contain message bodies. The category preferences above apply, so
turning a category off skips its emails. This describes the release candidate,
not a deployment: do not assume any account has received these emails. Use
[key safeguards](./key-safeguards) to see what is waiting, and the API for budget
usage and domain check results. Existing recipient approvals are not a
per-message approval queue, and account usage reminders are not per-key alerts.
