Skip to main content
Bill customers based on what they actually use—API calls, storage, compute hours, or any measurable unit. This guide walks you through setting up usage-based billing in the dashboard.

How Usage Billing Works

  1. Usage occurs - Customer uses your product (API calls, storage, etc.)
  2. Events recorded - Usage events are sent to Alguna
  3. Usage aggregated - Alguna totals usage for the billing period
  4. Invoice generated - Charges calculated based on your pricing
  5. Payment collected - Customer pays for their usage

Step 1: Create a Billable Metric

Define what you want to measure:
  1. Navigate to Settings → Billable Metrics
  2. Click Create Metric
  3. Fill in the details:
    • Name: What you’re measuring (e.g., “API Calls”)
    • Code: Unique identifier (e.g., api_calls)
    • Aggregation Type: How to count usage

Aggregation Types

TypeDescriptionExample
CountCount number of eventsNumber of API requests
SumSum a property valueTotal GB transferred
Unique CountCount unique valuesUnique active users
MaxMaximum value in periodPeak concurrent connections
  1. Click Create

Step 2: Create a Usage-Based Product

  1. Navigate to Products
  2. Click New Product
  3. Configure:
    • Name: Product name (e.g., “API Usage”)
    • Fee Type: Select Metered
    • Metric: Select the metric you created
    • Pricing Model: Choose how to price usage

Pricing Models for Usage

ModelDescriptionExample
Per UnitFixed price per unit$0.001 per API call
TieredDifferent prices at different volumesFirst 1,000 free, then $0.01 each
VolumeAll units at same rate based on total0-1000: 0.01,1001+:0.01, 1001+: 0.008 each
PackagePrice per bundle of units$10 per 1,000 calls
  1. Click Save

Step 3: Add to a Plan

  1. Navigate to Plans
  2. Select or create a plan
  3. Click Add Product
  4. Select your usage-based product
  5. Click Save

Step 4: Send Usage Events

Work with your development team to send usage events. They’ll need:
  • Metric Code: The code you defined (e.g., api_calls)
  • Account ID: The customer’s Alguna account ID
  • Timestamp: When the usage occurred
See the Events API Reference for technical details.

Viewing Customer Usage

Current Period Usage

  1. Navigate to Customers → [Customer Name]
  2. Click the Usage tab
  3. View:
    • Usage by metric
    • Estimated charges
    • Usage trends

Historical Usage

  1. Navigate to Reports → Usage
  2. Filter by customer, metric, or date range
  3. Export data if needed

Common Use Cases

API Billing

MetricAggregationPricing
API RequestsCountTiered (free tier + overage)

Storage Billing

MetricAggregationPricing
Storage (GB)MaxPer unit per month

Compute Billing

MetricAggregationPricing
Compute HoursSumPer unit

Active User Billing

MetricAggregationPricing
Active UsersUnique CountPer user per month

Troubleshooting

No Usage Showing

  1. Verify usage events are being sent (check with your dev team)
  2. Confirm the metric code matches exactly
  3. Check timestamps are within the billing period

Incorrect Charges

  1. Review the metric aggregation type
  2. Check pricing model configuration
  3. Verify billing period dates

Best Practices

Clear Naming

Use descriptive metric names customers will understand.

Test First

Test usage tracking in sandbox before production.

Monitor Usage

Regularly review usage reports for anomalies.

Communicate Pricing

Clearly explain usage-based charges to customers.

Next Steps