API reference · Assets
GET/api/v1/assets/stats

Get asset statistics

Returns tenant-scoped aggregate asset statistics including total counts, counts by type/status/client, warranty counts, and maintenance due/overdue counts. The service runs multiple aggregate queries filtered by context.tenant; assets_by_client is limited to the top 10 client names. The response links currently point at /api/v2/assets paths. In the current route wiring, req.context may be absent because no route-level API-key auth wrapper sets it, causing a 500 before statistics can be calculated.

RBAC · asset

Response body

Success response 200 · schema AssetStatsResponse

successbooleanRequired
Enum: true
dataobjectRequired
dataobjectRequired
total_assetsintegerRequired
Total asset count for the tenant.
assets_added_this_monthintegerRequired
Count of assets created since the start of the current month.
average_asset_age_daysintegerRequiredNullable
Rounded average age in days from purchase_date, or null when unavailable.
total_asset_valuenumberRequired
Sum of purchase_price values, treating null as zero.
assets_by_typeobjectRequired
Counts grouped by assets.asset_type.
assets_by_statusobjectRequired
Counts grouped by assets.status.
assets_by_clientobjectRequired
Top client counts grouped by clients.client_name. The service limits this grouping to 10 clients.
warranty_expiring_soonintegerRequired
Count of warranties ending within 30 days.
warranty_expiredintegerRequired
Count of warranties already expired.
maintenance_dueintegerRequired
Count of active maintenance schedules with next_maintenance due now or earlier.
maintenance_overdueintegerRequired
Count of active maintenance schedules overdue by more than seven days.
_linksobjectRequired
Stats links. The controller currently points these at /api/v2/assets paths.
selfobject
hrefstringRequired
Target URL for the related operation.
methodstring
HTTP method for the link when supplied.
assetsobject
hrefstringRequired
Target URL for the related operation.
methodstring
HTTP method for the link when supplied.
metaobjectRequired
timestampstring <date-time>Required
Response timestamp generated by createApiResponse/createErrorResponse.
versionstringRequired
API response version string.

Response codes

200
Asset statistics returned successfully.
401
x-api-key is missing at middleware.
403
Authenticated request context lacks permission to read assets when auth wiring is present.
500
Unexpected error, including missing req.context in the current route wiring.