Usage Monitoring
The usage dashboard is accessible exclusively from the MonCréneau web dashboard, by a STAFF user (ADMIN or OWNER role) authenticated via a session.
A third-party external application cannot call these endpoints. They are authenticated by session cookie (web login), not by API key (X-API-Key). This page describes the behavior for reference, not as an integration you can build from your own code.
Required access
- Authenticated session via the web interface (session cookie)
- ADMIN or OWNER role
Global statistics
GET /api/staff/api-usage/stats?period=week — period is one of today, week, month, or custom (with startDate/endDate in YYYY-MM-DD format).
200 response:
{
"totalCalls": 15420,
"successRate": 99.2,
"avgResponseTime": 245,
"totalCreditsConsumed": 1830,
"topEndpoints": [
{ "endpoint": "/api/v1/appointments", "calls": 8340, "percentage": 54.1 },
{ "endpoint": "/api/v1/departments", "calls": 4210, "percentage": 27.3 }
],
"errorBreakdown": { "402": 45, "404": 12, "429": 8 },
"timeSeriesData": [
{ "timestamp": "2026-01-22T00:00:00", "calls": 620, "credits": 74 }
]
}
Detailed logs
GET /api/staff/api-usage/logs?page=0&size=50 — optional filters: apiKeyId, endpoint, statusCode, startDate, endDate (YYYY-MM-DDTHH:mm:ss).
200 response (standard Spring Data page):
{
"content": [
{
"id": 98213,
"apiKeyName": "Production API Key",
"endpoint": "/api/v1/appointments",
"method": "POST",
"statusCode": 201,
"creditsConsumed": 1,
"responseTimeMs": 320,
"timestamp": "2026-01-22T14:30:00",
"ipAddress": "197.149.178.10",
"userAgent": "moncreneau-node/2.1.0"
}
],
"totalElements": 15420,
"totalPages": 309,
"number": 0,
"size": 50
}
CSV export
GET /api/staff/api-usage/export/csv?startDate=2026-01-01&endDate=2026-01-31 — downloads the filtered history as CSV (maximum range: 366 days).