Skip to main content

title: Credits description: Track and gate metered feature usage with Crovver credit pools.

Credits let you meter consumable resources, such as AI tokens, SMS messages or API calls, against a customer’s plan. Crovver tracks the balance, refills it every billing period, and refuses consumption on an allowance that blocks once it runs out.

1. Check a Tenant’s Credit Balance

Call this from your frontend with the public key, or from your backend with the secret key.
baseRemaining comes from the plan allocation; addonRemaining comes from purchased add-on packs. Use total for display and gating.
Multi-product tenants: if your org sells multiple products, a tenant can hold one active subscription per product. Pass productSlug (on both credits/balance and credits/consume) to target the right product’s pools — e.g. ?tenantId=workspace_123&productSlug=ats. Without it, the tenant’s most recently created active subscription is used.

2. Consume Credits

Call this from your backend after the tenant performs a metered action. Requires a secret key.
Pass one idempotencyKey per action, derived from something stable such as a request or job ID. Sending the same key again returns the first result and deducts nothing, so retries are safe.

3. Gate actions before consuming

To refuse an action before doing the work, read the balance first and compare total with what the action will cost. Then consume once the work is done. On a pool that blocks, consume still refuses if the balance ran out in between, so the balance check is only for a better user experience.
check-usage-limit and record-usage are deprecated. Usage sent to record-usage is never counted. Use credits/balance and credits/consume.

Limit behaviors

When Credits Refill

Base credits refill automatically at the start of each billing period — you never trigger a refill manually. Add-on credits expire on their own schedule, set by the add-on’s expiry_type (period, days, or never). When the refill happens depends on how the subscription is billed:
Paying a manual renewal early extends the period without granting credits yet. The contract now covers several credit windows, and each is granted at its own boundary — so the subscription.renewed you receive at payment time carries pre-refill balances.Each later grant arrives as its own credits.refilled event. If you mirror balances in your own database, sync from that event rather than from the renewal.
A late renewal grants one window, not the whole gap. It does not back-fill unpaid months. Older pools set to roll over still carry their unused balance forward across the lapse, up to their cap.
Reading qty_granted from a webhook payload? It is the contract-lifetime total, not the current window’s grant, so it will usually far exceed the balance. See Credit Balances.