On this page

The usage rollup endpoint aggregates metered usage across sandboxes and computers, grouped by an identifier of your choice. Use it to build per-user billing dashboards, enforce spend policies, or attribute costs to projects.

Base path: /api/v1/usage


Endpoints

MethodPathDescription
GET/api/v1/usageAggregate usage for a period

Get Usage Rollup

GET /api/v1/usage

Auth

Authorization: Bearer msk_...

Query Parameters

ParameterTypeRequiredDefaultDescription
group_bystringNoexternal_user_idDimension to aggregate by
periodstringNo30dPredefined period or custom
startstringNo-ISO 8601 start (required when period=custom)
endstringNo-ISO 8601 end (required when period=custom)

group_by values:

ValueDescription
external_user_idGroup by the external_user_id you set on sandboxes
external_project_idGroup by external_project_id
workspace_idGroup by MIOSA workspace

period values:

ValueDescription
7dLast 7 days
30dLast 30 days
mtdMonth-to-date (calendar month, resets on the 1st)
customArbitrary range - requires start and end

Response - 200 OK

{
  "period_start": "2026-04-26T00:00:00Z",
  "period_end": "2026-05-26T00:00:00Z",
  "results": [
    {
      "external_user_id": "user_clinic_42",
      "sandbox_seconds": 14400,
      "computer_seconds": 0,
      "storage_gb_hours": 2.5,
      "credit_cents": 312
    },
    {
      "external_user_id": "user_clinic_99",
      "sandbox_seconds": 3600,
      "computer_seconds": 7200,
      "storage_gb_hours": 0.0,
      "credit_cents": 108
    }
  ]
}
FieldTypeDescription
period_startstringISO 8601 start of aggregation window
period_endstringISO 8601 end of aggregation window
results[].{group_by}stringValue of the grouping dimension
results[].sandbox_secondsnumbervCPU-seconds used by sandboxes
results[].computer_secondsnumbervCPU-seconds used by computers
results[].storage_gb_hoursnumberGiB-hours of attached storage
results[].credit_centsnumberTotal cost in platform credit cents

Results are ordered by credit_cents descending.


Errors

StatusCodeCause
422invalid group_bygroup_by is not one of the accepted values
422invalid periodperiod is not one of the accepted values
422invalid_custom_rangestart or end is missing or not valid ISO 8601 when period=custom

Examples

Was this helpful?