GET /api/admin/usage/orgs/:id?from&to: the org's ROLLUP#org# days plus its last 48 h of UsageMinute rows (an Index1 query).
Staff cookie session; permission usage.read.
This is the private staff console on https://admin.handwrites.io. A personal API key, organisation token, student login or isolated app-testing credential does not authenticate this route.
| Location | Name | Required | Meaning |
|---|---|---|---|
| path | id | Yes | Use the ID from an authorized staff response; source validators reject malformed IDs. |
| query | from | Conditional / optional | {"type":"string","format":"date"} |
| query | to | Conditional / optional | {"type":"string","format":"date"} |
This operation does not define a JSON payload. Staff writes still require Content-Type: application/json and the session-bound CSRF header.
Success: 200. GET /api/admin/usage/orgs/:id?from&to: the org's ROLLUP#org# days plus its last 48 h of UsageMinute rows (an Index1 query).
The wrapper returns {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.
Source snapshot: admin/src/app/api/admin/usage/orgs/[id]/route.ts. This reference describes the current working tree, not proof of deployment. The response service types and validators remain authoritative. The exact exported handler below makes conditional behavior reviewable. For helpers such as customer-routes or cloudRoute, see the shared API specification notes and the named service module.
/** GET /api/admin/usage/orgs/:id?from&to: the org's ROLLUP#org#<id> days plus its last 48 h of UsageMinute rows (an Index1 query). */
export const GET = adminRoute("usage.read", async (request, _ctx, { params }: Context) => {
const { id } = await params;
if (!SAFE_ID.test(id)) throw notFound("Organisation");
const search = new URL(request.url).searchParams;
return adminJson(await orgUsageDetail(id, parseRange(search.get("from"), search.get("to"))));
});
Do not use production customer data to test this operation. Use an authorized staff test account and a disposable target in an appropriate environment; email, deletion, role and credential mutations have real effects.