Retrieve usageGET /v1/usage
Read how many messages you sent in a calendar month and what they cost, for your own reports and reconciliation.
Account
Retrieve usage
Messages sent and what they cost, for one calendar month.
Query
- periodstringoptionalThe month as
YYYY-MM. Defaults to the current month.
Response
- attemptsintegerrequiredMessages you asked us to send.
- acceptedintegerrequiredMessages handed to the network.
- billable_unitsintegerrequiredMessages you were charged for.
- amountstring (decimal)requiredWhat they cost you, in rupees, before GST.
curl "https://api-diotp.diorbit.com/v1/usage?period=2026-11" \ -H "Authorization: Bearer $DIOTP_API_KEY"
const res = await fetch("https://api-diotp.diorbit.com/v1/usage?period=2026-11", { headers: { Authorization: `Bearer ${process.env.DIOTP_API_KEY}` }, }); const usage = await res.json();
usage = requests.get(
"https://api-diotp.diorbit.com/v1/usage",
params={"period": "2026-11"},
headers={"Authorization": f"Bearer {os.environ['DIOTP_API_KEY']}"},
timeout=10,
).json()<?php $ch = curl_init("https://api-diotp.diorbit.com/v1/usage?period=2026-11"); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer " . getenv("DIOTP_API_KEY")]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $usage = json_decode(curl_exec($ch), true);
{
"period": "2026-11",
"attempts": 1240,
"accepted": 1231,
"billable_units": 1231,
"amount": "246.2000"
}What it counts
GET /v1/usage returns the messages your account sent in one calendar month and what they cost. The numbers are counted at the moment you ask, so the current month keeps growing until it ends.
attempts is every message DiOTP tried to hand to a mobile network. accepted is how many the network took. billable_units is how many you were charged for: every accepted message is billable. amount is what those messages cost, in rupees before 18% GST, as a decimal string so it never loses precision. Messages stopped by a rate limit or a validation error never reach a network, so they do not appear here and cost nothing. Test-mode messages are counted but priced at zero.
Request and response examples
Pass the month as YYYY-MM. Leave it out for the current month. Months follow UTC.
curl "https://api-diotp.diorbit.com/v1/usage?period=2026-10" \ -H "Authorization: Bearer $DIOTP_API_KEY"
{
"period": "2026-10",
"attempts": 1240,
"accepted": 1231,
"billable_units": 1231,
"amount": "246.2000"
}{
"error": {
"code": "invalid_request",
"message": "period must be YYYY-MM",
"request_id": "3f1c9a0e5b7d4e2a8c6f1b0d9e8a7c6b"
}
}Using it for reconciliation
- Compare billable_units with the codes your own system asked for. A large gap usually means retries without an Idempotency-Key.
- Compare amount with the debits in your wallet history in the dashboard for the same month.
- For invoices, use the GST invoices issued with each recharge. This endpoint reports usage, not payments.
Error codes
| Status | Code | Meaning |
|---|---|---|
| 401 | unauthorized | The API key is missing, wrong or revoked. |
| 422 | invalid_request | period is not a real month in the form YYYY-MM, for example 2026-13 or 2026/10. |
Retrieve usage: FAQ
A network can refuse a message, for example when the number cannot receive messages. Those attempts are not charged.
Not necessarily. Usage is grouped by when messages were sent, in UTC. Invoices are issued per recharge, not per month.
Not through the API today. The message log in your dashboard lists every message with its time and status.
Need help integrating?
Our team helps with integration, DLT templates and going live.

