# Conexiones y su estado de salud

`GET /v1/connections`

GET /v1/connections lista los números de la cuenta (read-only). Cada uno trae su `id` (conn_…), su `phoneNumberId` (el id del número en Meta — el valor que acepta el campo `from` al enviar), `label`/`externalId` (tu identidad de reseller), `displayPhone`, y salud: `metaStatus` (connected/pending/flagged/restricted/disconnected), `qualityRating`, `messagingTier`. Lo único mutable por API es la identidad de reseller: `PATCH /v1/connections/:id` (`label`, `externalId`, `monthlyMessageLimit`, `notes`).

## Ejemplos

### 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"])
```

## Notas

- `externalId` es único por cuenta y **viaja en cada webhook** (`envelope.connection.externalId`) → no necesitás una tabla de mapeo.
