Analytics
Get Revenue by Geography
Current MRR broken down by the customer’s billing country, largest first, with each country’s share of total.
GET
/
v1
/
analytics
/
revenue-by-geography
Revenue by geography
curl --request GET \
--url https://billing.example.com/v1/analytics/revenue-by-geography \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/revenue-by-geography"
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-geography', 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-geography",
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-geography"
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-geography")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/revenue-by-geography")
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 the customer’s billing country, largest first, with each country’s share of the total. Amounts are FX-normalized to the reporting currency, in minor units. Customers without a billing country fall into an
Unknown segment.
Example Request
curl "https://api.recurso.dev/v1/analytics/revenue-by-geography" \
-H "Authorization: Bearer $API_KEY"
Response
{
"data": {
"reporting_currency": "USD",
"total_mrr": 4850000,
"segments": [
{
"key": "US",
"label": "United States",
"mrr": 2650000,
"subscriptions": 118,
"share_pct": 54.6
},
{
"key": "IN",
"label": "India",
"mrr": 1620000,
"subscriptions": 176,
"share_pct": 33.4
},
{
"key": "",
"label": "Unknown",
"mrr": 580000,
"subscriptions": 40,
"share_pct": 12.0
}
]
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
reporting_currency | string | Currency every amount is normalized into |
total_mrr | integer | Total MRR across all countries, minor units |
segments[] | array | One entry per country, sorted by MRR descending: key (ISO 3166 alpha-2 code, empty for unknown), label (country display name or Unknown), mrr (minor units), active subscriptions, share_pct (percent of total) |
⌘I
Revenue by geography
curl --request GET \
--url https://billing.example.com/v1/analytics/revenue-by-geography \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/revenue-by-geography"
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-geography', 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-geography",
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-geography"
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-geography")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/revenue-by-geography")
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>"
}
}