Using API to Check Customer's Bills
This document describes how white-label partners can query customers' WhatsApp fees through the API
Last updated
This document describes how white-label partners can query customers' WhatsApp fees through the API
Last updated
You can obtain the WhatsApp fees for your site's customers by calling the daily billing API.
Interface URL: https://api.ycloud.com/v2/billing/usageDetails
Function Description: Returns billing data by day, paginated. Grouping criteria: date (daily, fixed UTC+8 time zone), sending region, message channel (WhatsApp, SMS, voice, email), WABA ID (only applicable for WhatsApp channel). Sorting: by date in descending order.
Request Method: GET
Request Headers:
Parameter | Description |
---|---|
Request Parameters:
Parameter | Description |
---|---|
Request Example:
Response Example:
Response Fields:
Common fields like offset, limit, etc., are omitted, see Pagination.
The fields of the returned items[] object are as follows:
Field | Type | Description |
---|---|---|
X-API-Key
[Required] Account API Key, see Console.
X-Managed-Account-ID
Applicable only for white-label partners.
If your account has one or more managed accounts, you can specify a managed account ID, which will make the request as the managed account and retrieve its billing data.
page
Page number, integer, range [1,100].
Default is 1.
limit
Page size, integer, range [1,100].
Default is 10.
includeTotal
Whether to return the total record count, values true / false, default is false.
filter.startDate
[Required] Billing start date (inclusive), format yyyy-MM-dd, example 2024-01-31
filter.endDate
[Required] Billing end date (inclusive), format yyyy-MM-dd, example 2024-01-31
filter.wabaId
WABA ID
date
string
Billing date, format yyyy-MM-dd, example 2024-01-31
isTransient
boolean
Whether it's temporary. For nearly real-time bills from yesterday or today, it might not be accurate and can change, marked as true.
If false, it means the bill is final.
channel
string
Message channel. Enumeration: whatsapp, sms, voice, email.
wabaId
string
WABA ID. Included when channel is whatsapp.
regionCode
string
Region where the message was sent, two-letter country or region codes.
costItems[].cost
double
Amount consumed, in USD
costItems[].quantity
integer
Number of billed messages
costItems[].unitPrice
double
Average unit price
costItems[].conversationOriginType
string
WhatsApp conversation type. Included only when channel is whatsapp.
Enumeration: authentication, authentication_international, marketing, utility, service.