API v1REST · JSON · HTTPS

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

GET/v1/usage

Messages sent and what they cost, for one calendar month.

Query

  • periodstringoptional
    The month as YYYY-MM. Defaults to the current month.

Response

  • attemptsintegerrequired
    Messages you asked us to send.
  • acceptedintegerrequired
    Messages handed to the network.
  • billable_unitsintegerrequired
    Messages you were charged for.
  • amountstring (decimal)required
    What they cost you, in rupees, before GST.
curl "https://api-diotp.diorbit.com/v1/usage?period=2026-11" \
  -H "Authorization: Bearer $DIOTP_API_KEY"
Response200 OK
{
  "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.

Request
curl "https://api-diotp.diorbit.com/v1/usage?period=2026-10" \
  -H "Authorization: Bearer $DIOTP_API_KEY"
A month of usage200 OK
{
  "period": "2026-10",
  "attempts": 1240,
  "accepted": 1231,
  "billable_units": 1231,
  "amount": "246.2000"
}
A period that is not a month422 Unprocessable Entity
{
  "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

StatusCodeMeaning
401unauthorizedThe API key is missing, wrong or revoked.
422invalid_requestperiod 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.

Need help integrating?

Our team helps with integration, DLT templates and going live.