Spaces
Spaces attach room/zone-level attributes to a location: usage type, capacity, status, area_sqft, and optional attributes (e.g. amenities, BMS zone id). One space per location (typically a location with location_type room or zone). Work orders continue to reference location_id; join to spaces when you need usage or status. Set tenant context before calling these methods.
List spaces
List all spaces for the current tenant (from v_spaces). Rows include location_name, location_type.
client.spaces.list()
const spaces = await client.spaces.list()
// Returns SpaceRow[]
Get by ID
Fetch a single space by ID.
client.spaces.getById(id)
const space = await client.spaces.getById('uuid-of-space')
// Returns SpaceRow | null
Get by location
Fetch the space for a given location (at most one space per location).
client.spaces.getByLocationId(locationId)
const space = await client.spaces.getByLocationId('uuid-of-location')
// Returns SpaceRow | null
Create space
Create a space for a location. Returns the new space UUID.
client.spaces.create(params)
const spaceId = await client.spaces.create({
tenantId: 'uuid-of-tenant',
locationId: 'uuid-of-location',
usageType: 'office',
capacity: 4,
status: 'available',
areaSqft: 120.5,
attributes: null,
})
// Returns string (UUID)
- Name
tenantId- Description
Required. Tenant UUID.
- Name
locationId- Description
Required. Location UUID (typically a room or zone). Must belong to the tenant.
- Name
usageType- Description
Optional. E.g. office, conference, patient_room, lab, storage, lobby.
- Name
capacity- Description
Optional. Occupancy/person capacity.
- Name
status- Description
Optional. available, occupied, maintenance, reserved, offline. Default
available.
- Name
areaSqft- Description
Optional. Area in square feet.
- Name
attributes- Description
Optional. JSON object for extensible data.
Update space
Update an existing space. All fields except tenantId and spaceId are optional.
client.spaces.update(params)
await client.spaces.update({
tenantId: 'uuid-of-tenant',
spaceId: 'uuid-of-space',
status: 'occupied',
})
Delete space
Delete a space by tenant and space ID.
client.spaces.delete(tenantId, spaceId)
await client.spaces.delete('uuid-of-tenant', 'uuid-of-space')