---
title: "Aggregate Daily"
method: POST
path: "/api/admin/aggregate"
tags: ["admin"]
---

# Aggregate Daily

`POST /api/admin/aggregate`

## Request

- Base URL: `https://api.stellara.natlex.it` (the document declares no server; this is the origin it was published from)
- URL: `https://api.stellara.natlex.it/api/admin/aggregate`
- Auth: none declared

Aggregate ai_usage_log into ai_usage_daily_agg for a given date.

Accessible to admins via JWT OR to Cloud Scheduler via
`X-Cron-Secret`. Before 2026-04-23 this endpoint was locked behind
`Depends(require_admin)` — FastAPI resolved that dep BEFORE the
body ran, so a cron-secret-only call always got 403 and the daily
aggregation was silently stale until a human admin manually
invoked the endpoint.

## Query parameters

- `date` string, required

## Headers

- `authorization` string, nullable
- `X-Cron-Secret` string, nullable

## Response `200`

Successful Response

- AdminAggregateResponse
  - `date` string, required
  - `rows_upserted` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/natlex/apis/stellara-api.md) · [All operations](https://skmtc.dev/natlex/apis/stellara-api/llms.txt) · [OpenAPI document](https://skmtc.dev/natlex/apis/stellara-api/revisions/e576f046b61f?raw)
