How to Understand Revenue and Cost of API Usage in Moesif

Overview

In this guide, you’ll learn how to use Moesif’s reporting-only Billing Meter and Billing Report Metrics to dig deep into your API usage and associated revenue.

Objectives

  • Use Product Catalog to define products and prices that define your usage-based revenue model.
  • Set up a reporting-only Billing Meter that tracks, meters, and reports API usage and the corresponding revenue.
  • Use Billing Report Metrics to analyze and visualize usage-based revenue for your existing billing meters.
    • Filter and segment revenue metrics by billing meter, provider, currency, subscription, and more.
    • Choose the metric you want the Billing Report Metrics to plot, such as the metric values your meters track usage of and credit balance in pre-paid systems.

Background

Moesif supports setting up billing meters that only report usage but don’t charge your customers for the usage. This allows you to leverage Moesif’s robust API usage metering system to monitor your API consumption, while giving you the maximum flexibility for the billing system you choose to charge your customers. You can roll out your own custom billing solution that accurately charges your customers based on the metering data Moesif collects. You also have the option to use existing billing providers like Stripe through Moesif’s integrations with them.

Before You Start

Make sure you have an active Moesif account.

Set Up a Reporting-Only Billing Meter

To set up a reporting-only Billing Meter, select Billing Meters menu item in the navigation menu and then select + Add Billing Meter. Alternatively, select + Create New in the navigation menu and then select Billing Meter from the API Monetization section.

Then follow these steps:

Step 1: Select Custom Billing Provider

In the new Billing Meters screen, enter a name for your Billing Meter and select Custom as the billing provider. Do not select any webhooks.

Step 2: Specify Plan and Price Details

Select a Plan that Moesif attributes the usage to and the Price that Moesif meters according to. You can select from the available plans and prices, or select Add New Plan or Add New Price to create new ones.

Selecting Add New Plan presents a dialog where you need to fill out the plan details. For more information, see Select or Create a Billing Plan.

Selecting Add New Price brings you to the Product Catalog Prices screen. For more information, see Creating a Price.

In this tutorial, we define a plan and price for an esignature API. Subscribers of the plan pay US$3 for each 1000 units of service. For an esignature API, unit translates to API requests. Therefore, we want to meter and rate for each API request the API receives. In the later steps when we define the billing meter for metering API usage, we’ll more concretely define the exact metric we want to charge customers for.

Here we create a plan “E-sign requests” and define a price for this plan “Pro E-Sign API”

Creating a plan in Moesif
Creating a new plan called ‘E-Sign requests’ when creating a Billing Meter
Creating a price in Moesif
The Prices screen in Moesif when creating a price called ‘Pro E-Sign API’ that associates with the ‘E-Sign requests’ plan.

Step 3: Select Subscription Status to Meter For

Next, in Report for Subscriptions in dropdown, select what subscription status you want to meter. For example, you may want to meter usage only for subscriptions that have an Active status. The dropdown menu has the following options:

  • Active
  • Future
  • In Trial
  • Paused
  • Non-Renewing

For this tutorial, let’s choose Active.

Step 4: Define the Filters and Metrics

Lastly, define your billing criteria. For the example esignature API, we want to meter for and rate all POST requests to the /esignature/documents endpoint. According to the pricing strategy we’ve defined in the preceding step, this means a customer pays US$3 for each thousand POST requests they make to the endpoint.

After finishing these steps, select Create to finish creating the billing meter.

Creating a reporting-only Billing Meter in Moesif
The Billing Meters screen in Moesif with a reporting-only billing meter for an esignature API.

Understand Revenue and Usage

Now Moesif tracks and meters your API consumption according to the reporting-only Billing Meter in real time. As usages accrue, you can observe the usage statistics with corresponding revenue in the Billing Meter’s Synced Usage pane at the bottom.

Synced usage and revenue pane for a reporting-only Billing Meter
Visualization of usage and revenue for a Billing Meter

You can also switch to tabular form for the usage data:

Tabular form of synced usage and revenue data for a reporting-only Billing Meter
Tabular form of usage and revenue data for a Billing Meter

Use Billing Report Metrics For Aggregated Metrics on Revenue and Usage

With Billing Report Metrics , you can gain more business critical insights into your API consumption and revenue.

To access Billing Report Metrics, follow these steps:

  1. Go to your Moesif Web Portal.
  2. Select Billing Meters in the navigation menu.
  3. Select Billing Reports.

Alternatively, select + Create New in the navigation menu and then select Billing Reports from the API Monetization section.

In this tutorial, we’ve created a single plan with usage-based pricing for the esignature API. In a real-world use case, a product offers customers multiple plans and prices to choose from. Therefore, you’ll likely have more than one billing meter. Billing Report Metrics offers a consolidated view into your product’s revenue stream across all your billing meters over a period of time. This makes it easier to evaluate your product’s growth and your current strategies.

Important: You must have at least one active Billing Meter to view billing reports in Billing Report Metrics.

In the following sections, we illustrate some of the features Billing Report Metrics offers.

Filter Your Analysis Data

By default, Billing Report Metrics takes into account all your subscriptions, customers, plans, prices, and active billing meters. You can fine-tune your analysis using filters. For example, here we define a filter to only include data for the “E-Sign requests” plan:

Filtering by a specific plan name in a Billing Report Metrics screen
Filtering Billing Report Metrics analysis for ‘E-Sign requests’ plan.

Compare Your Metrics Across Categories

Use the Group By pane to define groups that divide your billing report metrics into categories or demographics. For example, we can visualize usage and revenue across customers of the esignature API by grouping the data by company domains:

Using 'Group By' to categorize analysis data
Grouping Billing Report Metrics analysis by company domains.
Resultant plot for a 'Group By' analysis
Billing Report Metrics plot for different companies.

Choose the Metric to Plot

By default, Billing Report Metrics plots the sum of metric values in your billing meters. You can change the aggregation operation from summation to average calculation, and choose a different metric to plot.

For example, here we want to plot summation of revenue amounts:

Choosing what metric to plot in a Billing Report Metrics analysis
Plotting revenue amounts as the metric in a Billing Report Metrics analysis.

Export Data

You can export Billing Report Metrics data in JSON and CSV formats according to the configurations you’ve defined like filters. Having the raw data accessible allows you to set up external workflows and further data analysis.

Exporting Billing Report Metrics data
Exporting Billing Report Metrics data according to the defined filter, group, metric, and time period configurations.

Next Steps

Updated: