Whats91
Developers

Read message billing records for one WhatsApp registered number.

Number-specific Billing History

Summary

Read message billing records for one WhatsApp registered number.

Prerequisites

  • Authorization: Bearer w91_live_xxx
  • Content-Type: application/json for JSON requests

Use number-specific billing when reconciling costs for one WhatsApp registered number. Number-scoped tokens cannot use another number.

Endpoint: GET /api/v2/billing/messages?senderId=919999999999.

Endpoint: GET /api/v2/billing/messages/by-number/{phoneNumberId}.

GET/api/v2/billing/messages/by-number/{phoneNumberId}
ParameterTypeRequiredDescription
phoneNumberIdstringRequiredMeta phone number id for the sender being reconciled.
senderIdstringOptionalAlternative WhatsApp sender phone number filter through /billing/messages.
pagenumberOptionalPositive integer. Default 1.
limitnumberOptionalPositive integer. Default 50, max 200.
dateFromstringOptionalYYYY-MM-DD start date.
dateTostringOptionalYYYY-MM-DD end date.
billablestringOptionaltrue, false, payable, or free.
Phone number billing history
curl "https://graph.whats91.com/api/v2/billing/messages/by-number/1234567890?limit=50" \
  -H "Authorization: Bearer w91_live_xxx"
Number billing response
{
  "success": true,
  "message": "Billing records retrieved",
  "data": {
    "scope": "sender",
    "phoneNumberId": "1234567890",
    "senderId": "919999999999",
    "billingRecords": [],
    "pagination": {
      "page": 1,
      "limit": 50,
      "total": 0,
      "hasMore": false
    }
  }
}

SDK Examples

Use these examples as starting points for server-side implementations.

cURL
curl -X GET "https://graph.whats91.com/api/v2/billing/messages/by-number/{phoneNumberId}" \
  -H "Authorization: Bearer w91_live_xxx"
Node.js
const response = await fetch("https://graph.whats91.com/api/v2/billing/messages/by-number/{phoneNumberId}", {
  method: "GET",
  headers: {
    "Authorization": "Bearer w91_live_xxx",
    "Content-Type": "application/json"
  }
});

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/billing/messages/by-number/{phoneNumberId}");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer w91_live_xxx",
    "Content-Type: application/json"
  ]
]);

$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests

response = requests.request(
    "GET",
    "https://graph.whats91.com/api/v2/billing/messages/by-number/{phoneNumberId}",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    }
)

print(response.json())
C#
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer w91_live_xxx");

var request = new HttpRequestMessage(HttpMethod.Get, "https://graph.whats91.com/api/v2/billing/messages/by-number/{phoneNumberId}");

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Related APIs