# Quick Overview of Proxmox VE REST API

## Creating An API User

1. Log into the Proxmox VE web UI
2. Select Datacenter from the left navigation menu
3. Select Users from the left sub-navigation menu
4. Click the Add button at the top of the main content area
5. Enter the Username API, set the Realm to Proxmox VE authentication server and set and confirm a password > Click Add
6. Select API Tokens from the left sub-navigation menu
7. Select API@pve for the username
8. 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

9. Copy the displayed Token ID and Secret to a text document for use later
10. Close the dialog
11. Select Roles from the left sub-navigation menu
12. Click the Create button at the top of the main content area
13. 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

14. Select Permissions from the left sub-navigation menu
15. Select the Add > User permission at the top of the main content area
16. 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

1. Download Postman Download
2. Extract or install Postman
3. Launch Postman
4. Click the Skip and go to app link at the bottom left of the splash screen
5. Select File > Settings from the top menu bar
6. Disable SSL Certificate Verification and Send anonymous usage data to Postman > Close the Settings dialog window

## Proxmox API Authentication

1. In Postman, click the + next to the Overview tab to create a new HTTP request tab
2. 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>
3. Click the Send button
4. From the response, copy the ticket value and CSRFPreventionToken values to a text document for use later

## Proxmox Version API Call

1. In Postman, click the + next to the Overview tab to create a new HTTP request tab
2. Click the Cookies link below the send button
3. Type the API URL up to /json/, (ie https://DNSorIP:8006/api2/json/) > Click Add
4. Click Add Cookie
5. Replace the Cookie_1 key with PVEAuthCookie
6. 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==

7. Click Save > Close the Manage Cookies dialog window
8. Complete the HTTP Request form as follows:
   - Method: GET
   - URL: https://DNSorIP:8006/api2/json/version
   - Headers:
     - CSRFPreventionToken: <CSRFPreventionToken value from authentication response>
9. Click the Send button
10. The response body should show details about the current Proxmox version

## Proxmox Nodes API Call

1. In Postman, right click the /version HTTP request tab > Duplicate Tab
2. Change the URL to https://DNSorIP:8006/api2/json/nodes
3. Click the Send button
4. The response body should show details about the available Proxmox node(s)

## Proxmox Node Status API Call

1. In Postman, right click the /version HTTP request tab > Duplicate Tab
2. Change the URL to https://DNSorIP:8006/api2/json/nodes/<node name>/status
3. Click the Send button
4. 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