The API Key Wildcard Plugin provides a separate API endpoint (/api/wildcard/tickets.json) that allows API keys with IP address 0.0.0.0 to accept requests from any IP address.
This solves a common development problem: osTicket's native API requires you to specify a specific IP address for each API key. This is secure for production, but cumbersome during development when your IP address changes frequently (dynamic IP, working from different locations, CI/CD pipelines).
CRITICAL: Only use wildcard API keys (0.0.0.0) in development environments!
In production environments, API keys should always be bound to specific IP addresses for security reasons.
Why this is important:
0.0.0.0 accept requests from ANY IP address worldwideSafe usage:
| Requirement | Version | Notes |
|---|---|---|
| osTicket | 1.18.x | Plugin uses osTicket's native API infrastructure |
| PHP | 7.4+ | Recommended: PHP 8.1+ for best performance |
| Web Server | Apache or NGINX | Apache requires mod_rewrite enabled |
| File Permissions | Write access to /api/ |
Required for automatic installation |
api-key-wildcard folder to /include/plugins/ on your osTicket serverFinal path: /path/to/osticket/include/plugins/api-key-wildcard/
cd /path/to/osticket/include/plugins
git clone https://github.com/markus-michalski/osticket-api-key-wildcard.git
What happens automatically:
wildcard.php to /api/ directory/api/.htaccess with required rewrite rulesNo manual configuration needed!
0.0.0.0Important: The API key MUST have IP 0.0.0.0 to work with the wildcard endpoint!
If the automatic installation fails (e.g., due to file permissions):
Copy wildcard endpoint:
cp /path/to/osticket/include/plugins/api-key-wildcard/wildcard.php \
/path/to/osticket/api/wildcard.php
chmod 755 /path/to/osticket/api/wildcard.php
Update /api/.htaccess - Add these lines after RewriteEngine On:
# Disable MultiViews for wildcard endpoint (prevents mod_negotiation)
Options -MultiViews
# Wildcard API endpoint (must come BEFORE the default rule)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wildcard/(.*)$ wildcard.php/$1 [L]
Verify permissions:
chmod 755 /path/to/osticket/api/wildcard.php
chmod 644 /path/to/osticket/api/.htaccess
If using NGINX, manually add this to your server block:
# osTicket API Key Wildcard Plugin
location ~ ^/api/wildcard/ {
rewrite ^/api/wildcard/(.*)$ /api/wildcard.php/$1 last;
}
# Pass PHP requests to PHP-FPM
location ~ ^/api/wildcard\.php {
fastcgi_split_path_info ^(/api/wildcard\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php-fpm.sock; # Adjust to your PHP-FPM socket
}
After adding:
sudo nginx -tsudo systemctl reload nginx| Feature | Standard API | Wildcard API |
|---|---|---|
| Endpoint | /api/tickets.json |
/api/wildcard/tickets.json |
| IP Restriction | Specific IP required | Any IP (if API key is 0.0.0.0) |
| Security | High (production-ready) | Low (development only) |
| Use Case | Production | Development/Testing |
curl -X POST \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"name": "Test User",
"email": "test@example.com",
"subject": "Test Ticket",
"message": "This is a test message"
}' \
http://localhost/osTicket/api/wildcard/tickets.json
Important:
/api/wildcard/tickets.json (NOT /api/tickets.json)0.0.0.0All standard osTicket API endpoints work through wildcard:
| Standard Endpoint | Wildcard Endpoint |
|---|---|
/api/tickets.json |
/api/wildcard/tickets.json |
/api/tickets/:id.json |
/api/wildcard/tickets/:id.json |
Note: Works with extended API endpoints from other plugins too!
Symptoms: Plugin enabled but wildcard endpoint doesn't work
Check:
ls /path/to/osticket/api/wildcard.phptail -f /var/log/apache2/error.logSolution: Use manual installation (see installation section above)
Symptoms: Request to wildcard endpoint returns 401
Possible causes:
API key not set to 0.0.0.0
0.0.0.0Using wrong endpoint
/api/wildcard/tickets.json (NOT /api/tickets.json)API key disabled
Missing X-API-Key header
X-API-Key: YOUR_KEYSymptoms: /api/wildcard/tickets.json returns 404
Possible causes:
wildcard.php not copied to /api/ directory
ls /path/to/osticket/api/wildcard.php
Solution: Enable/disable plugin to trigger installation, or copy manually
.htaccess rewrite rule missing
cat /path/to/osticket/api/.htaccess | grep wildcard
Solution: Manually add rewrite rule (see installation section)
mod_rewrite not enabled (Apache)
apache2ctl -M | grep rewrite
Solution:
sudo a2enmod rewrite
sudo systemctl restart apache2
MultiViews causing issues (Apache)
Solution: Ensure .htaccess contains Options -MultiViews BEFORE rewrite rules
Symptoms: Updated plugin files, but wildcard.php in /api/ is still old version
Solution:
# For PHP-FPM
sudo systemctl reload php8.1-fpm
# For Apache mod_php
sudo systemctl reload apache2
βββββββββββββββββββββββββββββββββββββββ
β Client (any IP) β
βββββββββββββββββββββββββββββββββββββββ€
β HTTP Request β
β POST /api/wildcard/tickets.json β
β X-API-Key: YOUR_KEY_WITH_0.0.0.0 β
βββββββββββββββββββββββββββββββββββββββ€
β Apache mod_rewrite / NGINX β
β .htaccess: ^wildcard/(.*)$ β
β β wildcard.php/$1 β
βββββββββββββββββββββββββββββββββββββββ€
β wildcard.php β
β - Checks if API key has IP 0.0.0.0 β
β - If yes: Allow request β
β - If no: Reject (401 Unauthorized) β
βββββββββββββββββββββββββββββββββββββββ€
β osTicket API Processing β
β (standard ticket creation logic) β
βββββββββββββββββββββββββββββββββββββββ
api-key-wildcard/
βββ plugin.php # Plugin registration
βββ class.ApiKeyWildcard.php # Main plugin class
βββ wildcard.php # API endpoint (copied to /api/)
βββ api.wildcard.inc.php # API implementation logic
βββ CHANGELOG.md # Version history
The plugin uses osTicket's enable() hook:
/api/wildcard.php exists.htaccess contains wildcard rulePlugin tracks installed versions for automatic updates:
# In .htaccess:
# API Key Wildcard Plugin v1.0.0
On plugin enable:
.htaccess commentStandard API (/api/tickets.json):
// Checks IP address against API key configuration
if ($api_key->getIpAddr() !== $_SERVER['REMOTE_ADDR']) {
return 401 Unauthorized;
}
Wildcard API (/api/wildcard/tickets.json):
// Only allows API keys with 0.0.0.0
if ($api_key->getIpAddr() !== '0.0.0.0') {
return 401 Unauthorized; // Must use standard API
}
// Skip IP check for 0.0.0.0 keys
NEVER use wildcard API keys (0.0.0.0) in:
Safe to use wildcard API keys in:
What could go wrong with wildcard keys:
Leaked API Key
.env files, use .gitignoreBrute Force Attacks
Internal Threat
If using wildcard keys, add protection:
Create different API keys for different purposes:
Production API Key:
203.0.113.42 (your production server)/api/tickets.jsonDevelopment API Key:
0.0.0.0 (wildcard)/api/wildcard/tickets.jsonRecommended workflow:
Local Development
API_KEY=wildcard-dev-key-12345
ENDPOINT=http://localhost/osTicket/api/wildcard/tickets.json
Staging Environment
# Use wildcard if behind firewall
# OR use specific IP if publicly accessible
API_KEY=wildcard-staging-key-67890
ENDPOINT=https://staging.example.com/api/wildcard/tickets.json
Production Environment
# ALWAYS use specific IP for production
API_KEY=production-key-specific-ip
ENDPOINT=https://tickets.example.com/api/tickets.json # Standard endpoint!
Best practice for teams:
Each developer gets their own wildcard API key
Name API keys descriptively
Dev-John-Wildcard-Key
Dev-Jane-Wildcard-Key
Dev-Bob-Wildcard-Key
Rotate API Keys Regularly
# Every 30-90 days
1. Create new API key with 0.0.0.0
2. Update applications
3. Delete old API key
Before deploying to production:
# Disable wildcard plugin
Admin Panel β Manage β Plugins β API Key Wildcard β Disable
# Use standard API with specific IPs
Admin Panel β Manage β API Keys β Update IP to specific address
Q: Does this plugin modify osTicket core files?
A: No! The plugin creates a separate endpoint and does NOT modify any osTicket core files. Standard API remains unchanged and secure.
Q: Can I use both endpoints simultaneously?
A: Yes! Standard API for production integrations (strict IP), wildcard API for development (flexible IP).
Q: Does this work with osTicket 1.17 or older?
A: Not tested. The plugin is designed for osTicket 1.18.x. It may work with 1.17, but compatibility is not guaranteed.
Q: Is it compatible with PHP 8.x?
A: Yes! The plugin is tested with PHP 7.4, 8.0, 8.1, 8.2, and 8.3.
Q: Does this work with NGINX?
A: Yes, but requires manual configuration (see installation section). Apache setup is automatic.
Q: Can I use this with the API Endpoints Plugin?
A: Yes! All extended API endpoints work through the wildcard endpoint too.
Q: Is this safe for production?
A: NO! Only use wildcard API keys (0.0.0.0) in development/testing environments. Production should always use specific IP addresses.
Q: What happens if my wildcard API key leaks?
A: Anyone with the key can create tickets from anywhere. Immediately:
Q: Can I restrict wildcard keys to specific IP ranges?
A: Not currently. The plugin only supports 0.0.0.0 (all IPs). For IP ranges, use the standard API endpoint.
This Plugin is released under the GNU General Public License v2, compatible with osTicket core.
See LICENSE for details.
For questions or issues, please create an issue on GitHub:
Issue Tracker: https://github.com/markus-michalski/osticket-api-key-wildcard/issues
When reporting issues, please include:
php -v)Developed by Markus Michalski
Contributions welcome!
Ideas for contributions:
192.168.1.0/24)See CHANGELOG.md for version history.