Source Code References
Most API endpoints documented in this guide includes references to the actual implementation in the Pterodactyl Panel source code. This helps developers understand how the API works internally and provides a way to verify the accuracy of our documentation.
How to Use Source References
📂 Repository Structure
The Pterodactyl Panel is open source and available on GitHub:
- Main Repository: pterodactyl/panel
- Wings Daemon: pterodactyl/wings
🗂️ Key Directories
Directory | Purpose | Contains |
---|---|---|
app/Http/Controllers/Api/Client/ | Client API Controllers | User-facing server management endpoints |
app/Http/Controllers/Api/Application/ | Application API Controllers | Administrative panel management endpoints |
routes/api-client.php | Client API Routes | Route definitions for client endpoints |
routes/api-application.php | Application API Routes | Route definitions for admin endpoints |
app/Models/ | Data Models | Database models and relationships |
app/Services/ | Business Logic | Complex operations and business rules |
Understanding Source References
📍 Reference Format
Each endpoint includes these source references:
### Source Reference
- **Method**: [`ControllerName@methodName`](link-to-github)
- **Route**: [`HTTP_METHOD /api/path`](link-to-route-definition)
- **Service**: [`ServiceClassName`](link-to-service-class)
🎯 Example Breakdown
For the "List Users" endpoint:
### Source Reference
- **Method**: [`UserController@index`](https://github.com/pterodactyl/panel/blob/1.0-develop/app/Http/Controllers/Api/Application/Users/UserController.php#L47)
- **Route**: [`GET /api/application/users`](https://github.com/pterodactyl/panel/blob/1.0-develop/routes/api-application.php#L45)
This tells you:
- Controller Method: The
index
method inUserController
handles this request - Route Definition: Line 45 in
api-application.php
defines this route - GitHub Links: Direct links to the exact lines of code
API Implementation Patterns
🔄 Common Controller Methods
Method | Purpose | HTTP Verb |
---|---|---|
index | List resources | GET |
show / view | Get single resource | GET |
store | Create new resource | POST |
update | Update existing resource | PATCH/PUT |
destroy / delete | Delete resource | DELETE |
🛡️ Authentication & Middleware
All API endpoints use these middleware components:
- Client API:
Client Middleware
- Application API:
AuthenticateApplicationUser
- Server Access:
AuthenticateServerAccess
🔧 Service Layer Pattern
Complex operations are handled by service classes:
- User Management:
UserCreationService
- Server Creation:
ServerCreationService
- Power Management:
DaemonPowerRepository
Wings Daemon Integration
🚀 Wings Communication
Many endpoints communicate with the Wings daemon:
- Wings Repository: pterodactyl/wings
- WebSocket Handling:
websocket.go
- Server Management:
server.go
- File Operations:
Wings Server Code
🔗 Panel-Wings Communication
graph LR
A[Panel API] --> B[Repository Layer]
B --> C[HTTP Client]
C --> D[Wings Daemon]
D --> E[Docker Container]
Quick Reference Links
📋 Client API Controllers
Feature | Controller | GitHub Link |
---|---|---|
Server List | ClientController | View Code |
Server Details | ServerController | View Code |
Power Management | PowerController | View Code |
File Management | FileController | View Code |
Database Management | DatabaseController | View Code |
Backup Management | BackupController | View Code |
🔧 Application API Controllers
Feature | Controller | GitHub Link |
---|---|---|
User Management | UserController | View Code |
Server Management | ServerController | View Code |
Node Management | NodeController | View Code |
Location Management | LocationController | View Code |
Contributing to Pterodactyl
🤝 How to Contribute
If you find issues or want to improve the Panel:
- Report Issues: Panel Issues
- Submit Pull Requests: Contributing Guide
- Join Discord: Pterodactyl Community
📚 Development Setup
- Installation Guide: Panel Installation
- Development Environment: Development Setup
- API Documentation: Official API Docs
Version Information
📅 Current References
All source references in this documentation point to:
- Branch:
1.0-develop
(Pterodactyl v1 stable development branch) - Panel Version: v1.11.x
- Wings Version: v1.11.x
⚠️ Version Notes
- Links point to the
develop
branch for the latest features - For stable releases, change
develop
to the specific version tag (e.g.,v1.11.5
) - Some features may only be available in newer versions
Related Documentation
- Authentication - API key setup and usage
- Rate Limiting - Request limits and best practices
- Error Handling - Common errors and solutions
- Client API - User-facing endpoints
- Application API - Administrative endpoints
- WebSocket API - Real-time communication