48hr.email/api/routes/stats.api.md
ClaraCrazy fb3d8a60aa
[AI][Feat]: Add API
Also adding API docs <3
2026-01-05 10:29:12 +01:00

55 lines
985 B
Markdown

# Statistics API
## Overview
Endpoints for retrieving statistics and historical data.
---
## Endpoints
### GET `/api/stats/`
Get lightweight statistics (no historical analysis).
- **Response:**
- `currentCount`, `allTimeTotal`, `last24Hours` (object with `receives`, `deletes`, `forwards`, `timeline`)
### GET `/api/stats/enhanced`
Get full statistics with historical data and predictions.
- **Response:**
- `currentCount`, `allTimeTotal`, `last24Hours`, `historical`, `prediction`, `enhanced`
---
## Response Format
```
{
success: true|false,
data: ...,
error?: ...,
code?: ...
}
```
## Error Codes
- `FEATURE_DISABLED`: Statistics are disabled
---
## Example Response
```
{
"success": true,
"data": {
"currentCount": 123,
"allTimeTotal": 4567,
"last24Hours": {
"receives": 10,
"deletes": 2,
"forwards": 1,
"timeline": [ ... ]
},
"historical": [ ... ],
"prediction": [ ... ],
"enhanced": { ... }
}
}
```