Analytics
Get Usage Statistics
Retrieve aggregated usage statistics for metered billing events.
GET
/
v1
/
analytics
/
usage
Aggregate usage by dimension
curl --request GET \
--url https://billing.example.com/v1/analytics/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/usage"
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/usage', 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/usage",
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/usage"
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/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/usage")
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": [
{
"dimension": "api_calls",
"total_quantity": 123
}
],
"customers_metered": 123
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | string | No | ISO 8601 date for the beginning of the reporting period. Defaults to 30 days ago. |
end_date | string | No | ISO 8601 date for the end of the reporting period. Defaults to today. |
meter_id | string | No | Filter results to a specific usage meter (e.g., mtr_7hN2XwLsRq). If omitted, returns aggregated stats across all meters. |
meter_id is provided, results are scoped to that single meter.
Example Request
curl -X GET "https://api.recurso.io/v1/analytics/usage?start_date=2026-06-01&end_date=2026-06-30&meter_id=mtr_7hN2XwLsRq" \
-H "Authorization: Bearer sk_live_26PHem9AhJZvU..." \
-H "Content-Type: application/json"
Response
{
"object": "usage_summary",
"start_date": "2026-06-01",
"end_date": "2026-06-30",
"meter_id": "mtr_7hN2XwLsRq",
"meter_name": "API Calls",
"total_events": 1847263,
"unique_customers": 189,
"total_value": 1847263,
"unit": "request",
"daily_breakdown": [
{
"date": "2026-06-01",
"events": 58420,
"value": 58420
},
{
"date": "2026-06-02",
"events": 62135,
"value": 62135
},
{
"date": "2026-06-03",
"events": 61890,
"value": 61890
}
],
"computed_at": "2026-06-23T00:00:00Z"
}
⌘I
Aggregate usage by dimension
curl --request GET \
--url https://billing.example.com/v1/analytics/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/usage"
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/usage', 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/usage",
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/usage"
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/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/usage")
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": [
{
"dimension": "api_calls",
"total_quantity": 123
}
],
"customers_metered": 123
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}