Skip to content

API reference

Databases, SSL and logs

Databases and backups, certificates, logs and errors, performance, status pages and usage.

Databases and backups

Databases, users, queries, imports, backups and off-site copies.

GET /api/sites/{id}/database/backups

List database backups

Lists the *.sql.gz files in the site's <rootPath>/backups directory on the site's server (local disk or over SSH for remote servers), newest first. createdAt is the file modification time.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • Any error reading the directory (missing folder, SSH failure) returns {"backups": []} with status 200.
  • Only files ending in .sql.gz are listed.
  • Backups created by POST /database/backup are named "<DB_DATABASE>_<YYYY-MM-DDTHH-MM-SS>.sql.gz" (UTC, e.g. shop_2026-11-27T10-00-00.sql.gz). Scheduled backups (scripts/backup.sh) are named "<DB_DATABASE>_<YYYYMMDDHHMMSS>.sql.gz" in the server's local time and the script keeps only the 30 newest *.sql.gz files.
cURL
curl "https://panel.example.com/api/sites/12/database/backups" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "backups": [
        {
            "name": "shop_2026-11-27T10-00-00.sql.gz",
            "sizeBytes": 5242880,
            "createdAt": "2026-11-27T10:00:00.000Z"
        },
        {
            "name": "shop_20261126020000.sql.gz",
            "sizeBytes": 5110000,
            "createdAt": "2026-11-26T02:00:04.000Z"
        }
    ]
}
POST /api/sites/{id}/database/backup

Create a database backup

Runs mysqldump for the database named in the site's shared/.env (DB_DATABASE, DB_USERNAME, DB_PASSWORD) and gzips it into <rootPath>/backups/<DB_DATABASE>_<UTC timestamp>.sql.gz on the site's server. The request waits until the dump has finished.

  • Token or session
  • Admin ยท Developer
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

400
Cannot read database credentials. shared/.env cannot be read. The body also has "details": "No shared/.env found at <rootPath>/shared/.env โ€” configure it in the Config tab first."
400
DB_DATABASE is not set in .env shared/.env has no DB_DATABASE value.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
500
mysqldump failed mysqldump/gzip exited non-zero or timed out; "details" holds stderr or the error message. The partial file is deleted.
  • Filename rule: "<DB_DATABASE>_" + new Date().toISOString() with ":" and "." replaced by "-", cut to 19 characters โ†’ e.g. shop_2026-11-27T10-00-00.sql.gz (UTC).
  • The dump runs through the shared exec helper with its default 30-second timeout (local and over SSH); a dump that takes longer is killed and the request returns 500 "mysqldump failed".
  • sizeHuman uses B / KB / MB with one decimal (1024-based).
  • No audit entry is written.
  • Send the POST without a JSON Content-Type header (no body) โ€” Fastify rejects an empty body declared as application/json.
cURL
curl -X POST "https://panel.example.com/api/sites/12/database/backup" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true,
    "filename": "shop_2026-11-27T10-00-00.sql.gz",
    "sizeBytes": 5242880,
    "sizeHuman": "5.0 MB",
    "createdAt": "2026-11-27T10:00:00.000Z"
}
GET /api/sites/{id}/database/backups/{filename}

Download a database backup

Streams one backup file from <rootPath>/backups as a gzip download. For remote servers the file is streamed over SSH with cat.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.
filename stringrequired
Backup file name as returned by the list endpoint (URL-encode it).pattern ^[\w\-]+\.sql\.gz$ (letters, digits, underscore, hyphen, then .sql.gz; no dots, slashes or spaces before the extension)

Errors

400
Invalid filename filename does not match ^[\w\-]+\.sql\.gz$.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Backup file not found No regular file with this name in <rootPath>/backups.
404
Site not found No site with this id.
  • Response headers: Content-Type: application/gzip, Content-Disposition: attachment; filename="<filename>". Content-Length is set only for sites on the local server; remote downloads are streamed without it.
  • The filename check is stricter than the list: a listed backup whose name contains a dot or other character before .sql.gz cannot be downloaded, restored or deleted.
cURL
curl "https://panel.example.com/api/sites/12/database/backups/shop_db_2026-11-27T03-00-00.sql.gz" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/gzip

The raw .sql.gz file, sent with Content-Disposition: attachment; filename="<filename>".

POST /api/sites/{id}/database/backups/{filename}/restore

Restore a database backup

Destructive: replays a backup file into the site's database (DB_DATABASE from shared/.env) with the site's own DB credentials. Local sites stream the gunzipped file into mysql; remote sites run zcat | mysql on their own host over SSH.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: database.restored

Path parameters

id integerrequired
Site id.
filename stringrequired
Backup file name in <rootPath>/backups (URL-encode it).pattern ^[\w\-]+\.sql\.gz$ (letters, digits, underscore, hyphen, then .sql.gz; no dots, slashes or spaces before the extension)

Errors

400
Cannot read database credentials from shared/.env. shared/.env missing or has no DB_DATABASE.
400
Invalid filename filename does not match ^[\w\-]+\.sql\.gz$.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Backup file not found No regular file with this name in <rootPath>/backups.
404
Site not found No site with this id.
500
Restore failed mysql exited non-zero (or the remote command timed out); "details" holds up to 2000 chars of stderr.
  • The request waits for the restore to finish. Local restores have no timeout; remote restores use the shared exec helper's default 30-second SSH timeout, so a large remote restore can fail with 500 "Restore failed".
  • There is no confirmation step and no automatic backup before restoring.
  • Audit meta: { domain, filename }.
cURL
curl -X POST "https://panel.example.com/api/sites/12/database/backups/shop_db_2026-11-27T03-00-00.sql.gz/restore" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true,
    "filename": "shop_2026-11-27T10-00-00.sql.gz"
}
GET /api/sites/{id}/database/backup-schedule

Get the backup schedule

Reads the site's backup cron file (/etc/cron.d/<domain with dots replaced by hyphens>-backup) on the site's server and returns its time. active is false when the file does not exist.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • When the cron file cannot be read the response is { active: false, hour: 2, minute: 0, days: "*", cronPath }.
  • days is the cron day-of-week field as written (e.g. "*", "1-5", "0,6").
cURL
curl "https://panel.example.com/api/sites/12/database/backup-schedule" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "active": true,
    "hour": 2,
    "minute": 0,
    "days": "*",
    "cronPath": "/etc/cron.d/shop-example-com-backup"
}
PUT /api/sites/{id}/database/backup-schedule

Set the backup schedule

Writes /etc/cron.d/<domain-with-hyphens>-backup on the site's server so scripts/backup.sh runs as www-data at the given time and days, logging to /var/log/orchestrator/backup.log. Also syncs the panel scripts to the server first.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: backup.schedule_enabled

Path parameters

id integerrequired
Site id.

Body

hour integerrequired
Hour of day (server time).0โ€“23
minute integer
Minute of the hour.0โ€“59, default 0
days string
Cron day-of-week field.pattern ^[0-7,\-\*]+$, default "*"

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
  • Cron line: "<minute> <hour> * * <days> www-data bash \"<scriptsDir>/backup.sh\" \"<rootPath>\" >> /var/log/orchestrator/backup.log 2>&1".
  • The scheduled script names files "<DB_DATABASE>_<YYYYMMDDHHMMSS>.sql.gz" and deletes all but the 30 newest *.sql.gz backups in <rootPath>/backups (manual backups count towards the 30).
  • Unknown body fields are silently removed (additionalProperties: false).
  • Audit meta: { domain, hour, minute, days }.
cURL
curl -X PUT "https://panel.example.com/api/sites/12/database/backup-schedule" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "hour": 3,
    "minute": 30,
    "days": "1-5"
}'
200Response ยท application/json
{
    "ok": true,
    "cronPath": "/etc/cron.d/shop-example-com-backup",
    "hour": 3,
    "minute": 30,
    "days": "1-5"
}
DELETE /api/sites/{id}/database/backup-schedule

Disable scheduled backups

Deletes the site's backup cron file on its server. Existing backup files are kept.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: backup.schedule_disabled

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
  • The audit entry is written without the calling user (userId null). Meta: { domain }.
  • Deleting a missing cron file is not an error.
cURL
curl -X DELETE "https://panel.example.com/api/sites/12/database/backup-schedule" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}
DELETE /api/sites/{id}/database/backups/{filename}

Delete a database backup

Deletes one backup file from <rootPath>/backups on the site's server.

  • Token or session
  • Admin ยท Developer
  • Needs site access

Path parameters

id integerrequired
Site id.
filename stringrequired
Backup file name (URL-encode it).pattern ^[\w\-]+\.sql\.gz$ (letters, digits, underscore, hyphen, then .sql.gz; no dots, slashes or spaces before the extension)

Errors

400
Invalid filename filename does not match ^[\w\-]+\.sql\.gz$.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Backup file not found No regular file with this name in <rootPath>/backups.
404
Site not found No site with this id.
  • No audit entry is written.
  • Copies uploaded to S3/R2 are not affected.
cURL
curl -X DELETE "https://panel.example.com/api/sites/12/database/backups/shop_db_2026-11-27T03-00-00.sql.gz" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}
GET /api/sites/{id}/databases

List site databases

Lists the MySQL databases recorded for the site: the primary one (created at provisioning, credentials in shared/.env) first, then secondary ones in creation order. Passwords are never returned.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

400
Database management (phpMyAdmin, users, import) is not yet available for sites on remote servers. Use the Backups tab, or manage the database directly on that server. The site is placed on a remote server (serverId set). Checked before the handler runs.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • Every route in this file first refuses sites on a remote server with 400 (the routes talk to MySQL on the panel host at 127.0.0.1).
cURL
curl "https://panel.example.com/api/sites/12/databases" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "databases": [
        {
            "id": 3,
            "siteId": 12,
            "dbName": "shop",
            "dbUser": "shop",
            "isPrimary": true,
            "createdAt": "2026-10-01T09:00:00.000Z"
        },
        {
            "id": 7,
            "siteId": 12,
            "dbName": "shop_reports",
            "dbUser": "shop_reports",
            "isPrimary": false,
            "createdAt": "2026-11-27T10:00:00.000Z"
        }
    ]
}
POST /api/sites/{id}/databases

Create a database

Creates a secondary MySQL database and user on the panel host using the MySQL root credentials from Settings, with a generated 28-character password, and grants the user ALL PRIVILEGES on it for both 'localhost' and '127.0.0.1'. The password is stored encrypted and never returned.

  • Token or session
  • Admin
  • Needs site access
  • Audit: database.created

Path parameters

id integerrequired
Site id.

Body

dbName stringrequired
Database name (unique across the panel).1โ€“64 chars, pattern ^[a-zA-Z0-9_]+$
dbUser stringrequired
MySQL user to create (or update) for it.1โ€“32 chars, pattern ^[a-zA-Z0-9_]+$

Errors

400
Database management (phpMyAdmin, users, import) is not yet available for sites on remote servers. Use the Backups tab, or manage the database directly on that server. The site is placed on a remote server (serverId set). Checked before the handler runs.
400
MySQL root credentials not configured. Setting mysql_root_user is empty. "details": "Set mysql_root_user and mysql_root_password in Settings first."
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
409
Database "<dbName>" already exists. A SiteDatabase with this dbName exists (on any site).
500
Failed to create database A MySQL statement failed; "details" holds the MySQL error message.
  • Every route in this file first refuses sites on a remote server with 400 (the routes talk to MySQL on the panel host at 127.0.0.1).
  • Uses CREATE ... IF NOT EXISTS and then ALTER USER: if the MySQL user already exists, its password is reset to the new generated one.
  • Audit meta: { dbName, dbUser }.
cURL
curl -X POST "https://panel.example.com/api/sites/12/databases" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "dbName": "shop_reports",
    "dbUser": "shop_reports"
}'
201Response ยท application/json
{
    "id": 7,
    "siteId": 12,
    "dbName": "shop_reports",
    "dbUser": "shop_reports",
    "isPrimary": false,
    "createdAt": "2026-11-27T10:00:00.000Z"
}
DELETE /api/sites/{id}/databases/{dbId}

Drop a database

Destructive: drops a secondary database and its MySQL user (both 'localhost' and '127.0.0.1' hosts) using the MySQL root credentials, then deletes the record. The primary database cannot be deleted.

  • Token or session
  • Admin
  • Needs site access
  • Audit: database.deleted

Path parameters

id integerrequired
Site id.
dbId integerrequired
SiteDatabase id (from GET /api/sites/{id}/databases). Must belong to the site.

Errors

400
Cannot delete the primary database. The database is the site's primary one.
400
Database management (phpMyAdmin, users, import) is not yet available for sites on remote servers. Use the Backups tab, or manage the database directly on that server. The site is placed on a remote server (serverId set). Checked before the handler runs.
400
MySQL root credentials not configured. Setting mysql_root_user is empty.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Database not found No database with this dbId on this site.
500
Failed to drop database A MySQL statement failed; "details" holds the MySQL error message.
  • Every route in this file first refuses sites on a remote server with 400 (the routes talk to MySQL on the panel host at 127.0.0.1).
  • The site itself is not looked up โ€” a missing site gives 404 "Database not found".
  • Audit meta: { dbName }.
cURL
curl -X DELETE "https://panel.example.com/api/sites/12/databases/2" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}
POST /api/sites/{id}/databases/{dbId}/query

Run a SQL query

Runs one SQL statement against the database with that database's own credentials (primary: shared/.env; secondary: its stored generated password) and returns up to 1000 rows. Only SELECT, INSERT, UPDATE, DELETE, EXPLAIN, SHOW, DESCRIBE/DESC and WITH statements are accepted.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • โฑ 30 per minute per IP
  • Audit: db.query

Path parameters

id integerrequired
Site id.
dbId integerrequired
SiteDatabase id (from GET /api/sites/{id}/databases). Must belong to the site.

Body

sql stringrequired
The SQL statement.1โ€“10000 chars; must start with SELECT, INSERT, UPDATE, DELETE, EXPLAIN, SHOW, DESCRIBE, DESC or WITH (case-insensitive, after comments are stripped)

Errors

400
<TYPE> statements are not permitted. Only SELECT, INSERT, UPDATE, DELETE, EXPLAIN, SHOW, DESCRIBE are allowed. A statement starts with DROP, CREATE, ALTER, TRUNCATE, GRANT, REVOKE, RENAME, SET, FLUSH, LOAD, LOCK, UNLOCK, CALL, EXEC, EXECUTE, REPLACE, USE, XA, KILL, PURGE, RESET or SOURCE (<TYPE> is its first word, upper-cased).
400
Cannot read database credentials from shared/.env Primary database and shared/.env cannot be read.
400
Database management (phpMyAdmin, users, import) is not yet available for sites on remote servers. Use the Backups tab, or manage the database directly on that server. The site is placed on a remote server (serverId set). Checked before the handler runs.
400
Empty query. Nothing left after stripping -- and /* */ comments.
400
Query failed MySQL rejected the statement, it timed out, or the connection failed. Body also has "details" (MySQL message) and "code" (MySQL error code, e.g. ER_PARSE_ERROR).
400
SELECT โ€ฆ INTO OUTFILE/DUMPFILE is not permitted. A statement contains INTO OUTFILE or INTO DUMPFILE.
400
Unrecognized or disallowed statement type. A statement does not start with an allowed keyword.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Database not found No database with this dbId on this site.
404
Site not found No site with this id.
429
Rate limit exceeded, retry in โ€ฆ Too many requests โ€” see the Retry-After header.
  • Allowed statement types: SELECT, INSERT, UPDATE, DELETE, EXPLAIN, SHOW, DESCRIBE, DESC, WITH.
  • Blocked statement types: DROP, CREATE, ALTER, TRUNCATE, GRANT, REVOKE, RENAME, SET, FLUSH, LOAD, LOCK, UNLOCK, CALL, EXEC, EXECUTE, REPLACE, USE, XA, KILL, PURGE, RESET, SOURCE; plus any statement containing INTO OUTFILE / INTO DUMPFILE.
  • Validation splits the text on ";" and checks every part, but the query is sent with multipleStatements disabled (as a prepared statement), so more than one statement fails with 400 "Query failed".
  • Limits: 10,000 characters of SQL, 30-second query timeout, 10-second connect timeout, at most 1000 rows returned (truncated is true when the result had more). rowCount is the number of rows returned, not the total.
  • Write statements (INSERT/UPDATE/DELETE) return columns: [] and rows: [] โ€” affected-row counts are not reported.
  • Writes are not blocked: INSERT, UPDATE and DELETE run for real. Viewers cannot call it (POST).
  • Audit meta: { dbName, sql (first 200 chars) }. Written only for successful queries.
  • Every route in this file first refuses sites on a remote server with 400 (the routes talk to MySQL on the panel host at 127.0.0.1).
cURL
curl -X POST "https://panel.example.com/api/sites/12/databases/2/query" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sql": "SELECT id, email FROM users ORDER BY id DESC LIMIT 2"
}'
200Response ยท application/json
{
    "columns": [
        "id",
        "email"
    ],
    "rows": [
        [
            42,
            "[email protected]"
        ],
        [
            41,
            "[email protected]"
        ]
    ],
    "rowCount": 2,
    "truncated": false,
    "elapsedMs": 4
}
POST /api/sites/{id}/databases/{dbId}/import

Import a SQL dump

Imports an uploaded .sql or .sql.gz file into the database with the MySQL root credentials (multipart/form-data upload). The file is buffered to a temp file, piped into mysql (zcat first for .gz), then deleted. The request waits until the import has finished.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • โฑ 5 per minute per IP
  • Audit: db.import

Path parameters

id integerrequired
Site id.
dbId integerrequired
SiteDatabase id (from GET /api/sites/{id}/databases). Must belong to the site.

Form data (multipart)

file filerequired
The dump file. The first file part is used whatever its field name (the web client sends "file").file name must end in .sql or .gz (.sql.gz); max 512 MB

Errors

400
Database management (phpMyAdmin, users, import) is not yet available for sites on remote servers. Use the Backups tab, or manage the database directly on that server. The site is placed on a remote server (serverId set). Checked before the handler runs.
400
MySQL root credentials not configured. Setting mysql_root_user is empty.
400
No file uploaded. The request is not multipart/form-data or has no file part.
400
Only .sql and .sql.gz files are supported. The uploaded file name does not end in .sql or .gz.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is neither admin nor developer.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Database not found No database with this dbId on this site.
404
Site not found No site with this id.
429
Rate limit exceeded, retry in โ€ฆ Too many requests โ€” see the Retry-After header.
500
Import failed mysql/zcat failed, the 30-minute timeout was hit, or the upload exceeded 512 MB; "details" holds up to 2000 chars of stderr or the error message.
  • Content-Type must be multipart/form-data (let the HTTP client set the boundary). Example: curl -H "Authorization: Bearer orch_โ€ฆ" -F "[email protected]" https://panel.example.com/api/sites/12/databases/3/import
  • Any file name ending in ".gz" is treated as gzip; ".sql" as plain SQL. The content itself is not checked.
  • Upload limit 512 MB (global multipart fileSize limit). The whole file is held in memory before it is written to the temp file.
  • Import timeout 30 minutes. Runs as the MySQL root user from Settings, not the database's own user, so the dump can contain any statement (no SQL allow-list here).
  • Audit meta: { dbName, filename }.
  • Every route in this file first refuses sites on a remote server with 400 (the routes talk to MySQL on the panel host at 127.0.0.1).
cURL
curl -X POST "https://panel.example.com/api/sites/12/databases/2/import" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -F "[email protected]"
200Response ยท application/json
{
    "ok": true,
    "warnings": null
}
POST /api/sites/{id}/databases/{dbId}/pma-session

Open phpMyAdmin for a database

Issues a single-use phpMyAdmin sign-on link for one database. The URL carries an opaque token; phpMyAdmin's signon bridge redeems it over a loopback call for the real credentials, so the MySQL password never reaches the browser.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: database.pma_session_created

Path parameters

id integerrequired
Site id.
dbId integerrequired
SiteDatabase id (from GET /api/sites/{id}/databases). Must belong to the site.

Errors

400
Cannot resolve database credentials. Primary database and shared/.env cannot be read.
400
Database management (phpMyAdmin, users, import) is not yet available for sites on remote servers. Use the Backups tab, or manage the database directly on that server. The site is placed on a remote server (serverId set). Checked before the handler runs.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Database not found No database with this dbId on this site.
404
Site not found No site with this id.
503
phpMyAdmin SSO is not configured on this server. PMA_BASE_URL or PMA_BRIDGE_SECRET is not set in the API environment. "details": "Set PMA_BASE_URL and PMA_BRIDGE_SECRET in the API environment."
  • The token is single-use and expires after 60 seconds (kept in memory; lost on API restart). Open the URL right away.
  • The 503 configuration check runs before the site lookup.
  • Audit meta: { dbName }.
  • Every route in this file first refuses sites on a remote server with 400 (the routes talk to MySQL on the panel host at 127.0.0.1).
cURL
curl -X POST "https://panel.example.com/api/sites/12/databases/2/pma-session" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "url": "https://pma.example.com/signon.php?token=4f9c2a7e1b8d3c6f"
}
POST /api/sites/{siteId}/database/backup/s3/{filename}

Upload a backup to S3

Reads a backup file from the site's <rootPath>/backups (local disk, or over SSH for remote servers) and uploads it to the configured S3/R2 bucket under the key backups/<domain>/<filename>.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: backup.uploaded_s3

Path parameters

siteId integerrequired
Site id.
filename stringrequired
Backup file name in <rootPath>/backups.pattern ^[\w._-]+\.sql(\.gz)?$

Errors

400
Invalid filename filename does not match ^[\w._-]+\.sql(\.gz)?$.
400
S3/R2 credentials not configured. Set them in Settings โ†’ S3 Backup. s3_access_key, s3_secret_key or s3_bucket is not set.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
500
<error message> Reading the file failed (remote: "Backup not found on remote host") or the S3 upload failed; the error is the raw message.
  • The whole file is read into memory and uploaded with one PutObject (Content-Type application/octet-stream); an existing object with the same key is overwritten.
  • The audit entry is written without the calling user (userId null). Meta: { filename, key }.
  • S3/R2 settings come from Settings keys s3_access_key, s3_secret_key, s3_region (default "auto"), s3_bucket, s3_endpoint (when set, path-style addressing is used).
  • The path parameter is named siteId in this file (not id).
cURL
curl -X POST "https://panel.example.com/api/sites/12/database/backup/s3/shop_db_2026-11-27T03-00-00.sql.gz" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true,
    "key": "backups/shop.example.com/shop_2026-11-27T10-00-00.sql.gz",
    "bucket": "orchestrator-backups"
}
GET /api/sites/{siteId}/database/backup/s3

List S3 backups

Lists the objects under backups/<domain>/ in the configured S3/R2 bucket, newest first. When S3 is not configured it returns an empty list with configured: false.

  • Token or session
  • Any role
  • Needs site access

Path parameters

siteId integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
500
<error message> The S3 list call failed; the error is the raw SDK message.
  • When s3_access_key or s3_bucket is missing the response is { files: [], configured: false } (no bucket field).
  • Uses a single ListObjectsV2 call, so at most 1000 objects are returned (no pagination).
  • S3/R2 settings come from Settings keys s3_access_key, s3_secret_key, s3_region (default "auto"), s3_bucket, s3_endpoint (when set, path-style addressing is used).
cURL
curl "https://panel.example.com/api/sites/12/database/backup/s3" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "files": [
        {
            "key": "backups/shop.example.com/shop_2026-11-27T10-00-00.sql.gz",
            "filename": "shop_2026-11-27T10-00-00.sql.gz",
            "sizeBytes": 5242880,
            "lastModified": "2026-11-27T10:01:00.000Z"
        }
    ],
    "configured": true,
    "bucket": "orchestrator-backups"
}
DELETE /api/sites/{siteId}/database/backup/s3/{key}

Delete an S3 backup

Deletes one object from the S3/R2 bucket. The key is everything after /s3/ in the URL (a wildcard, slashes included) and must start with this site's prefix backups/<domain>/.

  • Token or session
  • Admin ยท Developer
  • Needs site access

Path parameters

siteId integerrequired
Site id.
key stringrequired
Full object key as returned by the list endpoint, e.g. backups/shop.example.com/shop_2026-11-27T10-00-00.sql.gz. Declared as a Fastify wildcard (*), so it may contain slashes.must start with backups/<site domain>/ and must not contain ".."

Errors

400
S3/R2 not configured s3_access_key or s3_bucket is not set.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
403
Key is outside this site's backup prefix The key is empty, does not start with backups/<domain>/ or contains "..".
404
Site not found No site with this id.
500
<error message> The S3 delete call failed; the error is the raw SDK message.
  • In Fastify the route is declared as /:siteId/database/backup/s3/*; the OpenAPI {key} stands for the wildcard. Send the slashes literally (the web client does not encode them).
  • No audit entry is written.
  • S3/R2 settings come from Settings keys s3_access_key, s3_secret_key, s3_region (default "auto"), s3_bucket, s3_endpoint (when set, path-style addressing is used).
cURL
curl -X DELETE "https://panel.example.com/api/sites/12/database/backup/s3/nginx" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}

SSL

Letโ€™s Encrypt certificates and hostnames.

GET /api/sites/{id}/ssl

Get certificate status

Runs certbot certificates --cert-name <domain> on the site's server and returns the certificate's expiry, issuer and names, plus the site's sslEnabled flag and whether a certbot run is in progress.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • When no certificate is found: active false, expiresAt/issuer/daysLeft null, domains [].
  • expiresAt is certbot's own "Expiry Date" text (not ISO 8601). issuer is parsed from an "Issuer:" line, which certbot certificates normally does not print, so it is usually null. daysLeft is floored and never below 0.
cURL
curl "https://panel.example.com/api/sites/12/ssl" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "active": true,
    "expiresAt": "2027-02-25 10:00:00+00:00",
    "issuer": null,
    "daysLeft": 90,
    "domains": [
        "shop.example.com",
        "www.shop.example.com"
    ],
    "sslEnabled": true,
    "running": false
}
POST /api/sites/{id}/ssl

Issue a certificate

Starts certbot --nginx for the site's domain (plus www.<domain> when that name resolves in DNS) with --expand, --agree-tos and --redirect. On success the site's sslEnabled flag is set to true.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: ssl.issued

Path parameters

id integerrequired
Site id.

Errors

400
Site must be active before issuing SSL. Site status is not "active".
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
409
Certbot is already running for this site. Another certbot run for this site is in progress.
  • The call returns immediately; certbot keeps running in the background. Follow its output with GET /api/sites/{id}/ssl/stream.
  • Audit is written when certbot exits, without the calling user: "ssl.issued" on success, "ssl.issue_failed" otherwise. Meta: { domain }.
  • The Let's Encrypt account email is the notify_email setting when it looks valid (not localhost/.local/.internal/.test/.invalid); otherwise certbot registers without an email.
  • Only one certbot run per site at a time (in-memory lock shared by issue, renew, remove and the host add/remove routes); the lock and log are lost on API restart.
  • Send the POST without a JSON Content-Type header (no body).
cURL
curl -X POST "https://panel.example.com/api/sites/12/ssl" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "started": true
}
POST /api/sites/{id}/ssl/renew

Force-renew the certificate

Starts certbot renew --cert-name <domain> --force-renewal on the site's server.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: ssl.renewed

Path parameters

id integerrequired
Site id.

Errors

400
SSL is not enabled for this site. The site's sslEnabled flag is false.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
409
Certbot is already running for this site. Another certbot run for this site is in progress.
  • The call returns immediately; certbot keeps running in the background. Follow its output with GET /api/sites/{id}/ssl/stream.
  • Audit is written when certbot exits, without the calling user: "ssl.renewed" on success, "ssl.renew_failed" otherwise. Meta: { domain }.
  • Repeated forced renewals count against Let's Encrypt rate limits.
  • Only one certbot run per site at a time (in-memory lock shared by issue, renew, remove and the host add/remove routes); the lock and log are lost on API restart.
cURL
curl -X POST "https://panel.example.com/api/sites/12/ssl/renew" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "started": true
}
DELETE /api/sites/{id}/ssl

Delete the certificate

Runs certbot delete --cert-name <domain> on the site's server (best-effort: failures are ignored) and sets the site's sslEnabled flag to false. The call waits for certbot.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: ssl.removed

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
409
Certbot is already running for this site. Another certbot run for this site is in progress.
  • The certificate is deleted, not revoked at Let's Encrypt. The nginx vhost is not rewritten by this route.
  • Always returns { ok: true } once the site exists, even when certbot failed.
  • The audit entry is written without the calling user. Meta: { domain }.
cURL
curl -X DELETE "https://panel.example.com/api/sites/12/ssl" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}
GET /api/sites/{id}/ssl/hosts

List hostnames and coverage

Lists every hostname of the site's nginx vhost (primary domain first, then vhost order, then names that are only on the certificate) with whether nginx serves it, over HTTPS, with which certificate, whether the certificate covers it and whether it resolves in DNS.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • cert is "site" (the server block uses /live/<domain>/ certificate), "other" (another certificate) or "none".
  • dns is true when the name has an A, AAAA or CNAME record (looked up from the panel host). Wildcard / regex server_names are skipped.
  • The vhost read is /etc/nginx/sites-available/<domain>; an unreadable vhost gives an empty block list.
cURL
curl "https://panel.example.com/api/sites/12/ssl/hosts" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "certActive": true,
    "certName": "shop.example.com",
    "running": false,
    "hosts": [
        {
            "host": "shop.example.com",
            "primary": true,
            "inNginx": true,
            "https": true,
            "cert": "site",
            "covered": true,
            "dns": true
        },
        {
            "host": "admin.shop.example.com",
            "primary": false,
            "inNginx": true,
            "https": false,
            "cert": "none",
            "covered": false,
            "dns": true
        }
    ]
}
POST /api/sites/{id}/ssl/hosts/add

Add a hostname to the certificate

Re-issues the site's certificate (cert name = site domain) with one more hostname via certbot --nginx --cert-name <domain> -d โ€ฆ --redirect. The hostname must already be in a server_name of the site's vhost and resolve in DNS.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: ssl.host_added

Path parameters

id integerrequired
Site id.

Body

host stringrequired
Hostname (trimmed and lower-cased before use).3โ€“253 chars; must be a plain fully-qualified hostname (no wildcard)

Errors

400
A certificate can cover at most 100 hostnames. The resulting name list is longer than 100.
400
Invalid hostname. host is not a plain fully-qualified hostname.
400
Issue the site certificate first, then add hostnames to it. The site has no active certificate.
400
Site must be active before issuing SSL. Site status is not "active".
400
The certificate already covers this hostname. host is already on the certificate.
400
This hostname does not resolve in DNS yet. Create its DNS record, wait until it is live, then try again. host has no A, AAAA or CNAME record.
400
This hostname is not in the site's nginx config. Add it to a server_name line first (Config tab). No server block of the vhost lists host.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
409
Certbot is already running for this site. Another certbot run for this site is in progress.
409
The server block of this hostname uses a different certificate. Point it at the site certificate in the nginx config first. The host's server block uses another certificate.
409
This certificate contains wildcard names and was not issued by the panel. Manage its hostnames with certbot on the server. The certificate holds a wildcard or other non-plain name.
500
Could not start certbot. Spawning certbot failed; "details" holds the error message.
  • The call returns immediately; certbot keeps running in the background. Follow its output with GET /api/sites/{id}/ssl/stream.
  • Audit is written when certbot exits, with the calling user: "ssl.host_added" on success, "ssl.host_change_failed" otherwise. Meta: { domain, host, action, names }.
  • Before certbot runs, the current vhost is saved to the config history (kind nginx); on success the vhost certbot leaves behind is saved too (note: SSL change).
  • On success the site's sslEnabled flag is set to true.
  • The first stream line is the command echo "$ certbot --nginx --cert-name <domain> -d <name> โ€ฆ".
  • Declared in a loop over ["add", "remove"] at routes/ssl.ts:295-296.
  • Only one certbot run per site at a time (in-memory lock shared by issue, renew, remove and the host add/remove routes); the lock and log are lost on API restart.
cURL
curl -X POST "https://panel.example.com/api/sites/12/ssl/hosts/add" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "host": "admin.shop.example.com"
}'
200Response ยท application/json
{
    "started": true,
    "names": [
        "shop.example.com",
        "www.shop.example.com",
        "admin.shop.example.com"
    ]
}
POST /api/sites/{id}/ssl/hosts/remove

Remove a hostname from the certificate

Re-issues the site's certificate (cert name = site domain) without one hostname via certbot --nginx --cert-name <domain> -d โ€ฆ. The site's main domain cannot be removed.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: ssl.host_removed

Path parameters

id integerrequired
Site id.

Body

host stringrequired
Hostname (trimmed and lower-cased before use).3โ€“253 chars; must be a plain fully-qualified hostname (no wildcard)

Errors

400
A certificate can cover at most 100 hostnames. The resulting name list is longer than 100.
400
Invalid hostname. host is not a plain fully-qualified hostname.
400
Issue the site certificate first, then add hostnames to it. The site has no active certificate.
400
Site must be active before issuing SSL. Site status is not "active".
400
The certificate does not cover this hostname. host is not on the certificate.
400
The site's main domain cannot be removed from its certificate. host equals the site's domain.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
409
Certbot is already running for this site. Another certbot run for this site is in progress.
409
This certificate contains wildcard names and was not issued by the panel. Manage its hostnames with certbot on the server. The certificate holds a wildcard or other non-plain name.
500
Could not start certbot. Spawning certbot failed; "details" holds the error message.
  • The call returns immediately; certbot keeps running in the background. Follow its output with GET /api/sites/{id}/ssl/stream.
  • Audit is written when certbot exits, with the calling user: "ssl.host_removed" on success, "ssl.host_change_failed" otherwise. Meta: { domain, host, action, names }.
  • Before certbot runs, the current vhost is saved to the config history (kind nginx); on success the vhost certbot leaves behind is saved too (note: SSL change).
  • On success the site's sslEnabled flag is set to true.
  • The first stream line is the command echo "$ certbot --nginx --cert-name <domain> -d <name> โ€ฆ".
  • Declared in a loop over ["add", "remove"] at routes/ssl.ts:295-296.
  • Only one certbot run per site at a time (in-memory lock shared by issue, renew, remove and the host add/remove routes); the lock and log are lost on API restart.
cURL
curl -X POST "https://panel.example.com/api/sites/12/ssl/hosts/remove" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "host": "admin.shop.example.com"
}'
200Response ยท application/json
{
    "started": true,
    "names": [
        "shop.example.com",
        "www.shop.example.com"
    ]
}
GET /api/sites/{id}/ssl/stream

Stream certbot output

Server-Sent Events stream of the site's current certbot run (issue, renew, host add/remove). Buffered output is replayed first, then live lines follow until certbot exits.

  • Token or session
  • Any role
  • Needs site access
  • Server-Sent Events

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
  • Events (all unnamed, data only): {"line": "<raw certbot stdout/stderr chunk>"} for output (a chunk may contain several lines or a partial line); {"done": true, "status": "success" | "failed"} when certbot exits โ€” the server then closes the stream.
  • When no certbot run is in progress, the stream replays the log of the last run (kept 10 minutes after it ended) and then sends {"done": true, "status": "unknown"} and closes. The real final status of a finished run is not repeated.
  • A comment line ": ka" is sent every 20 seconds as keep-alive. Headers: Cache-Control: no-cache, X-Accel-Buffering: no.
  • The site id is not checked for existence (no 404).
  • Authenticate with the Authorization header (the web client uses fetch with a Bearer token, not EventSource), so personal access tokens work.
cURL
curl -N "https://panel.example.com/api/sites/12/ssl/stream" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท text/event-stream

SSE stream; each event is a "data: <JSON>" line.

Logs and errors

Laravel logs and grouped errors.

GET /api/sites/{id}/logs

Read the Laravel log

Reads the last ~2 MB of <rootPath>/shared/logs/laravel.log (falling back to <rootPath>/current/storage/logs/laravel.log) on the site's server, splits it into entries at each "[YYYY-MM-DD" line and returns them newest first, optionally filtered by level and text.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Query parameters

level string
Only entries with this level (case-insensitive), e.g. error, warning, info.exact match against the parsed level; "unknown" matches unparseable entries
search string
Only entries whose message contains this text (case-insensitive).
lines integer
How many of the newest entries to consider.default 500, max 2000

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • Filters are applied after taking the newest `lines` entries, so total is the number of matches among those entries, not in the whole file.
  • An entry whose header cannot be parsed is returned as { timestamp: null, environment: null, level: "unknown", message }. message includes the stack trace lines.
  • When neither log file can be read the response is { entries: [], total: 0, path: <shared log path> }.
  • A non-numeric lines value makes the result empty (entries: []).
  • The tail is read through the shared exec helper whose output buffer is 1 MB; as written, a log file larger than about 1 MB exceeds that buffer, the read fails and the endpoint falls back to the other path or returns no entries (not verified at runtime).
cURL
curl "https://panel.example.com/api/sites/12/logs" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "entries": [
        {
            "timestamp": "2026-11-27 10:00:00",
            "environment": "production",
            "level": "error",
            "message": "SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `id` = 42) {\"exception\":\"[object] (Illuminate\\\\Database\\\\QueryException(code: 2002): โ€ฆ\"}"
        }
    ],
    "total": 1,
    "path": "/var/www/shop.example.com/shared/logs/laravel.log"
}
DELETE /api/sites/{id}/logs

Clear the Laravel log

Truncates <rootPath>/shared/logs/laravel.log to an empty file on the site's server (or, if that write fails, <rootPath>/current/storage/logs/laravel.log).

  • Token or session
  • Admin ยท Developer
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
  • The write creates the file (and missing folders) if it does not exist, so ok is normally true even without a prior log.
  • Returns { ok: false } with status 200 when both writes fail.
  • No audit entry is written.
cURL
curl -X DELETE "https://panel.example.com/api/sites/12/logs" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}
GET /api/log-errors

List error groups

Lists grouped application errors collected from site logs (up to 200, most recently seen first). Ignored groups are hidden unless ignored=1. unresolved is the total number of unresolved, not-ignored groups.

  • Token or session
  • Admin

Query parameters

siteId integer
Only groups of this site.
search string
Text contained in message or exceptionClass.
resolved string
"0" = unresolved only, "1" = resolved only; anything else = both. Ignored when ignored=1.one of: 0, 1
ignored string
"1" = show only ignored (muted) groups; otherwise ignored groups are excluded.one of: 1

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
  • Admin only; error groups span all sites (no per-site access check).
  • unresolved is not filtered by siteId or search.
  • The search uses Prisma contains on SQLite (LIKE), which is case-insensitive for ASCII only.
cURL
curl "https://panel.example.com/api/log-errors" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "errors": [
        {
            "id": 31,
            "siteId": 12,
            "level": "error",
            "exceptionClass": "Illuminate\\Database\\QueryException",
            "message": "SQLSTATE[HY000] [2002] Connection refused",
            "count": 14,
            "firstSeenAt": "2026-11-26T08:12:00.000Z",
            "lastSeenAt": "2026-11-27T10:00:00.000Z",
            "resolved": false,
            "ignored": false,
            "site": {
                "domain": "shop.example.com"
            }
        }
    ],
    "unresolved": 5
}
GET /api/log-errors/{id}

Get an error group

Returns one error group with all stored fields, its site, and the most recent deployment created at or before the group was first seen (introducedBy, best-effort, or null).

  • Token or session
  • Admin

Path parameters

id integerrequired
Error group id (LogError id).

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
404
Not found No error group with this id.
  • Admin only; error groups span all sites (no per-site access check).
  • Error samples can contain sensitive request data.
cURL
curl "https://panel.example.com/api/log-errors/88" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "id": 31,
    "siteId": 12,
    "fingerprint": "9b2e4c71d0a8",
    "level": "error",
    "exceptionClass": "Illuminate\\Database\\QueryException",
    "message": "SQLSTATE[HY000] [2002] Connection refused",
    "sample": "[2026-11-26 08:12:00] production.ERROR: SQLSTATE[HY000] [2002] Connection refused",
    "count": 14,
    "firstSeenAt": "2026-11-26T08:12:00.000Z",
    "lastSeenAt": "2026-11-27T10:00:00.000Z",
    "resolved": false,
    "ignored": false,
    "aiExplanation": null,
    "createdAt": "2026-11-26T08:12:05.000Z",
    "site": {
        "id": 12,
        "domain": "shop.example.com"
    },
    "introducedBy": {
        "id": 88,
        "branch": "main",
        "commit": "a3f9c21",
        "createdAt": "2026-11-26T07:55:00.000Z"
    }
}
PATCH /api/log-errors/{id}

Resolve or ignore an error group

Sets the resolved and/or ignored flags of an error group and returns the updated row. Ignored groups are no longer re-surfaced by the collector.

  • Token or session
  • Admin

Path parameters

id integerrequired
Error group id (LogError id).

Body

resolved boolean
Mark resolved (true) or unresolved (false).
ignored boolean
Mute (true) or unmute (false) the group.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
404
Not found No error group with this id.
  • Admin only; error groups span all sites (no per-site access check).
  • Both fields are optional; an empty object changes nothing and returns the row.
  • No audit entry is written.
cURL
curl -X PATCH "https://panel.example.com/api/log-errors/88" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resolved": true
}'
200Response ยท application/json
{
    "id": 31,
    "siteId": 12,
    "fingerprint": "9b2e4c71d0a8",
    "level": "error",
    "exceptionClass": "Illuminate\\Database\\QueryException",
    "message": "SQLSTATE[HY000] [2002] Connection refused",
    "sample": "[2026-11-26 08:12:00] production.ERROR: SQLSTATE[HY000] [2002] Connection refused",
    "count": 14,
    "firstSeenAt": "2026-11-26T08:12:00.000Z",
    "lastSeenAt": "2026-11-27T10:00:00.000Z",
    "resolved": true,
    "ignored": false,
    "aiExplanation": null,
    "createdAt": "2026-11-26T08:12:05.000Z"
}
DELETE /api/log-errors/{id}

Dismiss an error group

Deletes an error group. If the error occurs again, the collector creates a new group.

  • Token or session
  • Admin

Path parameters

id integerrequired
Error group id (LogError id).

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
  • Admin only; error groups span all sites (no per-site access check).
  • Returns { ok: true } even when the id does not exist.
  • No audit entry is written.
cURL
curl -X DELETE "https://panel.example.com/api/log-errors/88" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "ok": true
}

Performance and uptime

Laravel Telescope APM and uptime checks.

GET /api/sites/{id}/apm

Get Laravel APM data

Reads the site's own Laravel Telescope data (telescope_entries) for the last 24 hours with the site's DB credentials from shared/.env: the 15 slowest queries, 15 slowest requests, 15 most recent exceptions and totals. Read-only (SELECT only).

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
500
<error message> Connecting to MySQL or a query failed; the error is the raw mysql2 message.
  • Status 200 without data in these cases: remote server โ†’ { installed: false, supported: false, message: "Laravel APM currently supports sites on the local server." }; unreadable .env / no DB_DATABASE โ†’ { installed: false, supported: true, message: "Could not read database credentials from shared/.env." }; no telescope_entries table โ†’ { installed: false, supported: true, message: "Laravel Telescope is not installed on this site. Install it (composer require laravel/telescope) to enable APM." }.
  • counts.slowQueries counts queries over 100 ms.
  • ms values are MySQL DECIMAL results and are returned as strings by the mysql2 driver; status is a string; at is the entry's created_at serialized as an ISO date (time-zone handling follows the driver defaults).
  • The window is fixed at 24 hours (no query parameter).
cURL
curl "https://panel.example.com/api/sites/12/apm" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "installed": true,
    "windowHours": 24,
    "counts": {
        "queries": 18250,
        "slowQueries": 42,
        "requests": 3100,
        "exceptions": 3
    },
    "slowQueries": [
        {
            "query": "select * from `orders` where `status` = ? order by `created_at` desc",
            "ms": "812.40",
            "at": "2026-11-27T09:41:00.000Z"
        }
    ],
    "slowRequests": [
        {
            "uri": "/checkout",
            "method": "POST",
            "status": "200",
            "ms": "1530.00",
            "at": "2026-11-27T09:40:58.000Z"
        }
    ],
    "exceptions": [
        {
            "class": "Illuminate\\Database\\QueryException",
            "message": "SQLSTATE[HY000] [2002] Connection refused",
            "at": "2026-11-27T08:12:00.000Z"
        }
    ]
}
GET /api/uptime

List uptime status

Returns the latest uptime check for every site whose status is active.

  • Token or session
  • Any role

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
  • Not filtered by site access: any authenticated user (including viewers without site grants) sees every active site.
  • status is "up", "down" (HTTP status >= 500, timeout or connection error) or "unknown" when the site has no checks yet.
cURL
curl "https://panel.example.com/api/uptime" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "sites": [
        {
            "siteId": 12,
            "domain": "shop.example.com",
            "monitoring": true,
            "status": "up",
            "responseMs": 182,
            "statusCode": 200,
            "checkedAt": "2026-11-27T10:00:00.000Z"
        },
        {
            "siteId": 14,
            "domain": "blog.example.com",
            "monitoring": false,
            "status": "unknown",
            "responseMs": null,
            "statusCode": null,
            "checkedAt": null
        }
    ]
}
GET /api/uptime/{siteId}/history

Get 24-hour uptime history

Returns the site's uptime checks from the last 24 hours (oldest first, at most 300) and the percentage of them that were up.

  • Token or session
  • Any role
  • Needs site access

Path parameters

siteId integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
  • uptime24h is null when there are no checks in the window. It is rounded to a whole percent.
  • An unknown site id returns { checks: [], uptime24h: null } for admins (no 404).
cURL
curl "https://panel.example.com/api/uptime/12/history" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "checks": [
        {
            "id": 5012,
            "siteId": 12,
            "status": "up",
            "responseMs": 182,
            "statusCode": 200,
            "checkedAt": "2026-11-27T09:55:00.000Z"
        },
        {
            "id": 5013,
            "siteId": 12,
            "status": "up",
            "responseMs": 175,
            "statusCode": 200,
            "checkedAt": "2026-11-27T10:00:00.000Z"
        }
    ],
    "uptime24h": 100
}
GET /api/uptime/{siteId}/sparkline

Get recent response times

Returns the site's last 20 uptime checks, oldest first, as compact points for a mini chart.

  • Token or session
  • Any role
  • Needs site access

Path parameters

siteId integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
  • ms is null for checks without a response time. An unknown site id returns { points: [] } for admins.
cURL
curl "https://panel.example.com/api/uptime/12/sparkline" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "points": [
        {
            "ms": 182,
            "status": "up",
            "at": "2026-11-27T09:55:00.000Z"
        },
        {
            "ms": 175,
            "status": "up",
            "at": "2026-11-27T10:00:00.000Z"
        }
    ]
}
PATCH /api/uptime/{siteId}

Turn uptime monitoring on or off

Sets the site's uptimeMonitor flag, which controls whether the uptime monitor checks the site.

  • Token or session
  • Admin ยท Developer
  • Needs site access

Path parameters

siteId integerrequired
Site id.

Body

monitoring booleanrequired
true to monitor the site, false to stop.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
  • No audit entry is written.
cURL
curl -X PATCH "https://panel.example.com/api/uptime/12" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "monitoring": false
}'
200Response ยท application/json
{
    "ok": true,
    "monitoring": false
}

Status pages and site security

Public status pages, HTTP basic auth and IP rules.

GET /api/sites/{id}/status-page

Get status page settings

Returns whether the site's public status page is enabled, its token and its public URL (<panel_url>/status/<token>, or a relative /status/<token> when panel_url is not set).

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • token and url are null until the page has been enabled once.
  • The public data behind the page is served by GET /api/public/status/{token} (no auth).
cURL
curl "https://panel.example.com/api/sites/12/status-page" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "enabled": true,
    "token": "3f9a1c7e5b2d8f40a6c1e9b7",
    "url": "https://panel.example.com/status/3f9a1c7e5b2d8f40a6c1e9b7"
}
POST /api/sites/{id}/status-page

Enable or disable the status page

Turns the site's public status page on or off. The first time it is enabled a random 24-hex-character token is generated; the token stays the same afterwards, also when the page is disabled and enabled again.

  • Token or session
  • Admin ยท Developer
  • Needs site access
  • Audit: site.status_page

Path parameters

id integerrequired
Site id.

Body

enabled booleanrequired
true to publish the status page, false to hide it.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
  • There is no way to rotate the token through this endpoint.
  • Disabling before it was ever enabled returns token: null, url: null.
  • Audit meta: { enabled }.
cURL
curl -X POST "https://panel.example.com/api/sites/12/status-page" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true
}'
200Response ยท application/json
{
    "enabled": true,
    "token": "3f9a1c7e5b2d8f40a6c1e9b7",
    "url": "https://panel.example.com/status/3f9a1c7e5b2d8f40a6c1e9b7"
}
GET /api/sites/{id}/security

Get site access protection

Returns the site's nginx access protection: HTTP basic auth (username, never the password hash) and the IP allow/deny list.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • ipMode is "allow", "deny" or null (off).
  • hasPassword is derived from whether a username is set (!!basicUser), not from the stored hash.
cURL
curl "https://panel.example.com/api/sites/12/security" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "basicAuth": true,
    "basicUser": "preview",
    "hasPassword": true,
    "ipMode": "allow",
    "ipList": [
        "203.0.113.10",
        "198.51.100.0/24"
    ]
}
POST /api/sites/{id}/security

Set site access protection

Merges the given fields onto the current settings, applies them to nginx with scripts/site-security.sh (snippet + htpasswd file under /etc/nginx/orchestrator-security, backed up, checked with nginx -t and rolled back on failure), and stores them only after nginx accepted them.

  • Token or session
  • Admin
  • Needs site access
  • Audit: site.security

Path parameters

id integerrequired
Site id.

Body

basicAuth boolean
Enable HTTP basic auth.
basicUser string
Basic auth username; an empty string clears it.max 64 chars
basicPassword string
New basic auth password (stored as a bcrypt hash). Omit or send empty to keep the current one.max 128 chars
ipMode string
"allow" = only listed IPs may access (everything else denied), "deny" = listed IPs are blocked, "off" = no IP rules.one of: allow, deny, off
ipList array
IPv4 addresses or CIDR ranges.max 100 items, each max 43 chars; IPv4 or IPv4/CIDR (prefix 0โ€“32) only

Errors

400
Invalid IP/CIDR: <value> An ipList entry is not an IPv4 address or IPv4 CIDR.
400
Set a username and password to enable basic auth. Basic auth would be enabled without both a username and a stored/new password.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
500
nginx did not accept the security config (no changes applied to the live site). The apply script failed or nginx -t rejected the config; the body also has "detail" (singular) with up to 500 chars of stderr.
  • Omitted fields keep their current value. ipMode "off" is stored and returned as null.
  • With ipMode "allow" the snippet is the listed "allow" lines followed by "deny all;". An empty ipList adds no IP rules regardless of ipMode.
  • Only IPv4 is accepted; IPv6 addresses are rejected with 400.
  • The script runs on the panel host (scripts/site-security.sh, local execFile), not through the site's server connection; sites on remote servers are not handled specially by this route.
  • The 500 error body uses the key "detail", not "details".
  • Audit meta: { basicAuth, ipMode }.
cURL
curl -X POST "https://panel.example.com/api/sites/12/security" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "basicAuth": true,
    "basicUser": "preview",
    "basicPassword": "a-long-test-password",
    "ipMode": "allow",
    "ipList": [
        "203.0.113.10",
        "198.51.100.0/24"
    ]
}'
200Response ยท application/json
{
    "basicAuth": true,
    "basicUser": "preview",
    "hasPassword": true,
    "ipMode": "allow",
    "ipList": [
        "203.0.113.10",
        "198.51.100.0/24"
    ]
}

Usage

Disk, database and traffic usage per site.

GET /api/sites/{id}/usage

Get site resource usage

Returns the stored daily usage measurements of a site (disk, database size, and โ€” when traffic logging is on โ€” requests and bytes sent) and the latest values. Never runs a measurement.

  • Token or session
  • Any role
  • Needs site access

Path parameters

id integerrequired
Site id.

Query parameters

days integer
How many days of history to return (counting today).default 30, max 400; values below 1 or non-numeric fall back to 30; decimals are floored

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
  • latest.diskBytes/dbBytes come from the newest history row that has them; latest.requests/bytesOut come from today's row only and are null when traffic logging is off. measuredAt is the updatedAt of the newest row. Dates (today, history[].date) are YYYY-MM-DD in the panel server's local time zone.
  • notes is always [] here (it is filled only by the refresh endpoint).
  • Measurements are taken automatically every 6 hours and kept 400 days.
cURL
curl "https://panel.example.com/api/sites/12/usage" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "siteId": 12,
    "trafficLog": true,
    "remote": false,
    "today": "2026-11-27",
    "latest": {
        "diskBytes": 734003200,
        "diskDate": "2026-11-27",
        "dbBytes": 52428800,
        "dbDate": "2026-11-27",
        "requests": 1840,
        "bytesOut": 96468992,
        "measuredAt": "2026-11-27T10:00:00.000Z"
    },
    "history": [
        {
            "date": "2026-11-26",
            "diskBytes": 733000000,
            "dbBytes": 52000000,
            "requests": 15230,
            "bytesOut": 812000000,
            "updatedAt": "2026-11-27T00:05:00.000Z"
        },
        {
            "date": "2026-11-27",
            "diskBytes": 734003200,
            "dbBytes": 52428800,
            "requests": 1840,
            "bytesOut": 96468992,
            "updatedAt": "2026-11-27T10:00:00.000Z"
        }
    ],
    "notes": []
}
POST /api/sites/{id}/usage/refresh

Measure site usage now

Measures the site now (du of the site folder, database size, and today's traffic from the opt-in traffic log), stores the result for today and returns the same payload as GET /usage. Read-only on the site itself.

  • Token or session
  • Admin ยท Developer
  • Needs site access

Path parameters

id integerrequired
Site id.

Query parameters

days integer
How many days of history to return (counting today).default 30, max 400; values below 1 or non-numeric fall back to 30; decimals are floored

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
403
Forbidden: viewer role is read-only Caller has the viewer role (write method on a site route).
404
Site not found No site with this id.
  • notes lists machine-readable reasons a metric is missing: disk_unavailable, no_database, db_unreachable, traffic_unavailable, traffic_no_log.
  • Concurrent refreshes of the same site share one measurement run. The request waits for the measurement.
  • days is read from the query string (the web client sends ?days=30).
  • latest.diskBytes/dbBytes come from the newest history row that has them; latest.requests/bytesOut come from today's row only and are null when traffic logging is off. measuredAt is the updatedAt of the newest row. Dates (today, history[].date) are YYYY-MM-DD in the panel server's local time zone.
  • No audit entry is written.
cURL
curl -X POST "https://panel.example.com/api/sites/12/usage/refresh" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "siteId": 12,
    "trafficLog": true,
    "remote": false,
    "today": "2026-11-27",
    "latest": {
        "diskBytes": 734003200,
        "diskDate": "2026-11-27",
        "dbBytes": 52428800,
        "dbDate": "2026-11-27",
        "requests": 1840,
        "bytesOut": 96468992,
        "measuredAt": "2026-11-27T10:00:00.000Z"
    },
    "history": [
        {
            "date": "2026-11-26",
            "diskBytes": 733000000,
            "dbBytes": 52000000,
            "requests": 15230,
            "bytesOut": 812000000,
            "updatedAt": "2026-11-27T00:05:00.000Z"
        },
        {
            "date": "2026-11-27",
            "diskBytes": 734003200,
            "dbBytes": 52428800,
            "requests": 1840,
            "bytesOut": 96468992,
            "updatedAt": "2026-11-27T10:00:00.000Z"
        }
    ],
    "notes": [
        "traffic_no_log"
    ]
}
PUT /api/sites/{id}/usage/traffic

Turn traffic logging on or off

Switches the site's opt-in traffic access log on or off by editing its nginx vhost through a script that backs up the vhost, checks it with nginx -t and restores it on failure. The flag is stored only after nginx accepted the change. Returns the usage payload for 30 days.

  • Token or session
  • Admin
  • Needs site access
  • Audit: site.traffic_log

Path parameters

id integerrequired
Site id.

Body

enabled booleanrequired
true to start counting requests and bytes, false to stop.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
403
Forbidden: no access to this site Caller is not an admin, has no all-sites access and no grant on this site.
404
Site not found No site with this id.
500
Could not change traffic logging (the site's nginx config was left unchanged). The script failed; "details" holds up to 800 chars of its stderr/stdout.
  • A failure writes the audit action "site.traffic_log_failed" (meta: { domain, enabled, error }). Success meta: { domain, enabled }.
  • Works for local and remote servers (the script runs on the site's server).
  • The returned history always covers 30 days (no days parameter).
cURL
curl -X PUT "https://panel.example.com/api/sites/12/usage/traffic" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true
}'
200Response ยท application/json
{
    "siteId": 12,
    "trafficLog": true,
    "remote": false,
    "today": "2026-11-27",
    "latest": {
        "diskBytes": 734003200,
        "diskDate": "2026-11-27",
        "dbBytes": 52428800,
        "dbDate": "2026-11-27",
        "requests": 1840,
        "bytesOut": 96468992,
        "measuredAt": "2026-11-27T10:00:00.000Z"
    },
    "history": [
        {
            "date": "2026-11-26",
            "diskBytes": 733000000,
            "dbBytes": 52000000,
            "requests": 15230,
            "bytesOut": 812000000,
            "updatedAt": "2026-11-27T00:05:00.000Z"
        },
        {
            "date": "2026-11-27",
            "diskBytes": 734003200,
            "dbBytes": 52428800,
            "requests": 1840,
            "bytesOut": 96468992,
            "updatedAt": "2026-11-27T10:00:00.000Z"
        }
    ],
    "notes": []
}
GET /api/usage/sites

List usage for all sites

Cross-site overview: for every site, the latest disk and database size and the request and byte totals of the last 30 days (only when traffic logging is on).

  • Token or session
  • Admin

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized Missing or invalid session token. An unknown or expired personal access token gets "Invalid or expired access token".
403
Forbidden: insufficient role Caller is not an admin.
  • Registered from usage.ts as usageRoutes under /api/usage (admin only for the whole plugin).
  • requests30d/bytesOut30d are null when traffic logging is off or there is no traffic data in the window. Values are numbers converted from BigInt.
cURL
curl "https://panel.example.com/api/usage/sites" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response ยท application/json
{
    "sites": [
        {
            "siteId": 12,
            "domain": "shop.example.com",
            "trafficLog": true,
            "diskBytes": 734003200,
            "dbBytes": 52428800,
            "measuredAt": "2026-11-27T10:00:00.000Z",
            "requests30d": 412870,
            "bytesOut30d": 21474836480
        },
        {
            "siteId": 14,
            "domain": "blog.example.com",
            "trafficLog": false,
            "diskBytes": 120586240,
            "dbBytes": null,
            "measuredAt": "2026-11-27T10:00:00.000Z",
            "requests30d": null,
            "bytesOut30d": null
        }
    ]
}