Zernio
Zernio
API Reference

Usage

Account billing snapshot (plan, cycle, balance, caps, status)GETCalling usage and costGETSMS usage (volumes)GETUsage snapshot (default) or billed-spend metering (with params)GETGet X API pricing tableGET
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
Usage

Usage snapshot (default) or billed-spend metering (with params)

Dual-mode endpoint, selected by query params, and fully backward compatible:

Without metering params (the default): the plan / quota / usage snapshot: plan name, billing period, limits, usage counts, access state. Identical to GET /v1/usage-stats. Existing integrations keep working unchanged.

With range, granularity, from, or to: usage METERING: billed spend (USD) by product family (accounts, numbers, imessage, calls, sms, messages, verify, dlc, xApi, ads, credits, other) over the window, at day / month / total granularity, from the usage-based invoice breakdown (the CHARGE view, which always reconciles with what gets billed). Also served at GET /v1/usage/daily. Usage-based accounts only: legacy Stripe accounts get { "supported": false, "days": [] }.

Attribution (metering mode): groupBy=profile|account adds an attribution breakdown of the window's spend per profile or account, assembled from your own records and pro-rated against the invoice so sum(groups) + unattributed equals totals exactly. profileId / accountId instead project the whole payload (days, totals, lineItems) onto that one group; peaks, callUsage and tax are then null (team-level facts). Projected days spread the group's period share over each day (usage is attributed per period, not per day). Profile-scoped API keys and members only see their profiles' groups (attribution.restricted: true, with totals summing the visible groups). Credits, 10DLC fees and Verify are always unattributed. profileId / accountId on their own do not select metering mode: pair them with range.

For per-domain consumption volumes use GET /v1/usage/calls and GET /v1/usage/sms. For the billing statement (balance, credits, caps, payment status) use GET /v1/billing.


GET
/v1/usage

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Query Parameters

reconcile?boolean

Snapshot mode only. For Stripe subscription users, true forces a subscription reconciliation pass even when cached plan data looks complete.

range?string

Window to report. cycle / prev-cycle resolve to the customer's real billing-period bounds (falling back to a trailing 30 days when no invoice exists yet); 7d…12mo are trailing windows; custom uses from / to.

Default"cycle"

Value in

  • "cycle"
  • "prev-cycle"
  • "7d"
  • "14d"
  • "30d"
  • "3mo"
  • "12mo"
  • "custom"
from?string

Inclusive start (UTC date). Required when range=custom.

Formatdate
to?string

Inclusive end (UTC date). Required when range=custom. Max span 366 days.

Formatdate
granularity?string

Bucketing of the days series: day (one row per UTC day), month (one row per calendar month, dated to the 1st), or total (no series, read totals). Does not affect totals.

Default"day"

Value in

  • "day"
  • "month"
  • "total"
groupBy?string

Metering mode. Adds attribution: the window's spend split per profile or per account (keys are ids; resolve names via GET /v1/profiles / GET /v1/accounts).

Value in

  • "profile"
  • "account"
profileId?string

Metering mode (pair with range). Project the payload onto this profile's attributed share. Mutually exclusive with accountId, and groupBy (if given) must be profile; 404 when the profile is not in your team (or outside a scoped key's profiles).

accountId?string

Metering mode (pair with range). Project the payload onto this account's attributed share. Mutually exclusive with profileId, and groupBy (if given) must be account; 404 when the account is not visible to the caller.

Response Body

application/json

application/json

application/json

application/json

import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.usage.getUsage();console.log(data);
{  "billingSystem": "stripe",  "planName": "string",  "billingPeriod": "monthly",  "signupDate": "2019-08-24T14:15:22Z",  "billingAnchorDay": 0,  "hasAccess": true,  "customerId": "string",  "isInvitedUser": true,  "autoUpgradeEnabled": true,  "limits": {    "uploads": 0,    "profiles": 0  },  "usage": {    "uploads": 0,    "profiles": 0,    "lastReset": "2019-08-24T14:15:22Z",    "connectedAccounts": 0,    "xApiCalls": {      "x_api_005": 0,      "x_api_010": 0,      "x_api_015": 0    },    "xApiCallsByOperation": {      "property1": 0,      "property2": 0    }  },  "spend": {    "currentPeriodCents": 0,    "creditsRemainingCents": 0,    "xSpendCents": 0,    "xSpendLimitCents": 0  }}
Was this page helpful?

SMS usage (volumes)

Aggregated SMS/MMS volumes across your numbers: sent, received, and total message counts, with an optional breakdown by UTC day or by number. Defaults to the last 30 days. Volumes only, deliberately: SMS cost is carrier-rated asynchronously and billed to your invoice, so per-message cost is not available here. Calling usage (GET /v1/usage/calls) does include billable cost.

Get X API pricing table

Returns Zernio's canonical X API pricing table. Each X action has its own billing product and its own rate, and Zernio passes X API costs through at exact rates with zero markup. The response is identical for every authenticated user (pricing is universal), so it is safe to cache on the client for the duration of a billing period. To compute your own per-operation spend, pair this endpoint with `GET /v1/usage-stats`, which returns `usage.xApiCallsByOperation` keyed by the same `operation` field you get here.