Skip to main content

Production analytics

Aggregated production summary for a cooperative inside a date window — totals, monthly trend, and per-product breakdown.

Get cooperative production analytics

GET /cooperatives/{coop_id}/production-analytics/

Required scope: analytics:read.

Request

curl -X GET \
"https://api.copa.rw/api/v1/cooperatives/73mcoo8tg/production-analytics/?from=2025-01-01&to=2026-04-30" \
-H "Authorization: Bearer YOUR_API_KEY"

Path parameters

ParameterTypeDescription
coop_idstringCooperative ID.

Query parameters

ParameterTypeDescription
fromstringStart date (ISO YYYY-MM-DD). Defaults to 365 days ago.
tostringEnd date. Defaults to now.

Response

{
"cooperative_id": "73mcoo8tg",
"window": { "from": "2025-01-01", "to": "2026-04-30" },
"totals": {
"total_entries": 60,
"total_quantity": "2154.814",
"total_value": "838913.025",
"active_members": 14,
"registered_members": 1411,
"participation_rate": 0.99
},
"monthly_trend": [
{ "month": "2026-01-01", "quantity": "264.185", "value": "100330.30", "entries": 12 },
{ "month": "2026-02-01", "quantity": "125.465", "value": "47746.70", "entries": 5 },
{ "month": "2026-03-01", "quantity": "868.000", "value": "343900.00", "entries": 14 },
{ "month": "2026-04-01", "quantity": "897.164", "value": "346936.025","entries": 29 }
],
"by_product": [
{
"product_id": "3hkfckqc6",
"product_name": "Amata",
"quantity": "1850.500",
"value": "740200.00",
"entries": 45
}
]
}

Top-level fields

FieldTypeNotes
cooperative_idstringEchoed from the path.
window.from / window.todateResolved window after defaults are applied.
totalsobjectAggregates over the window.
monthly_trendarrayOne bucket per calendar month, sorted ascending.
by_productarraySorted descending by quantity.

Totals

FieldTypeNotes
total_entriesintegerCount of entry_type=PRODUCTION rows.
total_quantitydecimal stringSum of kg.
total_valuedecimal stringSum of quantity × unit_cost in RWF.
active_membersintegerDistinct members who delivered in the window.
registered_membersintegerActive member roster size.
participation_ratefloatactive_members ÷ registered_members × 100, rounded to 2dp.

Errors

StatusDescription
400Invalid date format, or to < from.
403Key does not have analytics:read.
404Cooperative not found.