Overview
API keys allow you to interact with the Pterodactyl Panel programmatically. You can use these keys to automate tasks, integrate with third-party services, or build custom applications.Account Limits
You can create up to 25 API keys per account. If you reach this limit, you’ll need to delete unused keys before creating new ones.ApiKeyController.php:32-34 for implementation details.
Creating an API Key
Add Description
Enter a clear description for your API key. This helps you identify its purpose later.
Configure IP Restrictions (Optional)
For enhanced security, you can restrict the API key to specific IP addresses or CIDR ranges.
- Leave empty to allow access from any IP
- Add individual IPs:
192.168.1.100 - Use CIDR notation for ranges:
192.168.1.0/24 - Add multiple IPs/ranges (up to 50)
IP validation is performed using the IPTools library to ensure valid IP addresses and CIDR ranges (see
StoreApiKeyRequest.php:26-45).API Key Response
When you create an API key, you’ll receive a response containing:secret_token in the meta section is your actual API key - this is what you’ll use for authentication.
Using Your API Key
Include your API key in the Authorization header for all API requests:Example: List Servers
Example: Get Server Details
Managing API Keys
View Your API Keys
You can view all your API keys in the API Keys section of your account settings. For each key, you’ll see:- Description: The name you gave the key
- Identifier: A unique identifier for the key
- Allowed IPs: Any IP restrictions configured
- Created: When the key was created
The secret token is never displayed after initial creation for security reasons.
Delete an API Key
When you no longer need an API key, it’s important to delete it:IP Address Restrictions
IP restrictions add an extra layer of security by limiting where your API key can be used from.Supported Formats
Validation
The system validates each IP address or CIDR range to ensure it’s properly formatted:Activity Logging
All API key operations are logged for security auditing:- Key Creation:
user:api-key.create(includes identifier) - Key Deletion:
user:api-key.delete(includes identifier)
Security Best Practices
Use Descriptive Names
Use Descriptive Names
Always use clear, descriptive names for your API keys. This makes it easier to identify and manage them later.Good: “Production Deploy Bot”, “Daily Backup Script”
Bad: “Key1”, “Test”, “Temporary”
Implement IP Restrictions
Implement IP Restrictions
Whenever possible, restrict API keys to specific IP addresses or ranges. This prevents unauthorized use even if a key is compromised.
Rotate Keys Regularly
Rotate Keys Regularly
Create new API keys periodically and delete old ones. This limits the window of opportunity if a key is compromised.
Store Keys Securely
Store Keys Securely
- Use environment variables, not hardcoded values
- Use secret management services (AWS Secrets Manager, HashiCorp Vault, etc.)
- Never commit keys to version control
- Never share keys via insecure channels
Monitor Usage
Monitor Usage
Regularly review your activity logs to detect any unusual API key usage patterns.
Delete Unused Keys
Delete Unused Keys
Remove API keys that are no longer needed. Each active key is a potential security risk.
