Use this when tools call the vSphere API directly or through SDKs.
vSphere API
The vSphere API is the SOAP and REST interface to vCenter and ESXi used by PowerCLI, govc, pyVmomi, Terraform and Ansible, giving access to all inventory and operations.
1. vSphere Automation REST API and SOAP (vim) API.
2. Session tokens.
3. Use SDKs for complex tasks.
4. Verify certificates (add vCenter CA).
5. Rate and session limits.
client → session → REST/SOAP → vCenter
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Record vCenter, managed object IDs, VM UUID/MoRef, datastore/network IDs and task ID; inspect the runtime/control-plane result; then query the selected vSphere managed objects and resulting VM/storage/network state through an independent read path and compare it with the versioned intent. For VMware Automation → vSphere API, the evidence must connect the control-plane result to the selected vSphere managed objects and resulting VM/storage/network state and explain any gap between desired, controller-reported and consumer-visible state.
Step 2 Common mistakes Narrow the fault
- Using the SOAP API where REST/vAPI is available.
Step 3 Where it fails Narrow the fault
Common failure classes include duplicate names, stale inventory, task still running after client timeout, vCenter/host permission gaps, storage/network dependency failure and assuming task success shows guest service health. Before retrying a mutating operation, read current target state using the stable identity vCenter, managed object IDs, VM UUID/MoRef, datastore/network IDs and task ID; if state is unknown, stop broad retries.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- The vSphere API has SOAP and REST interfaces.
- All tools use it.
- Sessions expire.
curl -s --cacert vcenter-ca.pem -X POST -u <user> https://<vc>/api/session— session token with verified TLScurl -s --cacert vcenter-ca.pem -H 'vmware-api-session-id: <token>' https://<vc>/api/vcenter/vm— list VMsgovc ls /<dc>/vm— govc
ReferenceWhy it matters1 section · depth on demand
In depth
The vSphere API is how all VMware tools talk to vCenter and ESXi. There is the older SOAP-based Web Services API (used by PowerCLI and pyVmomi, most complete) and the newer vSphere Automation REST API (/api/...).
SID=$(curl -sk -X POST -u "$USER:$PASS" https://vcenter/api/session | tr -d '"')
curl -sk -H "vmware-api-session-id: $SID" https://vcenter/api/vcenter/vm | jq '.[].name'
| API | Coverage |
|---|---|
| SOAP (pyVmomi, PowerCLI) | Full inventory and operations |
REST (/api) | VMs, content library, tagging, many newer features |
Use the Developer Center/API Explorer in vCenter to discover endpoints and the MOB for SOAP object paths.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
VMware Automation → vSphere API is owned at runtime by vCenter/ESXi control plane invoked through vSphere APIs or PowerCLI. Its durable intent is versioned automation plus explicit vCenter scope, object selectors and desired VM/storage/network state; the stable identity contract is vCenter, managed object IDs, VM UUID/MoRef, datastore/network IDs and task ID. The consumer-visible target is the selected vSphere managed objects and resulting VM/storage/network state. The operating invariants are that selectors resolve one intended object set, permissions are scoped, tasks are followed to completion, inventory cache/stale names do not replace MoRef identity and guest/consumer state is checked when needed. Follow the chain of components PowerCLI/API → vCenter inventory/authorization → task → ESXi/storage/network subsystem → managed object state → independent query and record which layer currently owns truth. The linked authority for bounded mechanics is Broadcom Developer Portal — VMware PowerCLI; documentation support is separate from observed lab/production Evidence.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in VMware Automation > vSphere API. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://developer.broadcom.com/powercli · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
Capture at minimum vCenter, object name+MoRef/UUID, task ID/state, host/datastore/network IDs, PowerCLI/API version, errors and final object/guest state.