# Connections and their health

`GET /v1/connections`

GET /v1/connections lists the account's numbers (read-only). Each carries its `id` (conn_…), its `phoneNumberId` (Meta's id for the number — the value the `from` field takes when sending), `label`/`externalId` (your reseller identity), `displayPhone`, and health: `metaStatus` (connected/pending/flagged/restricted/disconnected), `qualityRating`, `messagingTier`. The only thing mutable via the API is the reseller identity: `PATCH /v1/connections/:id` (`label`, `externalId`, `monthlyMessageLimit`, `notes`).

## Examples

### cURL

```bash
curl https://api.waiaconnect.com/v1/connections \
  -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "connections": [ { "id": "conn_…", "label": "…", "externalId": "…",
#       "displayPhone": "…", "metaStatus": "connected", "qualityRating": "…" } ] }
```

### Node.js

```javascript
const res = await fetch("https://api.waiaconnect.com/v1/connections", {
  headers: { "Authorization": "Bearer wc_live_YOUR_API_KEY" }
});
const { connections } = await res.json();
for (const c of connections) console.log(c.id, c.metaStatus, c.qualityRating);
```

### PHP

```php
<?php
$ch = curl_init("https://api.waiaconnect.com/v1/connections");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer wc_live_YOUR_API_KEY"],
]);
$data = json_decode(curl_exec($ch), true);
foreach ($data["connections"] as $c) { echo $c["id"] . " " . $c["metaStatus"] . "\n"; }
```

### Python

```python
import requests
res = requests.get("https://api.waiaconnect.com/v1/connections",
  headers={"Authorization": "Bearer wc_live_YOUR_API_KEY"})
for c in res.json()["connections"]:
    print(c["id"], c["metaStatus"], c["qualityRating"])
```

## Notes

- `externalId` is unique per account and **travels in every webhook** (`envelope.connection.externalId`) → you need no mapping table.
