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

SectionColumn NameEnum ValuesDescription
api owner detailsapi_owner_idUnique id of the entity that owns the API
api_owner_typeUser, Team
api_owner_user_nameEmpty if owner is not a personal context
api_owner_user_emailEmpty if owner is not a personal context
api_owner_team_nameEmpty if owner is not a Team context
api_owner_org_nameEmpty if owner is not a Team context
api_owner_org_admin_nameEmpty if owner is not a Team context
api_owner_org_admin_emailEmpty if owner is not a Team context
api detailsapiIdUnique id of the API
api_name
api_version_name
subscription idsubscriptionid
user detailssubscription_owner_idUnique id of the entity that owns the subscription
subscription_owner_typeUser, Team
subscription_owner_user_nameEmpty if owner is not a personal context
subscription_owner_user_emailEmpty if owner is not a personal context
subscription_owner_team_nameEmpty if owner is not a Team context
subscription_owner_org_idEmpty if owner is not a Team context
subscription_owner_org_nameEmpty if owner is not a Team context
subscription_owner_org_admin_nameEmpty if owner is not a Team context
subscription_owner_org_admin_emailEmpty if owner is not a Team context
subscription pricing and usagesapi_billingplan_nameBASIC, PRO, CUSTOM-plan, etc.
api_billingitem_nameRequests, Coins, Credits, etc.Requests is the default
billingplan_price
billingplan_periodMONTHLY, PERUSE
limit_periodUNLIMITED, MONTHLY, DAILYBilling object quota limit period.
api_billinglimitInteger 0 if limit_period = UNLIMITEDBilling object Quota Limit value (e.g. max number of requests per day - not Rate Limit). 0 if limit_period = UNLIMITED
limit_typehard, softempty if limit_period = UNLIMITED
overage_pricePrice per billing item beyond the agreed limit. 0 means unlimited.
day_of_monthint; 1-31The day of month the total_usage column refers to.
total_usageNumber 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).
1133

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).
686

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.