Source: https://spooly.eu/en/docs/api/statistics

# Statistics

The numbers from the statistics in the app: prints, consumption, costs, materials, printers and stock.

## Get statistics

`GET /statistics`

Without parameters you get everything, with `year` one year, with `year` and `month` one month. A month without a year returns 422. Months follow the time zone of the account. `filament_cost` counts only spools with a price, failed prints count too. `previous` is the period of equal length before it, `top_spools` the ten most used spools. The `id` of a spool there is null if the spool exists only in the print any more, for example after it was deleted.

Parameters:

- `year` (Query, optional): 2000 to 2100
- `month` (Query, optional): 1 to 12

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

Response (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
  }
}
```
