# Facility groups Managed facility groups for organizing facilities under an account (nameplate capacity cap, membership). Routes: GET `/managed_facility_group` (singular, paginated list); POST and sub-resources under `/managed_facility_groups` (plural). Path id `managed_facility_group_id` is the managed group primary key. `member_id` in member routes is the facility id (`facilities_id`). ## List managed facility groups - [GET /managed_facility_group](https://developer.xpansiv.com/openapi/xpansiv-managed-solutions-v1/openapi/facility-groups/getmanagedfacilitygroups.md): Paginated list of managed facility groups for the API account (nested member facilities included). Respects the same account resolution rules as other API routes (account_id query may apply for admins). Does not use the managed-facility-groups feature flag; mutating routes still require the feature to be enabled. ## Create managed facility group - [POST /managed_facility_groups](https://developer.xpansiv.com/openapi/xpansiv-managed-solutions-v1/openapi/facility-groups/createmanagedfacilitygroup.md): Create a managed facility group for the API account. max_capacity_kw caps the sum of member facility nameplate sizes (facility_size_kw from facility records). If name is omitted or blank after trimming, the server assigns a unique default name. If facility_ids is omitted or empty, an empty group is created. If provided, the group is created and each facility is added as a member in a single transaction (same validations as add-member). A numeric max_capacity_kw is required (the server rejects the request when it is missing or not numeric). utility_id and autoreporter_id are required (positive integers: utilities.utilities_id and remote_data_collectors.remote_data_collectors_id semantics for the group's utility and autoreporter). Requires managed_facility_group_account_access.is_enabled for the account (RE-1409). Caller must have facility edit permission (EDIT_FACILITY). ## Add facility to group - [POST /managed_facility_groups/{managed_facility_group_id}/members](https://developer.xpansiv.com/openapi/xpansiv-managed-solutions-v1/openapi/facility-groups/addmanagedfacilitygroupmember.md): Adds a single facility (facilities_id) to the group if capacity and membership rules allow. Same feature gate and permission requirements as create group. Facility interconnect utility (locations.utilities_id) and primary-meter autoreporter (meters.remote_data_collectors_id) must match the group's utility_id and autoreporter_id. For admins, the group owner's account is derived from managed_facility_group_id; account_id is not required. Non-admins operate on their active account and must own the group. ## Remove facility from group - [DELETE /managed_facility_groups/{managed_facility_group_id}/members/{member_id}](https://developer.xpansiv.com/openapi/xpansiv-managed-solutions-v1/openapi/facility-groups/removemanagedfacilitygroupmember.md): member_id is the facility id (facilities_id). For admins, the group owner's account is derived from managed_facility_group_id; account_id is not required. Non-admins operate on their active account and must own the group. ## Remove all facilities from group - [POST /managed_facility_groups/{managed_facility_group_id}/ungroup](https://developer.xpansiv.com/openapi/xpansiv-managed-solutions-v1/openapi/facility-groups/ungroupmanagedfacilitygroup.md): Keeps the managed facility group row; soft-deletes all memberships for the group. Returns the count of memberships removed. For admins, the group owner's account is derived from managed_facility_group_id; account_id is not required. Non-admins operate on their active account and must own the group.