Skip to content

Usage

GET /usage reports usage for your tenant. It requires the usage:read scope.

api/specs/examples/usage.json (contract fixture)
{
"tenant_id": "tenant_demo",
"period_start": "2026-11-01T00:00:00Z",
"period_end": "2026-12-01T00:00:00Z",
"as_of": "2026-11-30T20:00:00Z",
"processed_pages": 10,
"billable_pages": 10,
"charge_usd": "0.100000",
"credit_remaining_usd": "149.900000"
}

Without parameters, usage covers the current calendar month in UTC. Pass start and end as RFC 3339 timestamps to choose another period: start is inclusive, end is exclusive, and the period can be at most 93 days. An invalid period returns 400 invalid_period. as_of tells you how current the figures are.

charge_usd and credit_remaining_usd are strings with exactly six decimal places, such as "0.100000". Parse them with a decimal type, never a binary floating-point number.

  • Pages are counted once per document, when processing succeeds.
  • Failed processing is not charged.
  • Internal retries, duplicate deliveries and replayed uploads with the same Idempotency-Key are not counted again.
docs/public/examples/curl/account.sh
#!/usr/bin/env bash
# Sonic Docs contract example: inspect the account, limits and this month's usage.
# Written against the planned v1 contract; not yet run against a live API.
set -euo pipefail
API_BASE="${SONIC_API_BASE:-https://api.sonicdocs.ai/v1}"
: "${SONIC_API_KEY:?Set SONIC_API_KEY (usage needs usage:read)}"
AUTH="Authorization: Bearer $SONIC_API_KEY"
curl -sS --fail-with-body -H "$AUTH" "$API_BASE/account" | jq '{tenant_id, plan, scopes}'
curl -sS --fail-with-body -H "$AUTH" "$API_BASE/limits" | jq .
# Without start/end, usage covers the current UTC calendar month.
curl -sS --fail-with-body -H "$AUTH" "$API_BASE/usage" |
jq '{period_start, period_end, billable_pages, charge_usd, credit_remaining_usd}'