Skip to navigation

Billing

Billing events describe posted credit changes. API-key events provide a security audit signal but never expose the secret key.

Events and payloads

EventWhen it firesRecommended handling
credits.deductedBillable verification usage is posted.Reconcile by verificationId.
credits.lowBalance crosses the configured threshold.Notify billing owners once per logical event ID.
credits.topped_upA top-up posts successfully.Reconcile the new balance.
credits.grantedPromotional credit is granted.Record the grant and expiry policy.
credits.promo_expiredUnused promotional credit expires.Reconcile the reduction without treating it as usage.
api_key.createdA key is created.Audit the name, environment and type.
api_key.revokedA key is revoked.Remove dependent access and investigate unexpected revocation.
api_key.expiringA key stops working within 30 days. Sent once at 30, 7 and 1 days before its expiry.Rotate or replace the key, or extend its expiry, before expiresAt.
api_key.expiredA key has reached its expiry and requests that use it are refused.Replace the key and check nothing still depends on it.
{
"version": "2026-08-11",
"id": "evt_credit_deducted_01",
"type": "credits.deducted",
"createdAt": "2026-08-15T18:00:00.000Z",
"deliveryId": "del_credit_deducted_01",
"data": { "verificationId": "ver_01", "amount": "0.2000", "currency": "USD" }
}
[
{ "type": "credits.low", "data": { "orgId": "org_01", "balance": "20.0000", "threshold": "25.0000", "currency": "USD" } },
{ "type": "credits.topped_up", "data": { "orgId": "org_01", "amount": "500.0000", "balanceAfter": "1020.0000", "currency": "USD" } },
{ "type": "credits.granted", "data": { "orgId": "org_01", "amount": "50.0000", "balanceAfter": "1070.0000", "currency": "USD", "grantId": "grt_01" } },
{ "type": "credits.promo_expired", "data": { "orgId": "org_01", "amount": "10.0000", "balanceAfter": "1060.0000", "currency": "USD", "grantId": "grt_01" } },
{ "type": "api_key.created", "data": { "apiKeyId": "key_01", "name": "Production server", "environment": "PRODUCTION", "keyType": "SECRET" } },
{ "type": "api_key.revoked", "data": { "apiKeyId": "key_01", "name": "Production server", "environment": "PRODUCTION" } },
{ "type": "api_key.expiring", "data": { "apiKeyId": "key_02", "name": "Checkout server", "environment": "PRODUCTION", "keyType": "SECRET", "expiresAt": "2026-12-01T09:00:00.000Z", "daysRemaining": 7 } },
{ "type": "api_key.expired", "data": { "apiKeyId": "key_02", "name": "Checkout server", "environment": "PRODUCTION", "keyType": "SECRET", "expiresAt": "2026-12-01T09:00:00.000Z", "daysRemaining": 0 } }
]

Field reference

FieldTypeNullableMeaning
orgId, verificationId, grantId, apiKeyIdstringEvent-dependentRelated organisation, usage, grant and key IDs.
amount, balance, balanceAfter, thresholdstringEvent-dependentFixed-scale decimal currency amounts with four fractional digits. Parse with a decimal library; do not use binary floating-point for ledger arithmetic.
currencystringNo for credit eventsISO 4217 currency code such as USD.
namestringNo for key eventsCustomer-visible key name.
environmentstringNo for key eventsSANDBOX or PRODUCTION.
keyTypestringNo on creation and expiry eventsPublic key classification, for example SECRET or PUBLISHABLE.
expiresAtstringNo on expiry eventsWhen the key stops working, as an ISO 8601 timestamp.
daysRemainingintegerNo on expiry eventsWhole days left until expiresAt, rounded up; 0 on api_key.expired.

API-key events never carry the secret, its prefix or any part of it. Each expiry notice is sent once per stage for a given expiry: if you extend a key, it is sent again when the new expiry comes near.

Use billing ledger and API-key read endpoints for authoritative current state. Financial side effects must be idempotent by envelope id, while reconciliation should also use the referenced verification, grant or top-up record.