Analytics
Get Dunning History
Retrieve historical dunning retry data with per-attempt outcomes.
GET
/
v1
/
analytics
/
dunning
/
history
Recent dunning retry attempts
curl --request GET \
--url https://billing.example.com/v1/analytics/dunning/history \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/dunning/history"
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/dunning/history', 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/dunning/history",
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/dunning/history"
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/dunning/history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/dunning/history")
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": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"context_key": "<string>",
"action_id": "<string>",
"retry_interval": 123,
"outcome": "success",
"reward": 123,
"created_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Maximum number of records to return, newest first. Default 50, capped at 500; a non-positive value falls back to the default. |
Example Request
curl -X GET "https://api.recurso.dev/v1/analytics/dunning/history?limit=10" \
-H "Authorization: Bearer rsk_live_7f3a9b2c1d4e8f0a"
Response
{
"data": [
{
"id": "8e4b2d17-5a9c-4f3e-b6d0-1c7a4e9f2b58",
"tenant_id": "f2a8c4e6-9b1d-4a3c-8e5f-7d0b2c4a6e91",
"invoice_id": "3c9e1f57-2b8a-4d6c-9f0e-5a7b3d1c8e42",
"context_key": "past_due_3d",
"action_id": "retry_payment",
"retry_interval": 259200,
"outcome": "success",
"reward": 1.0,
"created_at": "2026-05-18T14:30:00Z"
},
{
"id": "b1d7f3a9-8c2e-4b5d-a0f6-4e9c1a7d3b26",
"tenant_id": "f2a8c4e6-9b1d-4a3c-8e5f-7d0b2c4a6e91",
"invoice_id": "6a2d8c40-1e7f-4b9a-8d3c-2f5e0a9b7c14",
"context_key": "past_due_7d",
"action_id": "send_reminder_email",
"retry_interval": 604800,
"outcome": "failure",
"reward": 0.0,
"created_at": "2026-05-20T09:15:00Z"
}
]
}
data array only — there is no total, limit or offset envelope.
Response Fields
| Field | Type | Description |
|---|---|---|
id | string (uuid) | Unique identifier for the dunning history entry. |
tenant_id | string (uuid) | The tenant the attempt belongs to. |
invoice_id | string (uuid) | The invoice this dunning attempt was made against. |
context_key | string | The dunning context state (e.g. past_due_3d, past_due_7d). |
action_id | string | The dunning action that was taken (e.g. retry_payment, send_reminder_email). |
retry_interval | integer | Seconds between the failed payment and this retry attempt. |
outcome | string | Result of the attempt: success or failure. |
reward | number | The reinforcement-learning reward assigned to this outcome: 1.0 for success, 0.0 for failure. |
created_at | string | ISO 8601 timestamp of when the attempt occurred. |
Use this endpoint alongside the dunning weights endpoint to understand how the AI agent is learning from past retry outcomes.
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Query Parameters
Maximum records to return (default 50; a value above 500 is capped at 500, a non-positive value falls back to 50).
Required range:
1 <= x <= 500Response
Retry history.
Show child attributes
Show child attributes
⌘I
Recent dunning retry attempts
curl --request GET \
--url https://billing.example.com/v1/analytics/dunning/history \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/analytics/dunning/history"
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/dunning/history', 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/dunning/history",
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/dunning/history"
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/dunning/history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/analytics/dunning/history")
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": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"context_key": "<string>",
"action_id": "<string>",
"retry_interval": 123,
"outcome": "success",
"reward": 123,
"created_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}