Analytics
Get Collections Funnel
The failed → resolved journey of billed revenue: past due, written off, and recovered.
GET
/
v1
/
analytics
/
collections
/
funnel
Collections recovery funnel
curl --request GET \
--url https://billing.example.com/v1/analytics/collections/funnel \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/collections/funnel"
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/collections/funnel', 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/collections/funnel",
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/collections/funnel"
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/collections/funnel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/collections/funnel")
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": {
"reporting_currency": "<string>",
"past_due": {
"count": 123,
"amount": 123
},
"uncollectible": {
"count": 123,
"amount": 123
},
"recovered": {
"count": 123,
"amount": 123
},
"recovery_rate": 123,
"rate_window_days": 123,
"fx_excluded_currencies": [
"<string>"
]
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Tracks billed revenue through the collections funnel:
past_due (still being chased), uncollectible (written off), and recovered (all-time), FX-normalized to the reporting currency, plus a recovery rate over recently concluded cases. Responses are cached for up to 5 minutes.
Example Request
curl "https://api.recurso.dev/v1/analytics/collections/funnel" \
-H "Authorization: Bearer $API_KEY"
Response
{
"data": {
"reporting_currency": "USD",
"past_due": { "count": 51, "amount": 655400 },
"uncollectible": { "count": 9, "amount": 82300 },
"recovered": { "count": 187, "amount": 2241800 },
"recovery_rate": 0.81,
"rate_window_days": 90,
"fx_excluded_currencies": []
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
reporting_currency | string | Currency every amount is normalized into |
past_due | object | Invoices still being chased: count and amount (minor units) |
uncollectible | object | Invoices written off: count and amount (minor units) |
recovered | object | Invoices recovered, all-time: count and amount (minor units) |
recovery_rate | number | Of cases concluded (recovered or written off) in the trailing rate_window_days, the fraction recovered |
rate_window_days | integer | Trailing window (days) the recovery_rate is computed over |
fx_excluded_currencies | array | Currencies whose amounts could not be converted into the reporting currency and are excluded from the bucket amounts (their invoices still count). Non-empty means the money figures are understated. |
⌘I
Collections recovery funnel
curl --request GET \
--url https://billing.example.com/v1/analytics/collections/funnel \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/collections/funnel"
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/collections/funnel', 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/collections/funnel",
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/collections/funnel"
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/collections/funnel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/collections/funnel")
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": {
"reporting_currency": "<string>",
"past_due": {
"count": 123,
"amount": 123
},
"uncollectible": {
"count": 123,
"amount": 123
},
"recovered": {
"count": 123,
"amount": 123
},
"recovery_rate": 123,
"rate_window_days": 123,
"fx_excluded_currencies": [
"<string>"
]
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}