Analytics
Get Revenue by Plan
Current MRR broken down by plan, largest first, with each plan’s share of total.
GET
/
v1
/
analytics
/
revenue-by-plan
Revenue by plan
curl --request GET \
--url https://billing.example.com/v1/analytics/revenue-by-plan \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/revenue-by-plan"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/analytics/revenue-by-plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/analytics/revenue-by-plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/analytics/revenue-by-plan"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://billing.example.com/v1/analytics/revenue-by-plan")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/revenue-by-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Breaks current MRR down by plan, largest first, with each plan’s share of the total. Amounts are FX-normalized to the reporting currency, in minor units.
Example Request
curl "https://api.recurso.dev/v1/analytics/revenue-by-plan" \
-H "Authorization: Bearer $API_KEY"
Response
{
"data": {
"reporting_currency": "USD",
"total_mrr": 4850000,
"segments": [
{
"key": "2b6f4a91-8c3d-4e7a-b1f5-6d9c2a8e0b47",
"label": "Growth (Monthly)",
"mrr": 2910000,
"subscriptions": 180,
"share_pct": 60.0
},
{
"key": "e91c5d27-3a8f-4b60-9e2d-7c4b1f8a6d35",
"label": "Starter (Monthly)",
"mrr": 1455000,
"subscriptions": 132,
"share_pct": 30.0
},
{
"key": "50a7e3b9-6f2c-4d18-a94b-3e8d0c5f7a26",
"label": "Enterprise (Annual)",
"mrr": 485000,
"subscriptions": 22,
"share_pct": 10.0
}
]
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
reporting_currency | string | Currency every amount is normalized into |
total_mrr | integer | Total MRR across all plans, minor units |
segments[] | array | One entry per plan, sorted by MRR descending: key (plan ID), label (plan name), mrr (minor units), active subscriptions, share_pct (percent of total) |
⌘I
Revenue by plan
curl --request GET \
--url https://billing.example.com/v1/analytics/revenue-by-plan \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/revenue-by-plan"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/analytics/revenue-by-plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/analytics/revenue-by-plan",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/analytics/revenue-by-plan"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://billing.example.com/v1/analytics/revenue-by-plan")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/revenue-by-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}