Assets

Lists and gets assets for the current tenant; create, update, delete. Set tenant context before calling these methods.

List assets

List all assets for the current tenant (from v_assets).

client.assets.list()

const assets = await client.assets.list()
// Returns AssetRow[]

Get by ID

Fetch a single asset by ID.

client.assets.getById(id)

const asset = await client.assets.getById('uuid-of-asset')
// Returns AssetRow | null

Lifecycle fields

AssetRow includes lifecycle and planning fields (from v_assets). Use them for reporting and replacement planning; create/update asset RPCs may not yet accept all of these (set via database or future API):

  • commissioned_at – when the asset was placed into service
  • end_of_life_estimate – estimated EOL date for replacement planning
  • decommissioned_at – when the asset was decommissioned
  • replaced_by_asset_id – asset that replaced this one (this asset retired)
  • replacement_of_asset_id – asset that this one replaced
  • warranty_expires_at – warranty expiration date
  • service_contract_expires_at – service/maintenance contract expiration
  • planned_replacement_date – planned replacement date for capital planning

For alerts (e.g. warranty or EOL approaching), use client.costs.listLifecycleAlerts() or client.costs.assetLifecycleAlerts(). See Costs & lifecycle.

Warranties (multi-row)

warranty_expires_at above is a rollup from active app.asset_warranties rows. Use v_asset_warranties for full history and multiple policies.

client.assets.listWarranties / upsertWarranty

const rows = await client.assets.listWarranties(assetId)

const warrantyId = await client.assets.upsertWarranty({
  tenantId,
  assetId,
  expiresOn: '2028-12-31',
  warrantyType: 'standard',
  coverageSummary: 'OEM coverage',
})

More context: Capability inventory — Warranty.

Create asset

Create a new asset. Returns the new asset UUID.

client.assets.create(params)

const assetId = await client.assets.create({
  tenantId: 'uuid-of-tenant',
  name: 'HVAC Unit 3B',
  description: 'Main floor HVAC',
  assetNumber: 'AST-003',
  locationId: 'uuid-of-location',
  departmentId: 'uuid-of-department',
  status: 'active',
})
// Returns string (UUID)
  • Name
    tenantId
    Description

    Required. Tenant UUID.

  • Name
    name
    Description

    Required. Asset display name.

  • Name
    description
    Description

    Optional. Description.

  • Name
    assetNumber
    Description

    Optional. Asset number or code.

  • Name
    locationId
    Description

    Optional. Location UUID.

  • Name
    departmentId
    Description

    Optional. Department UUID.

  • Name
    status
    Description

    Optional. Default active. Status key.

Update asset

Update an existing asset. All fields except tenantId and assetId are optional.

client.assets.update(params)

await client.assets.update({
  tenantId: 'uuid-of-tenant',
  assetId: 'uuid-of-asset',
  name: 'HVAC Unit 3B (updated)',
  description: null,
  assetNumber: null,
  locationId: null,
  departmentId: null,
  status: 'inactive',
})

Delete asset

Delete an asset by tenant and asset ID.

client.assets.delete(tenantId, assetId)

await client.assets.delete('uuid-of-tenant', 'uuid-of-asset')

Was this page helpful?