
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
pterodactyl-api-wrapper-fix
Advanced tools
[](https://npmjs.com/package/pterodactyl-api-wrapper) [](LICENSE)
Pterodactyl API Wrapper is a fully-featured Node.js library designed to interact with the Pterodactyl panel. This package provides access to both the Client API (user interactions) and Application API (administrative control), allowing full management of users, servers, nodes, files, and more.
Note: This wrapper supports all endpoints from the Pterodactyl API, ensuring that you have full control over every aspect of your panel.
For detailed documentation, please refer to the online docs linked below.
Read full Documentation:
Install the package via npm:
npm install pterodactyl-api-wrapper
Before making API calls, set the panel URL globally using the Setup class:
import { Setup } from "pterodactyl-api-wrapper";
Setup.setPanel("https://panel.example.com");
This package contains several core classes that help you interact with the Pterodactyl API:
The Setup class is responsible for managing global configuration.
| Method | Description |
|---|---|
Setup.setPanel(url: string): void | Sets the global panel URL. |
Setup.getPanel(): string | Retrieves the configured panel URL. |
The Client class provides an interface for interacting with the Client API, designed for user-level interactions.
import { Client } from "pterodactyl-api-wrapper";
const client = new Client("YOUR_CLIENT_API_KEY");
// Get account details
const details = await client.account.getDetails();
console.log(details);
The Application class is used for administrative control, such as managing users, servers, nodes, and more.
import { Application } from "pterodactyl-api-wrapper";
const app = new Application("YOUR_APPLICATION_API_KEY");
// List all users
const users = await app.users.list();
console.log(users);
The WSConnection (exported as part of the wrapper) is an advanced WebSocket class that supports:
import { WSConnection } from "pterodactyl-api-wrapper";
const ws = new WSConnection({
url: "wss://panel.example.com/api/client/servers/{server_id}/ws",
autoReconnect: true,
reconnectStrategy: "exponential-jitter",
reconnectInterval: 1000,
maxReconnectAttempts: 10,
connectionTimeout: 10000,
heartbeatInterval: 30000,
heartbeatTimeout: 5000,
queueMessages: true,
autoJson: true,
logger: (level, ...args) => console.log(`[WS ${level.toUpperCase()}]`, ...args),
});
ws.connect().then(() => {
console.log("WebSocket connected.");
ws.send({ action: "ping" });
}).catch((err) => {
console.error("Failed to connect WebSocket:", err);
});
| Method | Description |
|---|---|
client.account.getDetails() | Retrieves the authenticated user's account details. |
client.account.enable2FA(codes: string[]) | Enables two-factor authentication (2FA). |
client.account.disable2FA(tokens: string[]) | Disables 2FA using recovery tokens. |
client.account.updateEmail(email: string, password: string) | Updates the email address. |
client.account.updatePassword(current_password: string, new_password: string) | Changes the account password. |
client.account.createApiKey(description: string, allowed_ips: string[]) | Creates a new API key. |
client.account.deleteApiKey(key_id: string) | Deletes an existing API key. |
client.account.listApiKeys() | Lists all API keys. |
| Method | Description |
|---|---|
client.servers.list() | Lists all accessible servers. |
client.servers.showPermissions(server_id: string) | Retrieves permissions for a specific server. |
| Method | Description |
|---|---|
client.files.list(server_id: string) | Lists files in a server. |
client.files.getContent(server_id: string, file_path: string) | Reads the content of a file. |
client.files.download(server_id: string, file_path: string) | Generates a download link for a file. |
client.files.rename(server_id: string, from: string, to: string) | Renames a file or folder. |
client.files.copy(server_id: string, file_path: string) | Copies a file. |
client.files.write(server_id: string, file_path: string, content: string) | Writes to a file. |
client.files.compress(server_id: string, files: string[]) | Compresses files into a ZIP archive. |
client.files.decompress(server_id: string, file_path: string) | Extracts a ZIP archive. |
client.files.delete(server_id: string, files: string[]) | Deletes files or folders. |
client.files.createFolder(server_id: string, folder_path: string) | Creates a new folder. |
client.files.upload(server_id: string, file_data: FormData) | Uploads a file to the server. |
| Method | Description |
|---|---|
app.users.list() | Lists all users. |
app.users.getDetails(user_id: string) | Retrieves details for a specific user. |
app.users.getDetailsByExternalId(external_id: string) | Retrieves user details by external ID. |
app.users.create(user_details: object) | Creates a new user. |
app.users.update(user_id: string, user_data: object) | Updates an existing user. |
app.users.delete(user_id: string) | Deletes a user. |
| Method | Description |
|---|---|
app.nodes.list() | Lists all nodes. |
app.nodes.getDetails(node_id: string) | Retrieves node details. |
app.nodes.create(node_data: object) | Creates a new node. |
app.nodes.update(node_id: string, node_data: object) | Updates node information. |
app.nodes.delete(node_id: string) | Deletes a node. |
| Method | Description |
|---|---|
app.servers.list() | Lists all servers. |
app.servers.getDetails(server_id: string) | Retrieves server details. |
app.servers.create(server_data: object) | Creates a new server. |
app.servers.update(server_id: string, update_data: object) | Updates server details. |
app.servers.delete(server_id: string) | Deletes a server. |
src/
├── class/
│ ├── main/
│ │ ├── Application.ts // Application API class (Admin)
│ │ ├── Client.ts // Client API class (User)
│ │ ├── Setup.ts // Global configuration
│ │ └── WSConnection.ts // Advanced WebSocket class
│ └── source/
│ ├── app/ // Application API endpoints
│ │ ├── users/
│ │ ├── nodes/
│ │ ├── locations/
│ │ ├── servers/
│ │ └── nests/
│ └── client/ // Client API endpoints
│ ├── account/
│ └── servers/
└── index.ts // Main entry point
This project is licensed under the Apache 2.0 License. Remember to follow this License when using this code and/or npm.
Developed by cptcr.
This project is NOT affiliated with or endorsed by Pterodactyl.
Contributions are welcome! Open an issue or submit a pull request on GitHub.
If you need help, please open an issue on GitHub or reach out via our support channels.
FAQs
[](https://npmjs.com/package/pterodactyl-api-wrapper) [](LICENSE)
We found that pterodactyl-api-wrapper-fix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.