waiaconnect

Documentation / Complete

Usage and limits

GET /v1/usage

GET /v1/usage gives the period consumption: used, included, remaining, policy (block|queue) and a breakdown by origin (api, contact, device). ⚠ The phone-traffic rule (Coexistence): used = api + contact; device traffic (what the owner sends from the phone) is shown but does NOT consume the plan. The PER-NUMBER limit (monthlyMessageLimit) counts only api. Per number: /v1/connections/:id/usage and /v1/usage/by-connection; informational oversubscription: /v1/accounts/oversubscription.

curl https://api.waiaconnect.com/v1/usage \
  -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "used": 89, "included": 25000, "remaining": 24911, "policy": "block",
#     "breakdown": { "api": 0, "contact": 89, "device": 62 },
#     "breakdownNote": "used = api + contact; device does not count" }
const res = await fetch("https://api.waiaconnect.com/v1/usage", {
  headers: { "Authorization": "Bearer wc_live_YOUR_API_KEY" }
});
const u = await res.json();
console.log(u.used, "/", u.included); // device is in u.breakdown.device but NOT billed
<?php
$ch = curl_init("https://api.waiaconnect.com/v1/usage");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer wc_live_YOUR_API_KEY"],
]);
$u = json_decode(curl_exec($ch), true);
echo $u["used"] . " / " . $u["included"]; // device is shown but not billed
import requests
res = requests.get("https://api.waiaconnect.com/v1/usage",
  headers={"Authorization": "Bearer wc_live_YOUR_API_KEY"})
u = res.json()
print(u["used"], "/", u["included"])  # u["breakdown"]["device"] is shown but not billed

Buckets aggregate in UTC; the account timezone is returned only so you can caption it.

The 70/90/100% thresholds also reach you by webhook (usage.thresholdreached / connection.usagethreshold_reached).