You can use the vSphere Automation APIs to connect ESXi hosts to a vCenter Server instance and make the hosts managed. You can temporarily disconnect a managed host from a vCenter Server instance and reconnect the host, for example, to refresh the ESX agents on the host.

When you add a host to a vCenter Server instance, the host is connected to vCenter Server and becomes a managed host. To disconnect a managed host from a vCenter Server instance, use the POST https://<vcenter_ip_address_or_fqdn>/api/vcenter/host/<host_id>?action=disconnect request and submit the host identifier as a path parameter. The managed host and its associated virtual machines remain in the inventory but vCenter Server temporarily stops managing and monitoring them.

To reconnect a managed host to a vCenter Server instance, use the POST https://<vcenter_ip_address_or_fqdn>/api/vcenter/host/<host_id>?action=connect request and submit the host identifier as a path parameter. As a result, the connection status of the host changes, and vCenter Server resumes managing the host and its associated virtual machines.

If you want to delete a host and all its associated virtual machines from the inventory, you can remove the host from the vCenter Server instance. To delete a disconnected host from a vCenter Server instance, use the DELETE https://<vcenter_ip_address_or_fqdn>/api/vcenter/host/<host_id> and submit the host identifier as a path parameter.