[REST API] Is there any API which returns proxmox 'VM id' given the 'VM name'

Priyanka Sahani

New Member
Aug 1, 2023
[REST API] Is there any API which returns proxmox 'VM id' given the 'VM name'

I saw that the reboot/reset api is using {vmid} to reset/reboot a VM(https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/status/reset).
The only way I could get the vm_id based on VM_name is via "https://pve.proxmox.com/pve-docs/api-viewer/index.html#/cluster/resources" api which will return me info of the resources present at proxmox. Here, I have to loop through all the resources and find my matching resources.
As we are planning to having thousands of VM's in our proxmox environment moving forward, looping through all the VM or resources seems to be a bad idea. Hence, I am looking for an API which return me proxmox VM details.

Input: VM name
Expected output: VM details containing VM ID

Thanks in advance,
Last edited:
There is no such method, because VM names are not unique...
Not yet? May this is something that could be integrated (with a result set instead of just a VM due to the reasons you mentioned)? If so, I can create a feature request on bugzilla.

I wrote myself a litte api wrapper that does exactly this name -> ID conversion (with error handline >1 entry returned) for my own purposes, yet it would be great to have it already present in the PVE API.
"VM names are not unique..."

Right...VM ID's are unique across a cluster. Which begs the question, why do we need to include a node number when querying the API?


Am I missing a call to get a VM info without knowing which node its on?
There is now at least.. you can do:

https://<any one of your node IPs>:8006/api2/json/cluster/resources?type=vm

and get a full list of all VMs on your system. Iterating that will give you all the information you need.

Bear in mind that the API token used needs 'VM.Audit' permission to pull the list.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!