Skip to main content

Usage Monitoring

Endpoints to view API usage statistics.

Staff Access

These endpoints require an ADMIN or OWNER role.

Global Statistics

curl https://mc-prd.duckdns.org/api/v1/staff/usage/stats \
-H "X-API-Key: YOUR_API_KEY"

Response 200:

{
"period": "2026-01-01/2026-01-31",
"totalRequests": 15420,
"requestsByEndpoint": {
"/appointments": 8340,
"/departments": 4210,
"/availability": 2870
},
"averageResponseTime": 245,
"errorRate": 0.8,
"rateLimitHits": 12
}

Usage by API Key

curl https://mc-prd.duckdns.org/api/v1/staff/usage/by-key \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"startDate": "2026-01-01",
"endDate": "2026-01-31",
"apiKeyId": "key_123"
}'

Response 200:

{
"apiKeyId": "key_123",
"keyName": "Production Key",
"requests": 3450,
"successRate": 99.2,
"creditsConsumed": 234,
"topEndpoints": [
{"endpoint": "/appointments", "count": 2100},
{"endpoint": "/departments", "count": 1350}
]
}

Activity Logs

curl "https://mc-prd.duckdns.org/api/v1/staff/usage/logs?limit=50&page=1" \
-H "X-API-Key: YOUR_API_KEY"

Response 200:

{
"data": [
{
"timestamp": "2026-01-22T14:30:00Z",
"method": "POST",
"endpoint": "/appointments",
"statusCode": 201,
"responseTime": 320,
"apiKeyId": "key_123",
"ipAddress": "197.149.178.10",
"userAgent": "MonCreneauSDK/1.0"
}
],
"pagination": {
"total": 15420,
"page": 1,
"perPage": 50
}
}