Usage
GET /usage reports usage for your tenant. It requires the usage:read scope.
{ "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"}Periods
Section titled “Periods”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.
Amounts
Section titled “Amounts”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.
What is counted
Section titled “What is counted”- 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-Keyare not counted again.
Account and limits example
Section titled “Account and limits example”#!/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}'// Sonic Docs contract example: account, limits and this month's usage.// Written against the planned v1 contract; not yet run against a live API.import { API_BASE, api } from './client.mjs';
const account = await (await api(`${API_BASE}/account`)).json();console.log(`Tenant ${account.tenant_id} on ${account.plan}; scopes: ${account.scopes.join(', ')}`);
const limits = await (await api(`${API_BASE}/limits`)).json();console.log(`Upload limit ${limits.max_upload_bytes} bytes, ${limits.max_document_pages} pages`);
// Without start/end, usage covers the current UTC calendar month. Amounts are// six-decimal strings: keep them as strings or use a decimal library.const usage = await (await api(`${API_BASE}/usage`)).json();console.log(`${usage.billable_pages} billable pages, $${usage.charge_usd} charged, $${usage.credit_remaining_usd} credit left`);"""Sonic Docs contract example: account, limits and this month's usage.
Written against the planned v1 contract; not yet run against a live API."""from decimal import Decimal
from client import API_BASE, api
account = api("GET", f"{API_BASE}/account").json()print(f"Tenant {account['tenant_id']} on {account['plan']}; scopes: {', '.join(account['scopes'])}")
limits = api("GET", f"{API_BASE}/limits").json()print(f"Upload limit {limits['max_upload_bytes']} bytes, {limits['max_document_pages']} pages")
# Without start/end, usage covers the current UTC calendar month.# Amounts are six-decimal strings; parse them as Decimal, never float.usage = api("GET", f"{API_BASE}/usage").json()charge, credit = Decimal(usage["charge_usd"]), Decimal(usage["credit_remaining_usd"])print(f"{usage['billable_pages']} billable pages, ${charge} charged, ${credit} credit left")