Proxmox API

July 13, 2024

Proxmox API

Whether you are working in the cloud or on-prem, APIs and their usage has become standard practice in the IT world in recent years, with more and more services providing them and IT professionals becoming accustomed to their usage.

Proxmox is no different - it provides a well documented API, which can be used to drive the functionality in the Proxmox web interface.

How to Access the API

There are two approaches to using the API - you can either create an API token, or use your username and password.

To create an API token, go to Datacenter and into “Permissions”. Click on “API Tokens” and “Add” to create a new token.

Select the relevant username, and enter a unique token ID.

The Token ID and secret will be generated, which you can then use for scripting / integration purposes on each API call.

Proxmox API 1

Proxmox API 2

Set the token as the Authorization header on each REST call - see the token authentication video below.

Proxmox API 3

Alternatively, you can use your username and password to connect to the /api2/json/access/ticket endpoint on your cluster.

Proxmox API 4

The ticket value can be added as a cookie ( and CSRFPreventionToken can be added as a header) to use with further API calls.

Proxmox API 5

Proxmox API 6

API Usage can be seen in the following videos - API quick start with PowerShell and Postman:

Python and Postman:

API Tokens:

Example scripts can be found here:

Python API Script

PowerShell API Script

Useful links:

Proxmox VE API Wiki

Proxmox VE API reference

Postman Download Link