Quelle: https://spooly.eu/docs/api/statistics

# Statistik

Die Zahlen aus der Statistik der App: Drucke, Verbrauch, Kosten, Materialien, Drucker und Lager.

## Statistik abrufen

`GET /statistics`

Ohne Angabe alles, mit `year` ein Jahr, mit `year` und `month` ein Monat. Ein Monat ohne Jahr ergibt 422. Monate gelten in der Zeitzone des Kontos. `filament_cost` zählt nur Spulen mit Preis, Fehldrucke zählen mit. `previous` ist der gleich lange Zeitraum davor, `top_spools` die zehn meistgenutzten Spulen. Die `id` einer Spule dort ist null, wenn es die Spule nur noch im Druck gibt, etwa nach dem Löschen.

Parameter:

- `year` (Abfrage, optional): 2000 bis 2100
- `month` (Abfrage, optional): 1 bis 12

```bash
curl "https://spooly.eu/api/v1/statistics?year=2026&month=10" \
  -H "Authorization: Bearer $SPOOLY_KEY"
```

Antwort (200):

```
{
  "period": "2026-10",
  "currency": "EUR",
  "prints": 9,
  "failed_prints": 1,
  "grams": 327,
  "hours": 41.5,
  "filament_cost": 6.54,
  "grams_without_price": 0,
  "failed_grams": 12,
  "failed_cost": 0.24,
  "previous": {
    "prints": 11,
    "grams": 402,
    "hours": 48,
    "filament_cost": 8.04
  },
  "months": [
    {
      "month": "2026-10",
      "prints": 9,
      "grams": 327,
      "hours": 41.5,
      "filament_cost": 6.54
    }
  ],
  "materials": [
    {
      "name": "PLA",
      "prints": 9,
      "failed_prints": 1,
      "hours": 41.5
    }
  ],
  "printers": [
    {
      "name": "X1 Carbon von Tobi",
      "prints": 9,
      "failed_prints": 1,
      "hours": 41.5
    }
  ],
  "top_spools": [
    {
      "id": "7f3c2a10-5e1b-4c8e-9a44-2d6b1f0c7e21",
      "number": 1,
      "title": "Jade White",
      "grams": 215
    }
  ],
  "stock": {
    "active_spools": 23,
    "remaining_grams": 11840,
    "stock_value": 236.8,
    "spools_without_price": 2,
    "total_spent": 412.5,
    "average_price_per_gram": 0.02
  }
}
```
