status: "no_rollup" until the rollup job has written a day.| Location | Name | Required | Meaning |
|---|---|---|---|
| query | from | Conditional / optional | {"type":"string","format":"date"} |
| query | to | Conditional / optional | {"type":"string","format":"date"} |
status: "no_rollup" until the rollup job has written a day.{error:{code,message}} for CloudError failures, attaches Request-Id, and disables caching. Handle 401 by signing in; show role refusal for 403 forbidden, reauthenticate only for step_up_required, and collect a reason for 400 reason_required. A CSRF failure needs a current page/session token, not blind retries. Operation-specific 404/409/413/422/502/503 errors retain their status. Honor Retry-After on 429./**
* GET /api/admin/billing?from=yyyy-mm-dd&to=yyyy-mm-dd (default: the last 90 days to yesterday, at most 400 days):
* platform billing from the nightly rollups (ADMIN.md §10). Aggregates only, no personal data, so no reason prompt
* (billing.read's reason is per account). `status: "no_rollup"` until the rollup job has written a day.
*/
export const GET = adminRoute("billing.read", async (request) => {
const url = new URL(request.url);
const { from, to } = parseRange(url.searchParams.get("from"), url.searchParams.get("to"));
return adminJson(await platformBilling(from, to));
}, { reason: false });