Get a project's factory token spend over a window
Returns one project’s factory token spend between startTime and endTime (epoch ms, inclusive) — totals, and breakdowns by source and model. Requires permission factories:read and cost:read, both at the project’s home.
v2 compatibility notes
GET /api/v2/factories/getProjectSpend?projectId=&startTime=&endTime= returns one project’s factory token spend between startTime and endTime (epoch milliseconds, inclusive) as a FactoryEntitySpend: totals, and breakdowns by source and model, summed across every factory. entity names the project that was read.
Spend is factory token-event attribution; it is not the deployment cost rollup (GET /api/v2/cost/summary). For one factory’s spend, use Get a factory’s token spend.
Two permissions at the project’s home. Your credential’s scopes must reach both factories:read and cost:read; they are checked on the request before anything is read, so a key scoped to factories:read alone is refused with 403 and requiredPermission: "cost:read". Your role grants must then hold factories:read, and then cost:read, at the project’s home org unit. A project you may read without cost:read at its home is refused the same way.
Bounds. The window follows the same rules as getSpend. startTime and endTime are epoch-millisecond integers; startTime must not be after endTime (a one-millisecond window is valid), the window may span at most 30 days, and each parameter appears once. Anything else is 400 bad_request. The read sums at most 10,000 events, newest first. meta.partial is always present: when it is true, more events existed, and every event from coveredFrom through endTime was summed and none older. Continue with endTime set to coveredFrom - 1. Each breakdown holds at most 100 entries by costCents descending, and its truncated is true when more existed.
Cost. Each costCents is summed in micro-dollars and rounded to cents once.
A missing, malformed, or unreadable projectId is 404 resource_missing with the message Project not found.Authorizations
Query Parameters
Response
Factory token spend
One task's, project's or worker's factory token spend over a window, across every factory: totals and breakdowns by source and model. Each breakdown holds at most 100 entries by costCents descending, with truncated set when more existed. When the response's meta.partial is true, every event from coveredFrom through the window's end was summed and none older; otherwise coveredFrom is null. Each costCents is summed in micro-dollars and rounded to cents once.

