Account usage
Get what your account spent in the current period of your plan, broken down by concept and by day: the money balance (WhatsApp API messages, calls and SMS), the API credits (per area of the API, with the endpoints inside each one), the WhatsApp number checks and the AI credits (per agent). It is the same data as the Usage tab of Billing in the webapp.
- The period is the current monthly period of your plan: it starts when your plan renews and ends at the next renewal. On an annual plan it is the current month of the plan, the one your plan credits are refilled for. During a trial it is the trial, from the day you signed up to the day it ends. Without a plan or a trial it is the calendar month of your account's timezone.
- Days are counted in your account's timezone. The first day starts at the hour the period started.
- The detail is updated every 15 minutes, the current hour included.
updated_untiltells you up to when, in your timezone. - To know how many credits you have left, use
/open/info.
Endpointโ
GET https://api.p.2chat.io/open/usage
Authenticationโ
Include your API key in the X-User-API-Key header. Learn more about authentication.
API costโ
Each call to this endpoint deducts 0 API credits from your plan's API credit pool.
Reading your usage is free: this endpoint doesn't consume API credits.
Permissionsโ
Only API keys created by an admin can read the account usage, like the Billing section of the webapp. A key created by an operator gets a 403.
Parametersโ
This endpoint has no parameters.
Invocationโ
- cURL
- Python
- JavaScript
- PHP
curl --location --request GET 'https://api.p.2chat.io/open/usage' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/usage"
headers = {
"X-User-API-Key": "your_api_key_here"
}
response = requests.get(url, headers=headers)
print(response.json())
const axios = require('axios');
const response = await axios.get('https://api.p.2chat.io/open/usage', {
headers: {
'X-User-API-Key': 'your_api_key_here'
}
});
console.log(response.data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.p.2chat.io/open/usage',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'X-User-API-Key: your_api_key_here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Responseโ
Success (HTTP 200 OK)โ
The example is shortened: daily has one value per day of days.
{
"success": true,
"timezone": "America/New_York",
"period_start": "2026-11-01T09:00:00-05:00",
"period_end": "2026-12-01T09:00:00-05:00",
"updated_until": "2026-11-03T10:00:00-05:00",
"days": ["2026-11-01", "2026-11-02", "2026-11-03"],
"wallets": {
"usd": {
"used": 4.8215,
"added": 50.0,
"concepts": [
{ "key": "waba", "quantity": 412, "amount": 3.985, "daily": [1.21, 1.93, 0.845] },
{ "key": "calls", "quantity": 6, "amount": 0.8365, "daily": [0.0, 0.5125, 0.324] }
],
"entries": [
{ "key": "autorecharge", "date": "2026-11-02", "amount": 50.0 }
]
},
"api": {
"used": 1842,
"added": 25000,
"concepts": [
{
"key": "whatsapp_messages",
"quantity": 1240,
"amount": 1240,
"daily": [400, 512, 328],
"items": [
{ "type": 1, "key": "send_message", "quantity": 1100, "amount": 1100 },
{ "type": 103, "key": "whatsapp_received_messages_list", "quantity": 140, "amount": 140 }
]
},
{
"key": "search",
"quantity": 120,
"amount": 600,
"daily": [200, 250, 150],
"items": [
{ "type": 1000, "key": "search", "quantity": 120, "amount": 600 }
]
}
],
"entries": [
{ "key": "plan_refill", "date": "2026-11-01", "amount": 25000 }
]
},
"chk": {
"used": 64,
"added": 0,
"concepts": [
{ "key": "check_number_with_info", "quantity": 32, "amount": 64, "daily": [20, 30, 14] }
],
"entries": []
},
"ai": {
"used": 120,
"added": 0,
"concepts": [
{ "key": "AGT5b1e1c3a-2f41-4a7e-9d3c-8a0f6b2c4d17", "name": "Sales assistant", "quantity": 60, "amount": 120, "daily": [40, 50, 30] }
],
"entries": []
}
}
}
| Field | Description |
|---|---|
timezone | Your account's timezone. Days are counted in it |
period_start | When the current period of your plan started, or your trial, in your timezone (ISO 8601) |
period_end | When it ends: the next renewal of your plan, or the end of your trial, in your timezone (ISO 8601) |
updated_until | Up to when the detail is updated, in your timezone (ISO 8601). null while there is no detail yet |
days | The days of the period so far, YYYY-MM-DD. Every daily list follows this order |
wallets | One object per wallet: usd (money balance, in USD), api (API credits), chk (WhatsApp number check credits) and ai (AI credits) |
wallets.*.used | What was spent in the period: USD for usd, credits for the rest |
wallets.*.added | What was added in the period: purchases, automatic recharges, plan renewals and credits from 2Chat |
wallets.*.concepts | What it was spent on, most spent first. key names the concept, quantity counts calls, messages or responses, amount is what they cost and daily splits amount per day |
wallets.api.concepts[].items | The API endpoints inside each area, with the ApiUsageType type and key of each one. Some calls cost more than 1 credit: see Billing |
wallets.ai.concepts[] | One concept per AI agent: key is the agent's UUID and name its name (null when the agent was deleted) |
wallets.*.entries | What was added, per day. key is plan_refill, purchase, autorecharge or 2chat. A movement that lowers the balance without being spent, such as a plan downgrade, is listed with a negative amount and the key adjustment, and is not counted in added |
Concept keys of the usd wallet: waba (WhatsApp API messages), calls, sms_outbound and sms_inbound. Concept keys of the api wallet: whatsapp_messages, whatsapp_channel, whatsapp_status, whatsapp_groups, catalog, webhooks, contacts, voip, sms, search, flows, zapier, make, slack, hubspot, n8n, account, sdk, waba_messages, coexistence_history, transcriptions and general. Concept keys of the chk wallet: check_number and check_number_with_info.
Errorโ
{
"error": true,
"error_message": "Forbidden"
}
| Status | When |
|---|---|
403 | The account usage isn't enabled for your account, or the API key was created by an operator |
401 | The API key is missing or invalid |