{"_id":"@aetherix-ops/ptero-api","name":"@aetherix-ops/ptero-api","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aetherix-ops/ptero-api","version":"1.0.0","description":"A modern Node.js library for the Pterodactyl Panel API. Supports both Client and Application API.","main":"index.js","scripts":{"test":"node test/test.js"},"keywords":["pterodactyl","pterodactyl-api","ptero","panel","hosting","game-server","wings","nodejs"],"author":{"name":"aetherix-ops"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Aetherix-ops/ptero-api.git"},"homepage":"https://github.com/Aetherix-ops/ptero-api#readme","bugs":{"url":"https://github.com/Aetherix-ops/ptero-api/issues"},"engines":{"node":">=18.0.0"},"dependencies":{},"_id":"@aetherix-ops/ptero-api@1.0.0","gitHead":"1233b68a5b7fdfc3be352e393b9cb6fc09ee4dfa","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-UTqSFGtJt8jbxlq3YOe8okXTHEBapWiAFaPlTyXgLUWq16Nz/cQofm6zDTkr6vvCMz2GM3XK0g3b6AZ9zQvcIw==","shasum":"6963f03e20eb19bce772b27deab555951e981c9d","tarball":"https://registry.npmjs.org/@aetherix-ops/ptero-api/-/ptero-api-1.0.0.tgz","fileCount":7,"unpackedSize":22297,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAj8xz1zZNG0nwpiEZzJKx5svwY5b5VTm3KsTfYV53yZAiEA9YHqwYXcSBS5TGAh9OjCdo2EThzl0QzEek3P6+cn1HE="}]},"_npmUser":{"name":"aetherix-ops","email":"devora.support@gmail.com"},"directories":{},"maintainers":[{"name":"aetherix-ops","email":"devora.support@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ptero-api_1.0.0_1780822735914_0.19481188660011828"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-07T08:58:55.782Z","1.0.0":"2026-06-07T08:58:56.043Z","modified":"2026-06-07T08:58:56.231Z"},"maintainers":[{"name":"aetherix-ops","email":"devora.support@gmail.com"}],"description":"A modern Node.js library for the Pterodactyl Panel API. Supports both Client and Application API.","homepage":"https://github.com/Aetherix-ops/ptero-api#readme","keywords":["pterodactyl","pterodactyl-api","ptero","panel","hosting","game-server","wings","nodejs"],"repository":{"type":"git","url":"git+https://github.com/Aetherix-ops/ptero-api.git"},"author":{"name":"aetherix-ops"},"bugs":{"url":"https://github.com/Aetherix-ops/ptero-api/issues"},"license":"MIT","readme":"# @aetherix-ops/ptero-api\n\n<div align=\"center\">\n\n![npm](https://img.shields.io/npm/v/@aetherix-ops/ptero-api?style=flat-square&color=00d2ff)\n![license](https://img.shields.io/npm/l/@aetherix-ops/ptero-api?style=flat-square&color=green)\n![node](https://img.shields.io/node/v/@aetherix-ops/ptero-api?style=flat-square&color=339933)\n![deps](https://img.shields.io/badge/dependencies-0-00d2ff?style=flat-square)\n\n**A modern Node.js library for the Pterodactyl Panel API.**\nSupports both Client API and Application API. Zero dependencies.\n\n</div>\n\n---\n\n## Installation\n\n    npm install @aetherix-ops/ptero-api\n\n---\n\n## Quick Start\n\n```javascript\nconst { PteroClient, PteroApp } = require(\"@aetherix-ops/ptero-api\");\n\n// Client API (user-level)\nconst client = new PteroClient(\"https://panel.yourdomain.com\", \"client_api_key\");\n\n// Application API (admin-level)\nconst app = new PteroApp(\"https://panel.yourdomain.com\", \"application_api_key\");\n```\n\n---\n\n## PteroClient — Client API\n\nFor user-level actions. Use your **Client API key** from Account Settings.\n\n### Account\n\n```javascript\n// Get current account info\nconst account = await client.getAccount();\n\n// Get API keys\nconst keys = await client.getApiKeys();\n```\n\n### Servers\n\n```javascript\n// List all your servers\nconst servers = await client.listServers();\n\n// Get a specific server\nconst server = await client.getServer(\"abc12345\");\n\n// Get server resource usage (RAM, CPU, disk, status)\nconst resources = await client.getServerResources(\"abc12345\");\nconsole.log(resources.attributes.current_state); // \"running\"\nconsole.log(resources.attributes.resources.memory_bytes);\nconsole.log(resources.attributes.resources.cpu_absolute);\n```\n\n### Power Actions\n\n```javascript\nawait client.startServer(\"abc12345\");\nawait client.stopServer(\"abc12345\");\nawait client.restartServer(\"abc12345\");\nawait client.killServer(\"abc12345\");\n\n// Or use sendPowerAction directly\nawait client.sendPowerAction(\"abc12345\", \"restart\");\n```\n\n### Console Commands\n\n```javascript\nawait client.sendCommand(\"abc12345\", \"say Hello from ptero-api!\");\n```\n\n### Files\n\n```javascript\n// List files in root directory\nconst files = await client.listFiles(\"abc12345\", \"/\");\n\n// Get file contents\nconst content = await client.getFileContents(\"abc12345\", \"/server.properties\");\n\n// Delete files\nawait client.deleteFiles(\"abc12345\", [\"logs/latest.log\", \"crash-reports\"]);\n```\n\n### Databases\n\n```javascript\n// List databases\nconst databases = await client.listDatabases(\"abc12345\");\n\n// Create database\nconst db = await client.createDatabase(\"abc12345\", \"mydb\", \"%\");\n\n// Delete database\nawait client.deleteDatabase(\"abc12345\", \"database_id\");\n```\n\n### Backups\n\n```javascript\n// List backups\nconst backups = await client.listBackups(\"abc12345\");\n\n// Create backup\nawait client.createBackup(\"abc12345\");\n\n// Delete backup\nawait client.deleteBackup(\"abc12345\", \"backup-uuid\");\n```\n\n---\n\n## PteroApp — Application API\n\nFor admin-level actions. Use your **Application API key** from Admin Settings.\n\n### Servers\n\n```javascript\n// List all servers\nconst servers = await app.listServers();\n\n// Get server by ID\nconst server = await app.getServer(1);\n\n// Suspend / unsuspend\nawait app.suspendServer(1);\nawait app.unsuspendServer(1);\n\n// Reinstall\nawait app.reinstallServer(1);\n\n// Delete\nawait app.deleteServer(1);\nawait app.deleteServer(1, true); // force delete\n```\n\n### Users\n\n```javascript\n// List all users\nconst users = await app.listUsers();\n\n// Get user by ID\nconst user = await app.getUser(1);\n\n// Create user\nconst newUser = await app.createUser({\n  email: \"user@example.com\",\n  username: \"newuser\",\n  first_name: \"New\",\n  last_name: \"User\"\n});\n\n// Update user\nawait app.updateUser(1, { first_name: \"Updated\" });\n\n// Delete user\nawait app.deleteUser(1);\n```\n\n### Nodes\n\n```javascript\n// List nodes\nconst nodes = await app.listNodes();\n\n// Get node config (Wings configuration)\nconst config = await app.getNodeConfig(1);\n\n// Delete node\nawait app.deleteNode(1);\n```\n\n### Nests & Eggs\n\n```javascript\n// List nests\nconst nests = await app.listNests();\n\n// List eggs in a nest\nconst eggs = await app.listEggs(1);\n\n// Get specific egg\nconst egg = await app.getEgg(1, 3);\n```\n\n---\n\n## Error Handling\n\n```javascript\nconst { PteroError } = require(\"@aetherix-ops/ptero-api\");\n\ntry {\n  await client.startServer(\"invalid\");\n} catch (err) {\n  if (err instanceof PteroError) {\n    console.log(err.message);     // Error message\n    console.log(err.statusCode);  // HTTP status code\n    console.log(err.response);    // Full API response\n  }\n}\n```\n\n---\n\n## Testing\n\n    PANEL_URL=https://panel.yourdomain.com \\\n    CLIENT_KEY=your_client_key \\\n    APP_KEY=your_app_key \\\n    node test/test.js\n\n---\n\n## File Structure\n\n    @aetherix-ops/ptero-api/\n    |- src/\n    |   |- PteroClient.js     - Client API wrapper\n    |   |- PteroApp.js        - Application API wrapper\n    |   |- utils/\n    |       |- request.js     - HTTP request utility\n    |       |- errors.js      - Error classes\n    |- test/\n    |   |- test.js            - Basic test suite\n    |- index.js               - Entry point\n    |- package.json\n    |- README.md\n\n---\n\n## Related\n\n- [ptero-cli](https://github.com/Aetherix-ops/ptero-cli) — CLI tool built on this library\n- [ptero-scripts](https://github.com/Aetherix-ops/ptero-scripts) — Shell scripts for Pterodactyl\n- [ptero-eggs](https://github.com/Aetherix-ops/ptero-eggs) — Updated egg collection\n\n---\n\n## License\n\nMIT — by [aetherix-ops](https://github.com/Aetherix-ops)\n","readmeFilename":"README.md","_rev":"1-9dfd44884b5abfa0ce8d5a0061b4a476"}