| Location | Name | Required | Meaning |
|---|---|---|---|
| path | sub | Yes | Use the ID from an authorized staff response; source validators reject malformed IDs. |
{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/usage/accounts/:sub: the account's last 30 days live (sessions via usageHistory, keys via Index1). Counts only. */
export const GET = adminRoute("usage.read", async (_request, _ctx, { params }: Context) => {
const { sub } = await params;
if (!SAFE_ID.test(sub)) throw notFound("Account");
return adminJson(await accountUsageDetail(sub));
});