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": "BAD_REQUEST",
"message": "<string>"
}
}Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | string | No | ISO 8601 date. Filters results from this date onward. Defaults to 30 days ago. |
end_date | string | No | ISO 8601 date. Filters results up to this date. Defaults to today. |
invoice_id | string | No | Filter dunning history for a specific invoice. |
limit | integer | No | Maximum number of records to return. Default 20, max 100. |
offset | integer | No | Number of records to skip for pagination. Default 0. |
Example Request
curl -X GET "https://api.recurso.dev/v1/analytics/dunning/history?start_date=2026-05-01&end_date=2026-06-01&limit=10" \
-H "Authorization: Bearer rsk_live_7f3a9b2c1d4e8f0a"
Response
{
"data": [
{
"id": "dh_8xKp3mNv2qRs",
"invoice_id": "inv_4a7b9c2d1e",
"context_key": "past_due_3d",
"action_id": "retry_payment",
"retry_interval": 72,
"outcome": "success",
"reward": 1.0,
"created_at": "2026-05-18T14:30:00Z"
},
{
"id": "dh_2wLt6rPx9sFq",
"invoice_id": "inv_9e3f1a8b5c",
"context_key": "past_due_7d",
"action_id": "send_reminder_email",
"retry_interval": 168,
"outcome": "failure",
"reward": -0.5,
"created_at": "2026-05-20T09:15:00Z"
}
],
"total": 843,
"limit": 10,
"offset": 0
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the dunning history entry. |
invoice_id | string | 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 | Hours between the failed payment and this retry attempt. |
outcome | string | Result of the attempt: success or failure. |
reward | number | The reinforcement learning reward signal assigned to this outcome. |
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 (values outside 1-200 fall back to 50).
Required range:
1 <= x <= 200Response
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": "BAD_REQUEST",
"message": "<string>"
}
}