Creating An API User
- Log into the Proxmox VE web UI
- Select Datacenter from the left navigation menu
- Select Users from the left sub-navigation menu
- Click the Add button at the top of the main content area
- Enter the Username API, set the Realm to Proxmox VE authentication server and set and confirm a password > Click Add
- Select API Tokens from the left sub-navigation menu
- Select API@pve for the username
- Enter a secret key into the Token ID field > Click Add
TIP: Use a random string generator to create a unique Token ID String Generator
- Copy the displayed Token ID and Secret to a text document for use later
- Close the dialog
- Select Roles from the left sub-navigation menu
- Click the Create button at the top of the main content area
- Name the new role APIAdmin and select all available Privileges > Click Create
NOTE: These permissions can be fine-tuned later
INFO: More information on each privilege can be found here - Select Permissions from the left sub-navigation menu
- Select the Add > User permission at the top of the main content area
- Set the Path to /, select the API@pve user and set the Role to APIAdmin > Click Add
Downloading Postman
Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster. - https://postman.com
- Download Postman Download
- Extract or install Postman
- Launch Postman
- Click the Skip and go to app link at the bottom left of the splash screen
- Select File > Settings from the top menu bar
- Disable SSL Certificate Verification and Send anonymous usage data to Postman > Close the Settings dialog window
Proxmox API Authentication
- In Postman, click the + next to the Overview tab to create a new HTTP request tab
- Complete the HTTP Request form as follows:
- Method: POST
- URL: https://DNSorIP:8006/api2/json/access/ticket
- Body: x-www-form-urlencoded
- username: API@pve
- password: <API@pve Password>
- Click the Send button
- From the response, copy the ticket value and CSRFPreventionToken values to a text document for use later
Proxmox Version API Call
- In Postman, click the + next to the Overview tab to create a new HTTP request tab
- Click the Cookies link below the send button
- Type the API URL up to /json/, (ie https://DNSorIP:8006/api2/json/) > Click Add
- Click Add Cookie
- Replace the Cookie_1 key with PVEAuthCookie
- Replace the value with the ticket value from authentication response, the result should look like
PVEAuthCookie=PVE:API@pve:611F9752::aXrYKYqiv8oV/MetlZl6FC40HSULSj4gt9EjDsTIwq+GXVXpkGyqvMlXqmGP6LP/rUYUgIKkSh9ioEhz91kR9/i+jDobDFIAtjBGLIP4yJVbxbtU6hfJL91YQNyYgvHqkPv4/W6EYWir5+LFQc3womgqVE9gKApk61J8zxFNTTjwh87HbMAtv12fvAqiICEqRMdqvE6ySJF5a8E+rOlqa46MlTbUTnzCbqPTY6tWBYHryy8WS8Typ3aSkOKecup18sCBtzqxnkm9bpws+f8vW9FdJV8eKnR+MbFLQtv/re5Cw/J7RpdvcQvMsZ0JLFWqnTaPgRzBc/mM7xZBKeCiSA==
- Click Save > Close the Manage Cookies dialog window
- Complete the HTTP Request form as follows:
- Method: GET
- URL: https://DNSorIP:8006/api2/json/version
- Headers:
- CSRFPreventionToken: <CSRFPreventionToken value from authentication response>
- Click the Send button
- The response body should show details about the current Proxmox version
Proxmox Nodes API Call
- In Postman, right click the /version HTTP request tab > Duplicate Tab
- Change the URL to https://DNSorIP:8006/api2/json/nodes
- Click the Send button
- The response body should show details about the available Proxmox node(s)
Proxmox Node Status API Call
- In Postman, right click the /version HTTP request tab > Duplicate Tab
- Change the URL to https://DNSorIP:8006/api2/json/nodes/<node name>/status
- Click the Send button
- The response body should show details about the selected Proxmox node
Simple PHP API Communication Demo Download
Proxmox VE API Wiki: https://pve.proxmox.com/wiki/Proxmox_VE_API
Proxmox VE Visual API Reference: https://pve.proxmox.com/pve-docs/api-viewer/index.html