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.
Without this plugin: osTicket's native API requires a fixed IP address per API key. With dynamic IPs (home office, CI/CD, changing locations), the key must be manually updated constantly.
With this plugin: A separate wildcard endpoint allows API keys with IP
0.0.0.0to accept requests from any IP address. The standard endpoint remains unchanged and secure.
Wildcard API keys (
0.0.0.0) are intended for development environments only! In production environments, API keys should always be bound to specific IP addresses.
| 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 |
No external dependencies. No Composer required.
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 api-key-wildcard
What happens automatically:
wildcard.phpis copied to the/api/directory (chmod 0755)/api/.htaccessreceivesOptions -MultiViewsand wildcard rewrite rule- Installation details are written to the error log
- Installed version is saved in plugin configuration
0.0.0.0The API key MUST have IP
0.0.0.0to work with the wildcard endpoint!
If 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]
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;
}
sudo nginx -t
sudo systemctl reload nginx
The plugin offers two settings in the Admin Panel (Plugins → API Key Wildcard → Configuration):
| Setting | Description | Default | When to use |
|---|---|---|---|
| Installed Version | Shows the currently installed plugin version (readonly) | Automatic | To verify auto-update worked correctly |
| Log Wildcard Access | Logs each wildcard API access to the debug log | Enabled | Disable with high API volume to avoid log spam |
When "Log Wildcard Access" is enabled, each successful wildcard access creates a debug entry with the remote IP in osTicket's system log. The IP is XSS-protected using
Format::htmlchars(Format::sanitize()).
| Feature | Standard API | Wildcard API |
|---|---|---|
| Endpoint | /api/tickets.json |
/api/wildcard/tickets.json |
| IP Restriction | Specific IP required | Any IP (if API key IP = 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 via Wildcard",
"message": "This is a test message via the wildcard endpoint"
}' \
http://localhost/osTicket/api/wildcard/tickets.json
Use
/api/wildcard/tickets.json(NOT/api/tickets.json). The standard endpoint continues to work normally with IP-bound keys.
| Standard Endpoint | Wildcard Endpoint |
|---|---|
/api/tickets.json |
/api/wildcard/tickets.json |
/api/tickets.xml |
/api/wildcard/tickets.xml |
/api/tickets.email |
/api/wildcard/tickets.email |
Also works with extended API endpoints from other plugins (e.g., API Endpoints Plugin)!
The plugin does not use osTicket's signal system directly but overrides API controller logic:
| Mechanism | Class | Purpose |
|---|---|---|
enable() Hook |
ApiKeyWildcardPlugin |
Installs endpoint file and .htaccess rules |
disable() Hook |
ApiKeyWildcardPlugin |
Removes endpoint file and .htaccess changes |
bootstrap() Hook |
ApiKeyWildcardPlugin |
Checks for version mismatch and triggers auto-update |
requireApiKey() Override |
WildcardApiController |
Modified API key validation with 0.0.0.0 support |
Symptoms:
/api/wildcard/tickets.json returns 404wildcard.php in /api/ directoryCheck:
ls /path/to/osticket/api/wildcard.phptail -f /var/log/apache2/error.log/api/Solution: Use manual installation (see installation section above)
Symptoms:
Check:
0.0.0.0/api/wildcard/tickets.json (not /api/tickets.json)X-API-Key: YOUR_KEY must be in requestSolution:
# Correct request:
curl -X POST \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Test","email":"test@test.com","subject":"Test","message":"Test"}' \
http://localhost/osTicket/api/wildcard/tickets.json
Symptoms:
/api/wildcard/tickets.json returns 404.htaccessCheck:
ls -la /path/to/osticket/api/wildcard.php
grep wildcard /path/to/osticket/api/.htaccess
apache2ctl -M | grep rewrite
grep MultiViews /path/to/osticket/api/.htaccess
Solution: Disable/enable plugin to retrigger installation, or install manually.
Symptoms:
wildcard.php in /api/ is still old versionSolution:
sudo systemctl reload php8.1-fpm # PHP-FPM
sudo systemctl reload apache2 # Apache mod_php
enable())Since v2.0, the plugin automatically detects version mismatches during bootstrap and performs auto-updates.
api-key-wildcard/
├── plugin.php # Plugin registration (ID, version, author)
├── class.ApiKeyWildcard.php # Main plugin class + config
├── class.PluginConstants.php # All magic strings centralized
├── class.PluginInstaller.php # File operations (install/uninstall)
├── class.HtaccessManager.php # .htaccess manipulation
├── api.wildcard.inc.php # WildcardApiController (core logic)
├── wildcard.php # API endpoint (copied to /api/)
├── .htaccess # Reference htaccess with wildcard rules
├── CHANGELOG.md # Version history
├── LICENSE # GPL v2
└── README.md # Documentation
Standard API (/api/tickets.json):
// Checks IP address against API key configuration
WHERE apikey = ? AND ipaddr = ? -- Client IP must match exactly
Wildcard API (/api/wildcard/tickets.json):
// Extended check: IP match OR wildcard IP
WHERE apikey = ? AND (ipaddr = ? OR ipaddr = '0.0.0.0')
The remote IP is protected against XSS attacks in the access log using
Format::htmlchars(Format::sanitize())- even with manipulated X-Forwarded-For headers.
Since v2.0, the plugin tracks its installed version via plugin configuration (no longer via .htaccess comments):
bootstrap(): Read installed version from configplugin.php versionperformUpdate()Use separate API keys:
| Environment | IP | Endpoint | Notes |
|---|---|---|---|
| Production | 203.0.113.42 |
/api/tickets.json |
Specific IP, standard endpoint |
| Staging | 0.0.0.0 |
/api/wildcard/tickets.json |
Only behind firewall |
| Development | 0.0.0.0 |
/api/wildcard/tickets.json |
Separate key per developer |
Before deploying to production: Disable plugin (Admin Panel → Plugins → API Key Wildcard → Disable). All wildcard files and .htaccess changes are automatically removed.
Q: Does this plugin modify osTicket core files?
A: No. The plugin creates a separate endpoint and does not modify any core files. Standard API remains unchanged.
Q: Can I use both endpoints simultaneously?
A: Yes. Standard API for production integrations (strict IP), wildcard API for development (flexible IP).
Q: What happens when disabling?
A: The plugin cleanly removes all installed files (/api/wildcard.php) and all .htaccess changes. No manual cleanup needed.
Q: Which PHP versions are supported?
A: PHP 7.4, 8.0, 8.1, 8.2, and 8.3 (tested in CI).
Q: Does this work with NGINX?
A: Yes, but requires manual configuration (see installation section). Apache setup is automatic.
Q: Compatible 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.
Q: What happens if my wildcard API key leaks?
A: Anyone with the key can create tickets from anywhere. Immediately: Disable API key in Admin Panel, create new key, check logs for suspicious activity.
GNU General Public License v2, compatible with osTicket core.
See LICENSE.
Issue Tracker: https://github.com/markus-michalski/osticket-api-key-wildcard/issues
When reporting issues, please include:
php -v)See CHANGELOG.md for full version history.