# Alerts by API: your dashboard's Alerts list

`GET /v1/alerts`

`GET /v1/alerts` is the same **Alerts** list as your dashboard, with your key: only your account's, newest first. Each alert has `id` (`alr_…`), `code` (stable: your system decides on it), `severity`, `status` (`open` while the situation holds; most close by themselves), the number (`connectionId`, `externalId`), `since`, `resolvedAt`, `lastOccurredAt`, `repeatCount`, a short English `title` and `message` and `refs` (`metaCode`, `cause`, `template`, `webhookId`, `deliveryId`, `messageId`).

**Filters.** `status` (`open`, `resolved`, `all`), `connectionId` (`conn_…` or your `externalId`), `since` (ISO 8601), `severity` and `code`; `page` and `pageSize` (1 to 100). `openCount` = the open ones of the whole account.

**By webhook.** `alert.opened` and `alert.closed` carry the same object in `data.alert`. Catalog 6: list them by name.

**Which code is which.** `connection_disconnected` (number down; `refs.cause`), `connection_partner_removed` (removed from the app or in Meta), `connection_token_revoked`, `connection_permission_lost` and `connection_unreadable` (Meta does not let us read it), `connection_quality_drop`, `connection_name_rejected`, `waba_account_restricted`, `waba_review_rejected`, `meta_payment_health_blocked` (141006), `outbound_meta_billing` (131042), `template_approved_payment_blocked` (approved and held by the payment), `outbound_retries_exhausted` (`refs.metaCode`, e.g. 131031), `send_rejected_shape`, `template_rejected`, `template_recategorized`, `template_draft_submitted`, `signup_landed_meta_only` (the signup stayed in Meta), `trial_warning`, `trial_expired`, `billing_payment_failed`, `billing_send_blocked`, `billing_service_cutoff_warning`, `billing_service_cutoff` (stops receiving), `webhook_endpoint_failing`, `webhook_endpoint_auto_disabled`, `webhook_delivery_abandoned` and `history_reminder`.

## Examples

### cURL

```bash
# the open alerts of one number (conn_… or your externalId), newest first
curl "https://api.waiaconnect.com/v1/alerts?status=open&connectionId=conn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "alerts": [ { "id": "alr_…", "code": "connection_disconnected", "severity": "critical",
#       "status": "open", "connectionId": "conn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "since": "…", "refs": { "cause": "coexistence_app" } } ],
#     "total": 1, "page": 1, "pageSize": 50, "hasMore": false, "openCount": 1 }
```

### Node.js

```javascript
const H = { "Authorization": "Bearer wc_live_YOUR_API_KEY" };
const r = await (await fetch("https://api.waiaconnect.com/v1/alerts?status=open&pageSize=100", { headers: H })).json();
for (const a of r.alerts) {
  // decide on a.code (stable), never on a.title
  if (a.code === "connection_disconnected") console.log(a.connectionId, a.refs.cause, a.since);
}
```

### PHP

```php
<?php
$ch = curl_init("https://api.waiaconnect.com/v1/alerts?status=open&pageSize=100");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer wc_live_YOUR_API_KEY"]]);
$r = json_decode(curl_exec($ch), true);
foreach ($r["alerts"] as $a) {
  // decide on $a["code"] (stable), never on the title
  echo $a["code"], " ", $a["connectionId"], " ", $a["since"], "\n";
}
```

### Python

```python
import requests
H = {"Authorization": "Bearer wc_live_YOUR_API_KEY"}
r = requests.get("https://api.waiaconnect.com/v1/alerts", params={"status": "open", "pageSize": 100}, headers=H).json()
for a in r["alerts"]:
    print(a["code"], a["connectionId"], a["since"], a["refs"])  # decide on code, never on title
```

## Notes

- Treat `code` as an open string: new codes are added. Never decide on `title` or `message`.
- An invalid parameter is `400 ALERTS_QUERY_INVALID`; a `connectionId` of another account, `404 CONNECTION_NOT_FOUND`.
- Platform alerts (ours) are not included; phone numbers in the text are masked.
