# API rejections: which requests Connect rejected

`GET /v1/api-rejections`

`GET /v1/api-rejections` lists your account's `/v1` requests that Connect answered with an error, grouped: HTTP (`status`), `code`, method, route (the pattern, e.g. `/v1/templates/:id`), number (`connectionId`, `externalId`), stage (`stage`: `auth`, `blocked`, `quota`, `connection`, `template`, `validation`, `meta`, `internal`, `overflow`), whether it reached Meta (`reachedMeta`, `metaCode`), how many times (`count`) and the first and last time. Use it to find an error your system did not log.

**Window.** `days` = 7 (default) or 30 (what we keep). `connectionId` (`conn_…` or your `externalId`) filters by number. `total`, `last24h` and `byStage` sum it up.

## Examples

### cURL

```bash
# what Connect rejected in the last 7 days (days=30 for the month), grouped
curl "https://api.waiaconnect.com/v1/api-rejections?days=7" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "total": 42, "rejections": [ { "status": 400, "code": "TEMPLATE_PARAM_COUNT_MISMATCH",
#       "method": "POST", "route": "/v1/messages", "stage": "template", "count": 30, "lastAt": "…" } ], … }
```

### Node.js

```javascript
const H = { "Authorization": "Bearer wc_live_YOUR_API_KEY" };
const r = await (await fetch("https://api.waiaconnect.com/v1/api-rejections?days=30", { headers: H })).json();
for (const g of r.rejections) console.log(g.count, g.status, g.code, g.method, g.route, g.lastAt);
```

### PHP

```php
<?php
$ch = curl_init("https://api.waiaconnect.com/v1/api-rejections?days=7");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer wc_live_YOUR_API_KEY"]]);
foreach (json_decode(curl_exec($ch), true)["rejections"] as $g) {
  echo $g["count"], " ", $g["status"], " ", $g["code"], " ", $g["route"], "
";
}
```

### Python

```python
import requests
r = requests.get("https://api.waiaconnect.com/v1/api-rejections", params={"days": 7}, headers={"Authorization": "Bearer wc_live_YOUR_API_KEY"}).json()
for g in r["rejections"]:
    print(g["count"], g["status"], g["code"], g["method"], g["route"], g["lastAt"])
```

## Notes

- It never carries the request body, recipients, texts or the key.
- An invalid parameter is `400 API_REJECTIONS_QUERY_INVALID`.
- Only your account's: a key never sees another account's rejections.
