# Email notices and the Notices inbox

`GET /v1/notices`

The **notices about your numbers and your signups** —a number disconnected or removed, flapping, blocked by Meta or missing a card, send rejections, a template approved or blocked, a failing webhook, history about to expire, a number connected, near the 1,000 free messages, a usage drop, your customer's signup sheet— **always** stay in **Notices** (in the dashboard and by API). You choose whether they also arrive by email.

**The account switch.** `GET /v1/account/settings` and `PATCH /v1/account/settings` with `{"emailNotices": false}`. Default: `true`.

**Each number's exception.** `PATCH /v1/connections/{id}` with `emailNotices`: `inherit` (what the account says, the default), `on` or `off`. Every number carries `emailNotices` and `emailNoticesEffective` (whether its notices are emailed today). A number's notice is emailed if the number says `on`, or says `inherit` and the account has `emailNotices: true`; a notice not tied to a number follows the account.

**Reading them.** `GET /v1/notices` (newest first; `connectionId`, `unread=true`, `limit` 1 to 100, `before` = the previous page's `nextBefore`, `lang`). Each notice carries the same text as the email (`subject`, `heading`, `paragraphs`, what to do, button) and `emailStatus`: `suppressed_by_preference` = your switch held the email. `POST /v1/notices/{id}/read` marks it read, in the dashboard too; `POST /v1/notices/read-all` marks them all at once (returns `updated`, how many it marked).

**In the dashboard.** **Settings › Notifications** (the account and number by number) and the **Notices** inbox. Every email of these notices ends with «Don't want these emails? Set up your notices».

## Examples

### cURL

```bash
# 1) stop emailing the notices about your numbers (they stay in /v1/notices)
curl -X PATCH https://api.waiaconnect.com/v1/account/settings -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" -d '{"emailNotices": false}'
# → { "settings": { "emailNotices": false } }

# 2) …but keep emailing this one number (inherit | on | off)
curl -X PATCH https://api.waiaconnect.com/v1/connections/conn_73dc… -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" -d '{"emailNotices": "on"}'

# 3) read the unread notices, in your language
curl "https://api.waiaconnect.com/v1/notices?unread=true&lang=en" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "notices": [ { "id": 1234, "type": "connection_disconnected", "connectionId": "conn_73dc…",
#       "emailStatus": "suppressed_by_preference", "subject": "…", "paragraphs": ["…"], "cta": { … } } ],
#     "unreadCount": 1, "nextBefore": null }

# 4) mark one as read (idempotent)
curl -X POST https://api.waiaconnect.com/v1/notices/1234/read -H "Authorization: Bearer wc_live_YOUR_API_KEY"

# 5) …or mark them all as read at once
curl -X POST https://api.waiaconnect.com/v1/notices/read-all -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "updated": 3 }
```

### Node.js

```javascript
const H = { "Authorization": "Bearer wc_live_YOUR_API_KEY", "Content-Type": "application/json" };

// the account switch, and one number that keeps emailing
await fetch("https://api.waiaconnect.com/v1/account/settings", { method: "PATCH", headers: H, body: JSON.stringify({ emailNotices: false }) });
await fetch("https://api.waiaconnect.com/v1/connections/conn_73dc…", { method: "PATCH", headers: H, body: JSON.stringify({ emailNotices: "on" }) });

// the unread notices, newest first
const { notices, unreadCount } = await (await fetch("https://api.waiaconnect.com/v1/notices?unread=true&lang=en", { headers: H })).json();
for (const n of notices) {
  console.log(n.type, n.connectionId, n.subject);
  await fetch(`https://api.waiaconnect.com/v1/notices/${n.id}/read`, { method: "POST", headers: H });
}
```

### PHP

```php
<?php
$h = ["Authorization: Bearer wc_live_YOUR_API_KEY", "Content-Type: application/json"];
$ch = curl_init("https://api.waiaconnect.com/v1/account/settings");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_HTTPHEADER => $h,
  CURLOPT_POSTFIELDS => json_encode(["emailNotices" => false]),
]);
curl_exec($ch);

$ch = curl_init("https://api.waiaconnect.com/v1/notices?unread=true&lang=en");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $h]);
$notices = json_decode(curl_exec($ch), true)["notices"];
foreach ($notices as $n) {
  echo $n["type"] . " " . $n["subject"] . "\n";
  $r = curl_init("https://api.waiaconnect.com/v1/notices/" . $n["id"] . "/read");
  curl_setopt_array($r, [CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $h]);
  curl_exec($r);
}
```

### Python

```python
import requests
H = {"Authorization": "Bearer wc_live_YOUR_API_KEY"}

# the account switch, and one number that keeps emailing
requests.patch("https://api.waiaconnect.com/v1/account/settings", headers=H, json={"emailNotices": False})
requests.patch("https://api.waiaconnect.com/v1/connections/conn_73dc…", headers=H, json={"emailNotices": "on"})

# the unread notices, newest first
page = requests.get("https://api.waiaconnect.com/v1/notices", headers=H, params={"unread": "true", "lang": "en"}).json()
for n in page["notices"]:
    print(n["type"], n["connectionId"], n["subject"])
    requests.post(f"https://api.waiaconnect.com/v1/notices/{n['id']}/read", headers=H)
```

## Notes

- **Always emailed**, whatever the switches say: billing and payments, security and access, legal notices, support answers and the welcome email.
- An account `emailNotices` that is not `true`/`false` returns `400 SETTINGS_INVALID`; a number's that is not `inherit`, `on` or `off`, `400 CONNECTION_EMAIL_NOTICES_INVALID`.
- An invalid `GET /v1/notices` parameter returns `400 NOTICES_QUERY_INVALID`; a `connectionId` of another account, `404 CONNECTION_NOT_FOUND`; a notice of another account, `404 NOTICE_NOT_FOUND`.
- `type` is an open string (`connection_disconnected`, `template_first_approved`…): new types are added.
