The API sits beside HESK 3.7.x. It does not patch or replace HESK PHP files. It reads HESK settings and the HESK database, and can send notification mail through HESK’s own email functions when you ask it to.
pdo_mysql, json, mbstring, opensslFallbackResource also works)*_api_* tables)unzip hesk-api-1.4.0.zip
sudo mkdir -p /var/www/hesk-api
sudo rsync -a hesk-api-1.4.0/ /var/www/hesk-api/
sudo chown -R www-data:www-data /var/www/hesk-api/storage
sudo chmod -R ug+rwX /var/www/hesk-api/storage
Adjust the web user (www-data, nginx, apache) to match the host.
cd /var/www/hesk-api
sudo -u www-data php bin/install.php \
--hesk-path=/var/www/hesk \
--api-url=https://api.help.example.com \
--create-token --user=admin --name=Bootstrap
| Flag | Meaning |
|---|---|
--hesk-path | Directory that contains hesk_settings.inc.php |
--api-url | Public URL of this API (no trailing slash) |
--hesk-url | Public HESK URL (defaults to HESK’s own hesk_url) |
--api-prefix | REST prefix, default /v1 |
--utf8mb4 | Optional: convert ticket/reply text columns to utf8mb4 (emoji) |
--create-token | Mint a staff token after schema install |
--force | Overwrite config/config.local.php |
The installer writes config/config.local.php and adds
{prefix}api_tokens and {prefix}api_audit_log.
{prefix} is whatever HESK already uses (hesk_ by default).
Save the bootstrap token when it is printed — it cannot be retrieved later.
Copy deploy/nginx-hesk-api.conf.example, set server_name and
root to …/hesk-api/public, enable the site, reload nginx, then issue TLS.
The document root must be public/. Do not expose
config/, src/, or storage/.
curl -sS https://api.help.example.com/health
You should see "status":"ok" and a version field. Then open /docs (Swagger UI) and /login (staff token portal).
Staff sign in at /login with their HESK staff username and password. Each token inherits that user’s categories, privileges, and admin flag.
php bin/create-token.php --user=admin --name="CI"
Authorization: Bearer hsk_…
X-API-Key: hsk_… is also accepted.
Shipped defaults live in config/config.php. Host overrides go in
config/config.local.php (the installer writes this file).
Environment variables HESK_PATH, HESK_URL, and
HESK_API_URL also override the matching keys.
'hesk_path' => '/var/www/hesk',
'hesk_url' => 'https://help.example.com',
'api_url' => 'https://api.help.example.com',
'api_prefix'=> '/v1',
api_url is rewritten into the live /openapi.json servers list so Swagger “Try it out” hits this install.
'branding' => [
'product_name' => 'HESK API',
'vendor' => 'Your Company',
'vendor_url' => 'https://example.com',
],
'token' => [
'prefix' => 'hsk_',
'secret_bytes' => 32,
'default_ttl_days' => null, // null = never expires
'max_per_user' => 20,
],
'rate_limit' => [
'enabled' => true,
'requests' => 120,
'window_seconds' => 60,
],
Limits are per token (or per IP before a token is presented).
'cors' => [
'allowed_origins' => ['https://app.example.com'], // or ['*']
'allowed_methods' => 'GET, POST, PUT, PATCH, DELETE, OPTIONS',
'allowed_headers' => 'Authorization, Content-Type, X-Requested-With, X-API-Key',
],
'log' => [
'enabled' => true,
'path' => __DIR__ . '/../storage/logs/api.log',
'log_body' => false,
],
'pagination' => [
'default_limit' => 25,
'max_limit' => 100,
],
'debug' => false,
'timezone' => 'UTC',
Leave debug off in production. Never log Authorization or raw bodies.
Taken from HESK (db_pfix). You do not set it in the API config.
The sample vhost uses unix:/run/php/php8.3-fpm.sock. Change the socket
(or use 127.0.0.1:9000) to match the host. Raise
fastcgi_read_timeout if you upload large attachments.
Size, count, and allowed extensions come from HESK attachment settings.
Confirm with GET /v1/attachments/limits. PHP
upload_max_filesize and post_max_size also apply.
HESK 3.7 ships some text columns as utf8mb3. If ticket create fails on 4-byte UTF-8:
php bin/install.php --hesk-path=… --api-url=… --force --utf8mb4
or apply sql/utf8mb4-message-columns.sql (prefix-aware via the installer).
Document root = public/. Enable mod_rewrite and:
FallbackResource /index.php
or an equivalent rewrite of all non-files to index.php.
config/config.local.php (and anything you added under storage/) into the new tree.php bin/install-schema.php — it is safe to re-run (CREATE TABLE IF NOT EXISTS).Do not overwrite config.local.php with the example file.
Remove the vhost and the API directory. Drop
{prefix}api_tokens and {prefix}api_audit_log if you want
the database clean. HESK itself is unchanged.