# Estado de tu cuenta por API: servicio, números y webhooks

`GET /v1/status/me`

`GET /v1/status/me`, con tu clave de API, dice cómo está **tu** cuenta: lo que la página de estado pública no puede mostrar porque no sabe quién la mira. Sólo trae datos de la cuenta de la clave; nunca una URL completa, un secreto ni importes.

**`service`.** `status` (el mismo de `GET /v1/account`), `sending.paused` con `reason` (prueba vencida, pago fallido…), `receiving.stopped` o `receivingUntil` (hasta cuándo reciben tus números si nada cambia) y `trial`. Contesta también con el envío frenado por cobro.

**`numbers`.** Cada número: `status`, `qualityRating`, `canSend` y `canSendReason` (los de `GET /v1/connections/{id}/sending-status`), `reasonCodes` y `metaBlocks`: los bloqueos de Meta `141006` (medio de pago), `141010` (verificación del negocio) y `131031` (cuenta bloqueada), cada uno con su `explanation` en el idioma de `lang`.

**`webhooks`.** Cada endpoint: `id`, `host` (sólo el dominio: sin ruta, query ni credenciales), `scope` (`account` o `number`), `state` (`active`, `paused`, `auto_disabled` si lo apagamos por fallos seguidos, `number_disconnected`), `consecutiveFailures`, `failingSince`, `lastSuccessAt`, `lastFailureAt`, `lastStatusCode`, sus entregas de 24 h y hasta 5 `failureReasons24h` con `cause`, `httpStatus`, `count` y un `text` claro («Tu endpoint respondió 500.»). `deliveries24h` suma todo: `delivered`, `retrying`, `abandoned`, `pending`.

## Ejemplos

### cURL

```bash
# your account's status, with your webhooks (only your account; never full URLs nor amounts)
curl "https://api.waiaconnect.com/v1/status/me?lang=en" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "status": { "service": { "status": "active", "sending": { "paused": false, … }, … },
#       "numbers": [ { "id": "conn_…", "status": "connected", "canSend": "blocked", "metaBlocks": [ { "code": 141006, "explanation": "…" } ] } ],
#       "webhooks": [ { "id": "wh_…", "host": "hooks.example.com", "state": "active", "consecutiveFailures": 3,
#                       "failureReasons24h": [ { "cause": "http_error", "httpStatus": 500, "count": 6, "text": "Your endpoint responded 500." } ] } ],
#       "deliveries24h": { "delivered": 1180, "retrying": 4, "abandoned": 2, "pending": 0 } } }
```

### Node.js

```javascript
const H = { "Authorization": "Bearer wc_live_YOUR_API_KEY" };
const { status } = await (await fetch("https://api.waiaconnect.com/v1/status/me?lang=en", { headers: H })).json();
if (status.service.sending.paused) console.log("sending paused:", status.service.sending.reason);
for (const w of status.webhooks) if (w.state !== "active" || w.consecutiveFailures) console.log(w.host, w.state, w.failureReasons24h.map(r => r.text));
for (const n of status.numbers) for (const b of n.metaBlocks) console.log(n.id, b.code, b.explanation);
```

### PHP

```php
<?php
$ch = curl_init("https://api.waiaconnect.com/v1/status/me?lang=en");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer wc_live_YOUR_API_KEY"]]);
$s = json_decode(curl_exec($ch), true)["status"];
foreach ($s["webhooks"] as $w) echo $w["host"], " ", $w["state"], " ", $w["consecutiveFailures"], "
";
```

### Python

```python
import requests
s = requests.get("https://api.waiaconnect.com/v1/status/me", params={"lang": "en"}, headers={"Authorization": "Bearer wc_live_YOUR_API_KEY"}).json()["status"]
print(s["service"]["status"], s["deliveries24h"])
for w in s["webhooks"]:
    print(w["host"], w["state"], [r["text"] for r in w["failureReasons24h"]])
```

## Notas

- `?lang=es|en|pt|it` elige el idioma de los textos (por defecto `en`); decidí sobre `cause`, `state` y los códigos, nunca sobre el texto.
- Una entrega abandonada se ve y se reenvía con `GET /v1/webhooks/{id}/deliveries` y `POST …/redeliver`.
- Una cuenta suspendida o dada de baja recibe `403 ACCOUNT_SUSPENDED`.
