Analytics
Get Invoice Aging
Outstanding receivables bucketed by how far past due each open invoice is.
GET
/
v1
/
analytics
/
invoice-aging
Invoice aging
curl --request GET \
--url https://billing.example.com/v1/analytics/invoice-aging \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/invoice-aging"
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/invoice-aging', 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/invoice-aging",
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/invoice-aging"
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/invoice-aging")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/invoice-aging")
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>"
}
}Buckets outstanding receivables by how far past due each open invoice is —
current, 1-30, 31-60, 61-90, and 90+ days — normalized to the reporting currency. Amounts are the remaining unpaid balance of each invoice, in minor units.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_id | string (uuid) | No | Scope the report to one legal entity (Multi-Entity Books). Omit for all entities. |
Example Request
curl "https://api.recurso.dev/v1/analytics/invoice-aging" \
-H "Authorization: Bearer $API_KEY"
Response
{
"data": {
"reporting_currency": "USD",
"buckets": [
{ "label": "current", "count": 18, "amount": 214600 },
{ "label": "1-30", "count": 22, "amount": 268900 },
{ "label": "31-60", "count": 7, "amount": 96400 },
{ "label": "61-90", "count": 3, "amount": 41200 },
{ "label": "90+", "count": 1, "amount": 34300 }
],
"total_outstanding": 655400,
"total_count": 51
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
reporting_currency | string | Currency every amount is normalized into |
buckets[] | array | The fixed, ordered aging bands (current, 1-30, 31-60, 61-90, 90+): invoice count and outstanding amount (minor units) per band |
total_outstanding | integer | Total unpaid balance across all open invoices, minor units |
total_count | integer | Total number of open invoices |
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Query Parameters
Legal entity to scope the tax config to (Multi-Entity Books). Omit for the tenant's primary entity / default config.
Response
Invoice aging report.
⌘I
Invoice aging
curl --request GET \
--url https://billing.example.com/v1/analytics/invoice-aging \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/invoice-aging"
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/invoice-aging', 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/invoice-aging",
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/invoice-aging"
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/invoice-aging")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/invoice-aging")
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>"
}
}