If you’re automating the deployment of an additional workload domain, cluster or expanding an already existing cluster, you’ll know that you need the Host ID in order to issue the proper API calls.

There are numerous ways of getting the Host ID.
You can use the SDDC Manager UI and browse to the host, the Host ID will be visible in the URL. This can be useful if you’re only dealing with a couple of hosts.


You can also get the Host ID programmatically using the API explorer, usable if you’re dealing with a larger number of hosts.

GET /v1/hosts

However if you have multiple of unassigned hosts, you might have a hard time figuring out which one to use.


Here’s a method of mapping the FQDN of an ESXi host with its corresponding Host ID and status.

curl -X GET --insecure -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" 'https://localhost/v1/hosts' | jq '.elements | .[] | .id, .fqdn, .status' |  tr -d '\n' | sed 's/D"/D"\n/g' | sed 's/""/" "/g' | tr -d '"'


f750b6b6-ab12-43fe-8a58-0fcdbfeed917 esxi-1.vrack.vsphere.local ASSIGNED
76855635-ae48-4043-8d3c-1f6964a8c00e esxi-2.vrack.vsphere.local ASSIGNED
7d23b1a8-a6fe-4133-90a0-8041f595bbca esxi-3.vrack.vsphere.local ASSIGNED
2e4000b3-6fb7-48d8-a2a4-8a2b4f9565e4 esxi-4.vrack.vsphere.local ASSIGNED
6e79bab6-2553-4a14-955b-f2261cbc601a esxi-5.vrack.vsphere.local UNASSIGNED_UNUSEABLE
ed3c048e-0231-4223-91b6-52c4de1cb71a esxi-6.vrack.vsphere.local ASSIGNED
022e0443-7bad-4188-bd98-57ee43e44067 esxi-7.vrack.vsphere.local UNASSIGNED_USEABLE
46896397-64ba-4333-89cb-8ec9ddb15b25 esxi-9.vrack.vsphere.local UNASSIGNED_USEABLE
a702ad07-c9c1-4549-beaf-f8da93bec290 esxi-8.vrack.vsphere.local UNASSIGNED_USEABLE