How usage billing works
- Usage occurs — the customer uses your product
- Events recorded — your application sends events to
POST /events, tagged with the customer and anevent_name - Usage aggregated — at invoice time, Alguna evaluates each metric over the billing period
- Invoice generated — the aggregated quantity is priced by the product’s pricing model
- Payment collected — with the customer’s stored payment method, or by invoice
Step 1: Create a billable metric
A metric names theevent_name to read, optional filters on event properties, and the aggregation.
Dashboard: open Billable Metrics, click Create Metric, and set the name, event name and aggregation.
API:
id (mtr_…). Reference: Create a billable metric; all options in Create metrics and the metrics reference.
Step 2: Create a usage-based product
Dashboard: open Products, click New Product, set Fee type to Metered, choose the metric, and pick a pricing model. API: create the product with Create a product (fee_type: "metered"), then price it when you add it to a plan or subscription — a metered price carries metric_ids: ["mtr_…"] and a pricing model. Examples in Creating a subscription.
Pricing models for usage
See Pricing models and the API’s pricing model reference.
Step 3: Add it to a plan
Dashboard: open Plans, select or create a plan, click Add Product, choose the metered product, and save. API: include the product in the plan’s items with Create a plan, or put the metered price directly on a subscription with Create a subscription. See Plans.Step 4: Send usage events
Every event needs:ingested and failed IDs. For batching, buffering, CSV import and warehouse connectors, see Send usage events. Reference: Ingest billable events.
Viewing customer usage
Current period
- Open Customers and select the customer
- Open the Usage tab to see usage by metric, estimated charges and trends
Historical usage and revenue
Open Revenue Insights to filter by customer, metric or date range; see Revenue Insights. The same figures are available through the Insights endpoints.Common use cases
Troubleshooting
No usage showing
- Check the
failedlist in thePOST /eventsresponse — a 200 does not mean every event was accepted - Confirm
event_namematches the metric exactly - Confirm
accountresolves to the customer on the subscription (ID or alias) - Check timestamps fall within the billing period
Incorrect charges
- Review the metric’s aggregation method and
field - Check the pricing model on the product
- Verify the billing period dates on the subscription
Best practices
Set unique_id on every event
Retries are then safe; the same event is never counted twice.
Use event time
Send the time the usage happened, not the time you sent it.
Test in sandbox
Send known event sets and check the metric before going live.
Filter at the metric
Exclude internal or failed requests with metric filters, not in pricing.
Next steps
Create metrics
Filters, aggregations and API examples.
Pricing models
Unit, tiered, volume and package pricing.
Credits quick start
Sell prepaid credits against the same metrics.
Developer quick start
Auth, SDK, webhooks and sandbox.