Skip to main content

API: Donation Statistics

Retrieve statistics for donations

Stefan Schindler avatar
Written by Stefan Schindler
Updated over a week ago

With an authenticated user it is possible to load the donation statistics.

GET <cambuildr-url>/api/v1/donations/statistics

The Accept header has to be set to application/json for this route to work properly.

This returns the donations grouped by day, donation code and state, as well as the sum and count of all donations:

{
"error": false,
"donations": [
{
"day": "2025-05-10",
"webhook_code": "XYZ",
"state": "Wien",
"sum": "60",
"count": 2
},
{
"day": "2025-05-10",
"webhook_code": "ABC",
"state": "Wien",
"sum": "150",
"count": 8
},
{
"day": "2025-05-10",
"webhook_code": "XYZ",
"state": "Niederösterreich",
"sum": "800",
"count": 20
},
{
"day": "2025-05-12",
"webhook_code": "XYZ",
"state": "Wien",
"sum": "120",
"count": 5
}
],
"total": {
"sum": "1130",
"count": 35
}
}

By default, the donations of the last 30 days are returned (also in the aggregation). The query parameters year and month (1-12) can be used to change this. month is only used, if a year is also defined.

For instance, GET <cambuildr-url>/api/v1/donations/statistics?year=2024&month=4 would only show the donations from April 2024.

If the query-parameter format=csv is sent with the request, the data is returned as CSV:

day,code,state,sum,count
2025-02-04,Code-123,Wien,100,1
2025-02-06,Code-123,Wien,75,1
2025-02-17,Code-123,Wien,75,2

Did this answer your question?