Exporting Quota Data

For customers that want to monetize their APIs while managing invoicing and payment collections on their own, RapidAPI can provide monthly aggregated quota usage reports. Data exports are for full calendar months.

The quota usage reports are provided as CSV files, allowing your enterprise to parse the file and send invoices to API consumers.

Fields of the CSV file

Section

Column Name

Enum Values

Description

api owner details

api_owner_id

Unique id of the entity that owns the API

api_owner_type

User, Team

api_owner_user_name

Empty if owner is not a personal context

api_owner_user_email

Empty if owner is not a personal context

api_owner_team_name

Empty if owner is not a Team context

api_owner_org_name

Empty if owner is not a Team context

api_owner_org_admin_name

Empty if owner is not a Team context

api_owner_org_admin_email

Empty if owner is not a Team context

api details

apiId

Unique id of the API

api_name

api_version_name

subscription id

subscriptionid

user details

subscription_owner_id

Unique id of the entity that owns the subscription

subscription_owner_type

User, Team

subscription_owner_user_name

Empty if owner is not a personal context

subscription_owner_user_email

Empty if owner is not a personal context

subscription_owner_team_name

Empty if owner is not a Team context

subscription_owner_org_id

Empty if owner is not a Team context

subscription_owner_org_name

Empty if owner is not a Team context

subscription_owner_org_admin_name

Empty if owner is not a Team context

subscription_owner_org_admin_email

Empty if owner is not a Team context

subscription pricing and usages

api_billingplan_name

BASIC, PRO, CUSTOM-plan, etc.

api_billingitem_name

Requests, Coins, Credits, etc.

Requests is the default

billingplan_price

billingplan_period

MONTHLY, PERUSE

limit_period

UNLIMITED, MONTHLY, DAILY

Billing object quota limit period.

api_billinglimit

Integer 0 if limit_period = UNLIMITED

Billing object Quota Limit value (e.g. max number of requests per day - not Rate Limit). 0 if limit_period = UNLIMITED

limit_type

hard, soft

empty if limit_period = UNLIMITED

overage_price

Price per billing item beyond the agreed limit. 0 means unlimited.

day_of_month

int; 1-31

The day of month the total_usage column refers to.

total_usage

Number of requests in the specified day_of_month

Specifying billing periods and limits

Most of the values in the Column Name column above should be easy to find in the Provider Dashboard. The following provides specific information related to limit_period, api_billinglimit, and billingplan_period.

To specify the limit_period (Quota Type) and api_billinglimit (Quota Limit):

  1. Navigate to the Provider Dashboard (My APIs).
  2. Click the Definition tab for your API.
  3. Click Plans in the navigation bar near the top.
  4. Under Public & Private Plans, click *Edit associated with a plan.
  5. Under Objects, select the desired Quota Type and Quota Limit (as shown below).

To specify the billingplan_period:

  1. Navigate to the Provider Dashboard (My APIs).
  2. Click the Definition tab for your API.
  3. Click Plans in the navigation bar near the top.
  4. Under Public & Private Plans, click *Edit associated with a plan.
  5. Near the top of the screen, select Monthly Subscription or Pay Per Use (as shown below).

Sample: Constructing an invoice from the data

for each $api_owner_id: 
	for each $apiId: 
		for each $subscriptionid: 
			plan_name = $api_billingplan_name
			plan_price = $billingplan_price
			overages = 0
			
			if $api_billinglimit != 0: 
				for each $api_billingitem_name:
					
					if $limit_period == "DAILY":
						for each $day_of_month:
							if $total_usage > $api_billinglimit:
								daily_overage_fee = ($total_usage - $api_billinglimit) * $overage_price
								overages += daily_overage_fee
			
					else if $limit_period == "MONTHLY":
						monthly_usage = 0
						for each $day_of_month:
							monthly_usage += $total_usage
						if monthly_usage > $api_billinglimit:
							overages = (monthly_usage - $api_billinglimit) * $overage_price
					
					else if $billingplan_period == "PERUSE":
						for each $day_of_month:
							daily_overage_fee = $total_usage * $overage_price
							overages += daily_overage_fee

					/*else if $limit_period == "UNLIMITED": 
						overages = 0
					*/

		invoice_total = plan_price + overages
		invoice_to = $subscription_owner_id

Suggested usage

  1. The API builder publishes APIs that include paid plans.
  2. The paid plans have the "Request Approval" option enabled.
  3. The API consumer asks to subscribe to the API.
  4. The API builder and potential consumer agree on a payment method and sign an agreement.
  5. The API builder approves the subscription.
  6. The API consumer uses the API.
  7. On a monthly basis, the Enterprise Hub admin collects the Quota Data for the Hub and processes it.
  8. Each API builder receives usage information for each of his subscribers and invoices the consumers directly.

Notes

  1. Unused subscriptions (a subscription that did not perform any requests to the RapidAPI proxy), will not show up in the report. This is true even though a plan may include a monthly fee.
  2. Additional consideration is needed to allow using this process in conjunction with API plans that include Hard Limits.

Reach out to your RapidAPI partner for additional information.