{"library":"proxmox-api","title":"Proxmox API Client","description":"proxmox-api is a comprehensive JavaScript and TypeScript client library for interacting with the Proxmox VE API. Currently stable at version `1.1.1`, it offers a unique mapping approach where Proxmox API paths are directly translated into chained method calls (e.g., `/nodes/mynode` becomes `proxmox.nodes.mynode`). The library's core differentiator is its 100% mapping of available Proxmox API calls, complete with extensive TypeScript typings that enable rich IntelliSense, significantly reducing the need to consult external API documentation. It features a small footprint, weighing less than 10KB including its integrated documentation. Releases appear to be ad-hoc but frequent, driven by bug fixes and compatibility updates, such as recent enhancements for ESM and Proxmox 8 support. It supports multiple authentication methods including username/password and API tokens.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install proxmox-api"],"cli":null},"imports":["import proxmoxApi from 'proxmox-api';","import { ProxmoxEngine } from 'proxmox-api';","process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import proxmoxApi from \"proxmox-api\";\n\n// Authorize self-signed certificates if you are not using a valid SSL certificate.\n// In a production environment, prefer proper certificate validation or CA setup.\nprocess.env.NODE_TLS_REJECT_UNAUTHORIZED = process.env.PROXMOX_TLS_REJECT_UNAUTHORIZED || \"0\";\n\nasync function test() {\n    // Connect to Proxmox using environment variables for credentials.\n    // Replace with your actual Proxmox host, username, and password or API token details.\n    const proxmox = proxmoxApi({\n        host: process.env.PROXMOX_HOST ?? '127.0.0.1',\n        password: process.env.PROXMOX_PASSWORD ?? 'your-proxmox-password',\n        username: process.env.PROXMOX_USERNAME ?? 'root@pam'\n    });\n\n    try {\n        // List all nodes in the Proxmox cluster\n        const nodes = await proxmox.nodes.$get();\n        console.log(\"Proxmox Nodes:\", nodes.map((n: any) => n.node).join(', '));\n\n        // Iterate through each node to list its QEMU VMs\n        for (const node of nodes) {\n            const theNode = proxmox.nodes.$(node.node);\n            console.log(`\\n--- VMs on Node: ${node.node} ---`);\n\n            // List Qemu VMs on the current node with full details\n            const qemus = await theNode.qemu.$get({ full: true });\n\n            if (qemus.length === 0) {\n                console.log(`  No QEMU VMs found on node ${node.node}.`);\n                continue;\n            }\n\n            // Iterate through Qemu VMs to get their configuration\n            for (const qemu of qemus) {\n                const config = await theNode.qemu.$(qemu.vmid).config.$get();\n                console.log(`  VM Name: ${config.name}, VMID: ${qemu.vmid}, Memory: ${config.memory}MB, Cores: ${config.cores}`);\n            }\n        }\n    } catch (error) {\n        console.error(\"An error occurred:\", error);\n    }\n}\n\ntest().catch(console.error);","lang":"typescript","description":"This quickstart demonstrates how to initialize the Proxmox API client, connect to a Proxmox host (using environment variables for sensitive data), list all cluster nodes, and then iterate through each node to retrieve and log configuration details for all running QEMU virtual machines.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}