> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperline.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with usage-based billing

> Build your first usage-based billing workflow in Hyperline: send events, create an aggregator, configure a metered product, and bill a subscription.

Usage-based billing lets you charge customers based on what they consume: API calls, transactions, storage, compute hours, seats, AI usage, or another measurable activity.

> [!NOTE]
>
> Monetizing AI products? See [Monetize an AI product](https://docs.hyperline.co/guides/monetize-ai-products.md) for guidance on usage-based billing, prepaid credits, wallets, and hybrid pricing patterns for AI products.

In Hyperline, the setup has four building blocks:

| Building block | What it does |
| - | - |
| **Usage events** | Raw customer activity sent to Hyperline through a CSV import, API, data loader, or test simulation. |
| **Aggregator** | Turns usage events into one billable metric, such as a count of API calls or the sum of stored gigabytes. |
| **Usage product** | Defines what you sell and how that metric is priced. |
| **Subscription** | Assigns the product to a customer, with billing, payment, and metering settings. |

> [!TIP]
>
> Start with one simple usage metric before adding tiered pricing, filters, commitments, or spending caps. It is easier to validate the full billing flow when the first setup is intentionally small.

## Before you start

Make sure you have:

* A customer to test with, or permission to create one in **Customers**
* A usage metric you want to bill, such as API calls, processed transactions, or storage volume
* Usage data available through one of the supported ingestion methods
* A [test mode](https://docs.hyperline.co/docs/getting-started/sandbox.md) workspace if you want to experiment before billing real customers

> [card] Example 💡
>
> You sell an API product with a monthly platform fee and a usage-based add-on. The add-on bills each customer for the number of API calls they make during the month. To set this up, you send API call events to Hyperline and create an aggregator that counts those events. Then you link the aggregator to a usage product and add that product to the customer's subscription.

## Setup flow

### 1. Connect usage data

Hyperline needs usage events before it can calculate a usage-based charge. Select the ingestion method that matches where your usage data already lives:

> [card] [CSV import](https://docs.hyperline.co/docs/usage/import-events-csv.md)
>
> Upload usage events from a spreadsheet or exported report.

> [card] [API](https://docs.hyperline.co/docs/usage/send-usage-data.md)
>
> Send events from your application or backend systems.

> [card] [Data loaders](https://docs.hyperline.co/docs/usage/usage-data-with-connectors.md)
>
> Pull usage data from a connected database or warehouse.

> [card] [Simulated events](https://docs.hyperline.co/docs/usage/simulate-usage-data.md)
>
> Create test usage directly from a customer page in test mode.

For each event, Hyperline needs enough information to identify the customer, event type, timestamp, and usage properties you want to bill or filter on.

> [!NOTE]
>
> If you are still exploring the model, use [simulated events](https://docs.hyperline.co/docs/usage/simulate-usage-data.md) in test mode. You can validate the subscription and invoice behavior before connecting a production data source.

### 2. Create an aggregator

Go to **Usage** > **Aggregators**, then click **New aggregator**.

An aggregator defines how Hyperline turns raw events into a billable number. Configure:

* **Event type**: the event category to measure, such as `api_call`, `transaction`, or `storage_snapshot`
* **Operation**: how the metric is calculated
* **Unit name**: the label shown in usage charts, prices, invoices, and the customer portal
* **Filters**: optional rules that include only matching events

| Operation | Use it when |
| - | - |
| **Count** | Each matching event should count as one unit, such as one API call or one transaction. |
| **Sum** | A numeric field on the event should be added up, such as gigabytes stored or compute minutes. |
| **SQL formula** | You need a custom calculation, such as applying an allowance, cap, or adjustment before billing. |

Learn more in [Aggregators](https://docs.hyperline.co/docs/usage/aggregators.md).

### 3. Create a usage product

Go to **Products**, click **New product**, then select **Usage**.

When configuring the product:

1. Add the product name and description.
2. Select the aggregator you created.
3. Configure at least one recurring price.
4. Select the pricing model and tiers that match your commercial offer.
5. Save the product.

For a simple first setup, use one recurring price with a straightforward rate. You can add advanced pricing later, such as volume tiers, basis points, or price-level metering filters.

> [!NOTE]
>
> You configure usage products in the product catalog, then reuse them in quotes, subscriptions, and customer-specific agreements. See [Products and prices](https://docs.hyperline.co/docs/products/overview.md#usage) for the full product setup reference.

### 4. Add the product to a subscription

Once the usage product has a recurring price, assign it to a customer subscription.

1. Open the customer page.
2. Click **Actions** > **Assign new subscription**, or go to **Subscriptions** and click **New subscription**.
3. Select the customer and subscription start date.
4. Click **Add product** and select the usage product.
5. Review the product price, billing interval, and metering settings.
6. Open **Payment settings**.
7. For testing, select **Manually later** so you can create the subscription without collecting payment immediately.
8. Click **Assign subscription**.

After you assign the subscription, Hyperline starts tracking usage for the product based on the subscription's metering period.

> [!TIP]
>
> If the customer has both fixed and usage-based charges, add both products to the same subscription. This keeps the recurring fee and usage charges together in the customer's invoice flow.

### 5. Check usage and invoices

After you connect events and the subscription is active, validate the setup from the customer page:

* Open the customer's **Usage** tab to see current aggregator consumption.
* Open the customer's **Subscriptions** tab to review usage on the active subscription.
* Click **Explore** or the usage detail icon to inspect the events behind the total.
* Open the customer's **Invoices** tab to check the `open` invoice preview for the current period.

An `open` invoice is a live preview. For usage-based subscriptions, it updates as new events are recorded. At the end of the billing period, the invoice enters the configured grace period before Hyperline finalizes it and sends it for payment.

## Common first checks

If the subscription does not show the usage you expect, check these items first:

* The event timestamps fall inside the subscription's current metering period.
* The event type matches the aggregator's **Event type**.
* The event belongs to the same customer as the subscription.
* The aggregator filters do not exclude the events.
* The usage product is included in an active subscription.

For more invoice behavior details, see [Invoice terms](https://docs.hyperline.co/docs/invoices/term.md).

## Next steps

> [card] [Follow the full setup guide](https://docs.hyperline.co/guides/configure-usage-based-billing.md)
>
> Walk through an end-to-end usage-based subscription setup.

> [card] [Configure aggregators](https://docs.hyperline.co/docs/usage/aggregators.md)
>
> Learn how count, sum, formulas, filters, and thresholds work.

> [card] [Explore customer usage](https://docs.hyperline.co/docs/usage/customer-usage.md)
>
> Monitor consumption and inspect the events behind each metric.

> [card] [Review metering settings](https://docs.hyperline.co/docs/subscriptions/metering.md)
>
> Understand subscription-level metering periods and usage windows.

> [!NOTE]
>
> Is something still unclear? Don't hesitate to reach out to our team via the in-app chat if you need additional support.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.