API reference
Sites and deploys
Sites, provisioning, deployments, push-to-deploy, staging and presets.
Sites
Create, list, update and delete sites, and provision them on a server.
/api/sites
List sites
Returns every site the caller can see, pinned sites first, then newest first. Admins and users with all-sites access get every site; other users get only the sites they were granted. Each site carries its most recent deployment, the cached SSL expiry and the flattened billing state.
- Token or session
- Any role
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.
- Only gitToken is hidden: it is removed and replaced by the boolean hasGitToken. Every other Site column is returned as stored, including webhookToken (the push-to-deploy secret), statusPageToken, secBasicUser/secBasicHash (bcrypt hash of the basic-auth password) and secIpList (JSON string). tags is a JSON-encoded string array, not an array.
- deployments contains at most 1 item (the newest deployment), including its full log.
- sslDaysLeft / sslExpiresAt come from the background SSL monitor cache (null when never checked).
- enforcementLevel is the site's billing subscription enforcement level ("none" when there is no subscription; otherwise e.g. banner, restrict, suspend, archived). billingSuspended = level is suspend or archived; billingPastDue = level is banner or restrict. The subscription object itself is not returned.
- Not paginated.
curl "https://panel.example.com/api/sites" \
-H "Authorization: Bearer $ORCH_TOKEN"[
{
"id": 12,
"name": "Shop",
"domain": "shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": null,
"dbName": "shop",
"dbUser": "shop",
"sslEnabled": true,
"rootPath": "/var/www/sites/shop.example.com",
"status": "active",
"repoUrl": "https://github.com/example/shop.git",
"branch": "main",
"webhookToken": "5f0c2a9e7b1d4c3a8e6f0b2d4a6c8e0f1a3b5c7d9e1f2a4b",
"preDeploy": null,
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://shop.example.com/up",
"runTests": false,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": true,
"disabled": false,
"tags": "[\"client-a\",\"production\"]",
"notes": null,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"deployments": [
{
"id": 345,
"siteId": 12,
"commit": "a3f9c21",
"branch": "main",
"status": "success",
"log": "[1/9] Cloning repository...\n...\n=== Deploy complete! ===\n__COMMIT__:a3f9c21\n",
"comment": null,
"testResult": null,
"testsPassed": null,
"testsFailed": null,
"testsTotal": null,
"testDurationMs": null,
"createdAt": "2026-11-27T10:00:00.000Z"
}
],
"hasGitToken": true,
"sslDaysLeft": 61,
"sslExpiresAt": "2027-01-27T08:00:00.000Z",
"enforcementLevel": "none",
"billingSuspended": false,
"billingPastDue": false
}
]
/api/sites/{id}
Get a site
Returns one site with its 20 most recent deployments (newest first).
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.
- Only gitToken is hidden: it is removed and replaced by the boolean hasGitToken. Every other Site column is returned as stored, including webhookToken (the push-to-deploy secret), statusPageToken, secBasicUser/secBasicHash (bcrypt hash of the basic-auth password) and secIpList (JSON string). tags is a JSON-encoded string array, not an array.
- Each deployment includes its full log text.
- status is one of pending, provisioning, active, error. stackType is one of laravel, wordpress, static, node. serverId null = the panel's local server. stagingOf is the production site id when this site is a staging copy.
- Unlike GET /api/sites, this does not include sslDaysLeft, sslExpiresAt or the billing fields.
curl "https://panel.example.com/api/sites/12" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"id": 12,
"name": "Shop",
"domain": "shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": null,
"dbName": "shop",
"dbUser": "shop",
"sslEnabled": true,
"rootPath": "/var/www/sites/shop.example.com",
"status": "active",
"repoUrl": "https://github.com/example/shop.git",
"branch": "main",
"webhookToken": "5f0c2a9e7b1d4c3a8e6f0b2d4a6c8e0f1a3b5c7d9e1f2a4b",
"preDeploy": null,
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://shop.example.com/up",
"runTests": false,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": true,
"disabled": false,
"tags": "[\"client-a\",\"production\"]",
"notes": null,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"deployments": [
{
"id": 345,
"siteId": 12,
"commit": "a3f9c21",
"branch": "main",
"status": "success",
"log": "[1/9] Cloning repository...\n...\n=== Deploy complete! ===\n__COMMIT__:a3f9c21\n",
"comment": null,
"testResult": null,
"testsPassed": null,
"testsFailed": null,
"testsTotal": null,
"testDurationMs": null,
"createdAt": "2026-11-27T10:00:00.000Z"
}
],
"hasGitToken": true
}
/api/sites/tags
List all site tags
Returns the distinct tags used across all sites, sorted alphabetically.
- Token or session
- Any role
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.
- Tags are collected from every site in the panel, not only the sites the caller has access to.
curl "https://panel.example.com/api/sites/tags" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"tags": [
"client-a",
"production",
"staging"
]
}
/api/sites
Create a site
Creates a site record in status "pending" with rootPath /var/www/sites/<domain>. Nothing is set up on the server yet: call the provision endpoint next.
- Token or session
- Admin
- Audit:
site.created
Body
namestringrequired- Display name.1โ100 chars
domainstringrequired- Primary hostname. Must be unique across sites.3โ253 chars, pattern ^[a-zA-Z0-9][a-zA-Z0-9\-\.]*[a-zA-Z0-9]$
phpVersionstring- PHP version.pattern ^\d+\.\d+$, default "8.2"
serverIdinteger- Server to host the site on. Omit (or 0) for the panel's local server.must be an existing server with SSH access
Errors
- 400
Selected server not foundserverId does not match a server.- 400
Sites can only be placed on a server with SSH access. This server is connected through the agent only.serverId is an agent-only fleet server (no SSH host).- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.
- The response has no deployments field. gitToken is replaced by hasGitToken.
- A duplicate domain is not checked by the handler; the unique constraint makes Prisma throw, which surfaces as a 500.
curl -X POST "https://panel.example.com/api/sites" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Shop",
"domain": "shop.example.com",
"phpVersion": "8.3"
}'{
"id": 13,
"name": "Shop",
"domain": "shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": null,
"dbName": null,
"dbUser": null,
"sslEnabled": false,
"rootPath": "/var/www/sites/shop.example.com",
"status": "pending",
"repoUrl": null,
"branch": "main",
"webhookToken": null,
"preDeploy": null,
"postDeploy": null,
"healthCheck": false,
"healthCheckUrl": null,
"runTests": false,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": false,
"disabled": false,
"tags": "[]",
"notes": null,
"createdAt": "2026-11-27T10:00:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"hasGitToken": false
}
/api/sites/{id}
Delete a site
Deletes the site record (and, by cascade, its deployments, config history and other site-owned rows). With cleanup=true it first runs cleanup.sh on the site's server to remove the vhost, site directory, database and database user.
- Token or session
- Admin
- Needs site access
- Audit:
site.deleted
Path parameters
idintegerrequired- Site id.
Query parameters
cleanupstring- Set to "true" to remove the site from the server as well. Any other value only deletes the panel record.only the exact string "true" enables cleanup
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.
- With cleanup=true the status is 200 and the body is {"ok": true, "cleanupOk": true|false, "cleanupLog": "<script output>"}, e.g. {"ok":true,"cleanupOk":true,"cleanupLog":"Removed nginx vhost\nDropped database shop"}.
- A failing cleanup does NOT stop the deletion: the panel record is deleted anyway and cleanupOk is false. The script has a 60 s timeout.
- If the site has traffic logging on, it is switched off first (best effort).
- Additional audit entries with cleanup: site.cleanup_ok or site.cleanup_failed.
curl -X DELETE "https://panel.example.com/api/sites/12" \
-H "Authorization: Bearer $ORCH_TOKEN"Empty body when cleanup is not requested; 200 with a cleanup report when cleanup=true.
/api/sites/{id}/branches
List repository branches
Runs git ls-remote --heads against the site's repository URL and returns the branch names.
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 400
No repository configuredThe site does not exist or has no repoUrl (no separate 404).- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.
- The site's gitToken is NOT used, so a private HTTPS repository returns {"branches": []}. Any git failure (auth, network, 15 s timeout) also returns an empty list instead of an error.
- git runs on the panel host, not on the site's server.
curl "https://panel.example.com/api/sites/12/branches" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"branches": [
"main",
"develop",
"feature/checkout"
]
}
/api/sites/{id}/provision
Provision a site
Starts provision.sh on the site's server in the background (directories, MySQL database and user, nginx vhost) and returns immediately. Optionally installs a fresh app of the chosen template afterwards (1-click install). Follow progress with the provision stream.
- Token or session
- Admin ยท Developer
- Needs site access
Path parameters
idintegerrequired- Site id.
Body
dbNamestringrequired- MySQL database name to create.1โ64 chars, pattern ^[a-zA-Z0-9_]+$
dbUserstringrequired- MySQL user to create.1โ32 chars, pattern ^[a-zA-Z0-9_]+$
dbPasswordstringrequired- Password for the MySQL user. Not stored by the panel.8โ128 chars, no ' " \ or backtick
templatestring- Stack to provision; also stored as the site's stackType.one of: laravel, wordpress, static, node; default laravel
installAppboolean- Install a fresh app of the template after the base provision.default false
siteTitlestring- WordPress site title (template=wordpress and installApp only). Defaults to the site name, then the domain.max 120 chars, no ' " \ backtick $ or newline
wpAdminUserstring- WordPress admin username. Defaults to "admin".max 60 chars, pattern ^[A-Za-z0-9_.@ -]+$
wpAdminEmailstring- WordPress admin email. Required when template=wordpress and installApp=true.max 120 chars, pattern ^[^@\s]+@[^@\s]+\.[^@\s]+$
wpAdminPassstring- WordPress admin password. Required when template=wordpress and installApp=true.8โ128 chars, no ' " \ backtick $ or space
Errors
- 400
WordPress install requires an admin email and password.template=wordpress, installApp=true and wpAdminEmail or wpAdminPass is missing.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.- 409
Provisioning already running for this siteA provision for this site is already running in this API process (checked before the site lookup).- 502
Could not reach target server: <reason>The site's server could not be resolved or the scripts could not be synced to it; the site status is put back to "pending".
- Status flow: the site is set to "provisioning" (and dbName, dbUser, stackType are saved) before the script starts; on success it becomes "active", on any failure "error".
- On success a primary SiteDatabase row is registered and, if Cloudflare is configured in settings, an A record for the domain is created (best effort; result appears in the log).
- For template=node a loopback port 3000 + siteId is assigned to the app.
- If installApp fails after a successful base provision, the site ends in "error" even though the vhost and database exist.
- Provisioning state is in memory: an API restart loses the running provision and its log.
curl -X POST "https://panel.example.com/api/sites/12/provision" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dbName": "shop",
"dbUser": "shop",
"dbPassword": "S3cure-pass-2026",
"template": "laravel",
"installApp": false
}'{
"started": true,
"siteId": 12
}
/api/sites/{id}/provision/stream
Stream provisioning log
Server-Sent Events stream of the provisioning output. Replays the buffered output first, then streams new output live and ends with a done event.
- Token or session
- Any role
- Needs site access
- Server-Sent Events
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.
- Each event is a single "data: <JSON>" line followed by a blank line. Output events: data: {"line":"<chunk>"} where <chunk> is a raw stdout/stderr chunk of the script (may hold several lines or a partial line, newlines included).
- End of stream: data: {"done":true,"status":"active"} (success) or {"done":true,"status":"error"}, after which the server closes the connection.
- If no provision is running for the site, the server sends the buffered output (kept for 30 minutes after a run finishes, if any) and then immediately {"done":true,"status":"<current site.status>"} โ e.g. "pending", "active" or "error" โ and closes.
- A comment line ": ka" is sent every 20 s as keep-alive while waiting.
- Authenticate with the Authorization header (Bearer JWT or personal access token); the browser EventSource API cannot set it, the web client uses fetch() and parses the stream itself.
curl -N "https://panel.example.com/api/sites/12/provision/stream" \
-H "Authorization: Bearer $ORCH_TOKEN"SSE stream of {"line"} events followed by one {"done"} event.
/api/sites/{id}
Update a site
Updates site settings: repository, branch, git token, deploy hooks, health check, deploy-time tests, stack, tags, pin, notes, name, and (admin only) domain and enabled state. Only the fields sent are changed. Hook scripts are written to the server immediately when preDeploy or postDeploy is sent.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
site.renamed, site.rename_failed, site.disabled, site.enabled
Path parameters
idintegerrequired- Site id.
Body
repoUrlstring- Git repository URL. Empty string clears it.max 500 chars; must be http(s):// or scp-like user@host:path; no whitespace, must not start with "-"
branchstring- Branch to deploy.1โ100 chars
namestring- Display name.1โ100 chars
domainstring- New domain (admin only). Renames the site on the server unless renameOnDisk is false.3โ253 chars, pattern ^[a-zA-Z0-9][a-zA-Z0-9\-\.]*[a-zA-Z0-9]$
disabledboolean- true stops nginx serving the site, false serves it again (admin only).
renameOnDiskboolean- With a domain change: false only updates the panel record (use when the site was never provisioned on the server).default true
gitTokenstring- Access token for private HTTPS repositories. Stored encrypted; empty string removes it. Never returned (see hasGitToken).max 500 chars
preDeploystring- Bash run before the release is built (hooks/pre-deploy.sh). Empty string removes the hook file.max 4096 chars
postDeploystring- Bash run after the release went live (hooks/post-deploy.sh). Empty string removes the hook file.max 4096 chars
healthCheckboolean- Run an HTTP health check after each deploy and auto-roll back when it fails.
healthCheckUrlstring- URL for the health check. Defaults to http://<domain>/ when empty.max 500 chars
runTestsboolean- Run tests before the release goes live.
testCommandstring- Test command.max 500 chars
testFailureModestring- block aborts the deploy on failing tests; warn continues.one of: block, warn
testTimeoutinteger- Test timeout in seconds.10โ3600
testUseSqliteboolean- Run tests against an isolated in-memory SQLite database.
tagsarray- Replaces the site's tags.max 10 items, each a string of max 50 chars
pinnedboolean- Pin the site to the top of the list.
notesstring- Free-text notes.max 2000 chars
stackTypestring- Runtime stack used by deploy.sh.one of: laravel, wordpress, static, node
Errors
- 400
Invalid repository URL. Use an https:// or git@host:owner/repo URL.repoUrl is not empty and not a valid git URL.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 403
Only admins can change a site's domain or enabled statusA non-admin sends a different domain, or sends disabled at all (even unchanged).- 404
Site not foundNo site with this id.- 409
That domain is already in use by another siteThe new domain belongs to another site.- 500
Failed to disable site on the servertoggle-site.sh failed (or "Failed to enable site on the server"); body also has "log". Nothing is saved.- 500
Failed to rename domain on the serverrename-domain.sh failed; body also has "log" with the script output. Nothing is saved.
- Response: the Site row (no deployments) with gitToken replaced by hasGitToken, plus renameLog (script output) only when a domain rename ran on the server.
- A domain rename runs rename-domain.sh on the site's server (30 s timeout) and sets rootPath to /var/www/sites/<new domain>; with renameOnDisk=false only the domain column changes and rootPath stays as it was. Opt-in traffic logging is moved to the new name.
- tags is sent as an array but stored and returned as a JSON-encoded string.
- Audit entries are only written for rename and enable/disable; other field changes are not audited.
- Fields not listed are removed silently (additionalProperties: false).
curl -X PATCH "https://panel.example.com/api/sites/12" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"branch": "main",
"gitToken": "ghp_exampletoken",
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://shop.example.com/up",
"tags": [
"client-a",
"production"
]
}'{
"id": 12,
"name": "Shop",
"domain": "shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": null,
"dbName": "shop",
"dbUser": "shop",
"sslEnabled": true,
"rootPath": "/var/www/sites/shop.example.com",
"status": "active",
"repoUrl": "https://github.com/example/shop.git",
"branch": "main",
"webhookToken": "5f0c2a9e7b1d4c3a8e6f0b2d4a6c8e0f1a3b5c7d9e1f2a4b",
"preDeploy": null,
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://shop.example.com/up",
"runTests": false,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": true,
"disabled": false,
"tags": "[\"client-a\",\"production\"]",
"notes": null,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"hasGitToken": true
}
Deployments
Start deploys, follow their logs, roll back and inspect releases.
/api/sites/{id}/test-stats
Get deploy test statistics
Aggregates the test results of the site's last 30 deployments that ran tests (testResult passed or failed).
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.
- passRate is a whole percentage, null when there are no runs; avgDurationMs is null when no run has a parsed duration; lastRun is the newest run or null; trend is ordered oldest โ newest.
- No 404: an unknown site id returns totalRuns 0.
curl "https://panel.example.com/api/sites/12/test-stats" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"totalRuns": 2,
"passRate": 50,
"avgDurationMs": 41250,
"lastRun": {
"id": 345,
"commit": "a3f9c21",
"testResult": "passed",
"createdAt": "2026-11-27T10:00:00.000Z",
"testsPassed": 128,
"testsFailed": 0,
"testsTotal": 128,
"testDurationMs": 40100
},
"trend": [
{
"date": "2026-11-20T09:30:00.000Z",
"result": "failed",
"passed": 126,
"failed": 2,
"total": 128
},
{
"date": "2026-11-27T10:00:00.000Z",
"result": "passed",
"passed": 128,
"failed": 0,
"total": 128
}
]
}
/api/sites/{id}/deploy/pending
List undeployed commits
Shows the commits on the site's branch that are newer than the last successful deployment. Makes a temporary blob-less bare clone of the repository (using the site's git token) on the panel host, reads the log and deletes the clone. Read-only.
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 400
No repository URL configuredThe site has no repoUrl.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.- 502
Could not read the remote: <reason>The clone or git log failed (auth, network, 60 s clone timeout, unknown branch).
- currentCommit is the commit of the newest successful deployment (null if none). range=true means commits lists currentCommit..HEAD (max 50); range=false means the last commit could not be found in the branch history (force-push, or no previous deploy) and commits is simply the latest 20 commits.
- hash and remoteCommit are 7-character short hashes; date is the author date in ISO 8601 with offset.
- Successful rollback rows also count as "successful deployments" here; their commit is the 14-digit release name, so right after a rollback range is usually false.
curl "https://panel.example.com/api/sites/12/deploy/pending" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"branch": "main",
"currentCommit": "a3f9c21",
"remoteCommit": "c81e0b4",
"upToDate": false,
"range": true,
"commits": [
{
"hash": "c81e0b4",
"subject": "Fix checkout rounding",
"author": "Ada Lovelace",
"date": "2026-11-27T09:12:44+00:00"
},
{
"hash": "b07d3f2",
"subject": "Add order export",
"author": "Ada Lovelace",
"date": "2026-11-26T16:40:02+00:00"
}
]
}
/api/sites/{id}/deploy
Deploy a site
Starts a deploy of the site's branch (or of a given ref) in the background and returns the new deployment id. If a deploy or rollback is already running for the site, the request is queued instead and starts automatically about 2 seconds after the current one finishes.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
deploy.success, deploy.failed
Path parameters
idintegerrequired- Site id.
Query parameters
skipTestsstring- Set to "1" to skip the site's deploy-time tests for this deploy only (emergency override). The site setting is unchanged.only "1" is recognised
refstring- Tag, branch or commit to deploy instead of the branch HEAD.pattern ^[A-Za-z0-9._/\-]{1,100}$; an invalid value is silently ignored (the branch HEAD is deployed)
Errors
- 400
No repository URL configuredThe site has no repoUrl.- 400
Site is not activeSite status is not "active" (e.g. not provisioned yet).- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.- 409
Deploy already in progressRace: another deploy claimed the site between the queue check and the start.- 500
<error message>Setup failed before the deploy process started (e.g. the remote server is unreachable or the hook files could not be written).
- Queued response (also 200): {"queued": true, "message": "Deploy queued โ will start automatically after the current one finishes."}. The queue is a single flag (Site.deployQueued): several queued requests collapse into one deploy, and the queued deploy re-reads the site settings and deploys the branch HEAD without skipTests or ref.
- Deployment lifecycle: a Deployment row is created with status "running"; it ends as "success" or "failed". Deployment.status values: running, success, failed (legacy "pending" rows are marked failed at API startup). testResult is null (not run), passed, failed or skipped (tests enabled but skipTests=1).
- After a successful script run the optional health check (3 attempts, 5 s apart; HTTP < 500 = OK) runs; if it fails the deploy is marked failed and the previous release is restored automatically (audit deploy.health_rollback).
- A deploy that runs longer than DEPLOY_TIMEOUT_MS (default 25 minutes) is killed and marked failed.
- Audit entries are written when the deploy ends (deploy.success or deploy.failed), not when it starts. On completion the panel also sends the configured deploy notifications, an in-app notification and the deploy.succeeded / deploy.failed event (outbound webhooks, automation).
- Follow the output with GET /api/sites/{id}/deploy/stream.
- No request body. Send this request without a body (or with a JSON body such as {}). Sending Content-Type: application/json with an empty body is rejected by Fastify with 400 FST_ERR_CTP_EMPTY_JSON_BODY.
curl -X POST "https://panel.example.com/api/sites/12/deploy" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"started": true,
"deploymentId": 346
}
/api/sites/{id}/deploy/cancel
Cancel a stuck deploy
Kills the running deploy process of the site (SIGKILL to the whole process group) if this API process started it; otherwise force-marks the newest "running" deployment row as failed and clears the deploy queue.
- Token or session
- Admin
- Needs site access
- Audit:
deploy.cancelled
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
No running deploy found for this siteNo live deploy process and no deployment row in status "running".
- Live process: returns {"ok": true, "message": "Kill signal sent โ the deploy will be marked failed shortly."}; the deploy then finishes as failed through the normal path (audit deploy.failed). In this case deployQueued is NOT cleared, so a queued deploy still starts afterwards.
- Orphaned row (e.g. left over from an API restart): returns {"ok": true, "message": "Marked the stuck deploy as failed."}, appends "[orchestrator] Deploy cancelled by admin." to its log, clears deployQueued and writes audit deploy.cancelled.
- Rollbacks are not tracked as killable processes; for a running rollback this endpoint takes the orphaned-row path.
- No request body. Send this request without a body (or with a JSON body such as {}). Sending Content-Type: application/json with an empty body is rejected by Fastify with 400 FST_ERR_CTP_EMPTY_JSON_BODY.
curl -X POST "https://panel.example.com/api/sites/12/deploy/cancel" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"ok": true,
"message": "Kill signal sent โ the deploy will be marked failed shortly."
}
/api/sites/{id}/deploy/stream
Stream deploy log
Server-Sent Events stream of the site's current deploy or rollback. Replays the output buffered so far, then streams new output live and ends with a done event carrying the final status.
- Token or session
- Any role
- Needs site access
- Server-Sent Events
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.
- Each event is a single "data: <JSON>" line followed by a blank line. Output events: data: {"line":"<chunk>"}. For a deploy, <chunk> is a raw stdout/stderr chunk of deploy.sh (may contain several lines or a partial line, newlines included; git tokens are masked as ***). For a rollback, each event is one message without a trailing newline (e.g. "โ current โ releases/20261120093000").
- Lines matching __COMMIT__:<hash>, __COMMIT_MSG__:, __COMMIT_AUTHOR__: and __TESTS__:passed|failed are machine markers emitted by deploy.sh and appear in the stream.
- End of stream: data: {"done":true,"status":"success"} or {"done":true,"status":"failed"}, after which the server closes the connection.
- If nothing is running for the site in this API process, the server immediately sends {"done":true,"status":"running"} when an orphaned "running" row exists (after replaying nothing), or {"done":true,"status":"unknown"} otherwise โ including right after a deploy finished โ and closes. Read the deployment row (GET /api/sites/{id}) for the final result in that case.
- There is no 404: any site id the caller may access gets a stream.
- A comment line ": ka" is sent every 20 s as keep-alive.
- Authenticate with the Authorization header (Bearer JWT or personal access token); the browser EventSource API cannot set it.
curl -N "https://panel.example.com/api/sites/12/deploy/stream" \
-H "Authorization: Bearer $ORCH_TOKEN"SSE stream of {"line"} events followed by one {"done"} event.
/api/sites/{id}/releases
List releases
Lists the release directories under <rootPath>/releases on the site's server, newest first, and which one the "current" symlink points to. These names are what the rollback endpoint accepts.
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.
- Release names are deploy timestamps in the form YYYYMMDDHHMMSS (server time); deploy.sh keeps the 5 most recent releases.
- createdAt is the directory birth time on the local server and its modification time on a remote server.
- Any read error returns {"releases": [], "current": ""} instead of an error.
curl "https://panel.example.com/api/sites/12/releases" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"releases": [
{
"name": "20261127100000",
"isCurrent": true,
"createdAt": "2026-11-27T10:00:00.000Z"
},
{
"name": "20261120093000",
"isCurrent": false,
"createdAt": "2026-11-20T09:30:00.000Z"
}
],
"current": "20261127100000"
}
/api/sites/{id}/deployments/heatmap
Get deploy activity heatmap
Counts the site's deployments per day over the last 52 weeks.
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.
- Keys are UTC dates (YYYY-MM-DD); days without deployments are absent. total also counts rollbacks and running deployments.
- No 404: an unknown site id returns {"days": {}}.
curl "https://panel.example.com/api/sites/12/deployments/heatmap" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"days": {
"2026-11-20": {
"total": 2,
"success": 1,
"failed": 1
},
"2026-11-27": {
"total": 1,
"success": 1,
"failed": 0
}
}
}
/api/sites/{id}/deployments/{deployId}/redeploy
Redeploy a site
Starts a new deploy with the site's current repository and branch settings, exactly like POST /api/sites/{id}/deploy without query options, but answers 202. Queues the deploy when one is already running.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
deploy.success, deploy.failed
Path parameters
idintegerrequired- Site id.
deployIdintegerrequired- Id of the deployment being redeployed. Currently ignored: the branch HEAD is always deployed, not that deployment's commit.not validated
Errors
- 400
No repository URL configuredThe site has no repoUrl.- 400
Site is not activeSite status is not "active".- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.- 409
Deploy already in progressRace with another deploy starting at the same moment.- 500
<error message>Deploy setup failed before the process started.
- Queued response (also 202): {"ok": true, "queued": true, "message": "Deploy queued โ will start automatically after the current one finishes."}.
- Same lifecycle, health check, notifications and audit as the deploy trigger.
- No request body. Send this request without a body (or with a JSON body such as {}). Sending Content-Type: application/json with an empty body is rejected by Fastify with 400 FST_ERR_CTP_EMPTY_JSON_BODY.
curl -X POST "https://panel.example.com/api/sites/12/deployments/318/redeploy" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"ok": true,
"deploymentId": 347
}
/api/sites/{id}/rollback
Roll back to a release
Points the site's "current" symlink at an earlier release directory and sends queue:restart, in the background. Creates a deployment row (branch "rollback", commit = release name) that ends as success or failed; follow it with the deploy stream.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
rollback.success, rollback.failed
Path parameters
idintegerrequired- Site id.
Body
releasestringrequired- Release directory name from GET /api/sites/{id}/releases.14 digits (pattern ^\d{14}$)
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Release 20261120093000 not found.No such directory under <rootPath>/releases (message contains the requested name).- 404
Site not foundNo site with this id.- 409
A deploy / rollback is already running.A deploy or rollback is running for the site. Rollbacks are never queued.
- Only the symlink is switched: no build, migrations or hooks run, and the database is not rolled back.
- php<version> artisan queue:restart is attempted for every stack; its failure is only logged ("โ queue:restart failed") and does not fail the rollback.
- The site status is not checked (unlike deploy).
- The rollback deployment row shows up in the deployment history with branch "rollback" and commit set to the release name, and counts as a successful deployment in some views.
curl -X POST "https://panel.example.com/api/sites/12/rollback" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"release": "20261120093000"
}'{
"started": true,
"deploymentId": 348
}
Push-to-deploy webhook
The endpoint GitHub calls when you push.
/api/sites/{id}/webhook-token
Generate webhook token
Generates a new random webhook token (48 hex characters) for the site, replacing any previous one. The token is both the secret part of the push-to-deploy URL /api/webhooks/github/{token} and the HMAC secret GitHub must sign with.
- Token or session
- Admin ยท Developer
- Needs site access
Path parameters
idintegerrequired- Site id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.
- The previous token stops working immediately: update both the payload URL and the secret in the GitHub webhook settings.
- No 404 check: for an unknown site id an admin gets a 500 (Prisma update error).
- No audit entry is written.
- No request body. Send this request without a body (or with a JSON body such as {}). Sending Content-Type: application/json with an empty body is rejected by Fastify with 400 FST_ERR_CTP_EMPTY_JSON_BODY.
curl -X POST "https://panel.example.com/api/sites/12/webhook-token" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"webhookToken": "5f0c2a9e7b1d4c3a8e6f0b2d4a6c8e0f1a3b5c7d9e1f2a4b"
}
/api/webhooks/github/{token}
Receive a GitHub push
GitHub webhook receiver. A signed push event for the site's configured branch starts a deploy of that site. Ping and other events are acknowledged without deploying.
- Signed webhook
- Audit:
deploy.success, deploy.failed
Path parameters
tokenstringrequired- The site's webhook token (see POST /api/sites/{id}/webhook-token). Also the HMAC secret.
Headers
X-GitHub-Eventstringrequired- GitHub event name. "ping" is acknowledged, "push" is processed, anything else is skipped.
X-Hub-Signature-256stringrequired- sha256=<hex HMAC-SHA256 of the raw request body, keyed with the webhook token>. Required for push events.exactly "sha256=" + 64 hex chars
X-GitHub-Deliverystring- GitHub delivery id; used for replay protection (a repeated id within 10 minutes is ignored).
Content-Typestringrequired- Must be application/json (set "Content type: application/json" in the GitHub webhook settings).application/json
Body
refstringrequired- Pushed ref, e.g. refs/heads/main.not validated
afterstringrequired- Commit SHA after the push; the first 7 characters are echoed in the response.not validated
Errors
- 400
No repository URL configured for this siteSignature valid and branch matches, but the site has no repoUrl.- 401
Invalid signatureX-Hub-Signature-256 is missing or does not match the HMAC of the raw body.- 404
Unknown webhook tokenpush event and no site has this webhook token.
- Order of checks and every 200 response: (1) X-GitHub-Event "ping" โ {"pong": true} (no token or signature check); (2) any event other than "push" โ {"skipped": true, "event": "<event>"}; (3) token lookup (404) and signature check (401); (4) duplicate X-GitHub-Delivery within 10 minutes โ {"skipped": true, "reason": "Duplicate delivery (replay ignored)"}; (5) branch mismatch โ {"skipped": true, "reason": "Branch '<pushed>' โ configured '<branch>'"}; (6) no repoUrl โ 400; (7) site status not active โ {"skipped": true, "reason": "Site status is '<status>'"}; (8) a deployment row in status running โ {"skipped": true, "reason": "Deploy already in progress"}; otherwise the deploy starts โ {"triggered": true, "deploymentId": <id>, "commit": "<first 7 chars of after>"}.
- Branch rule: "refs/heads/" is stripped from ref and the rest must equal the site's branch exactly. Tag pushes (refs/tags/โฆ) are therefore always skipped as a branch mismatch.
- The deploy always builds the branch HEAD (not necessarily the "after" commit). Webhook pushes are never queued: if a deploy is running, the push is skipped.
- Behaviour differs from a manual deploy: the webhook starts the deploy without the site's domain, health-check settings, server and hook scripts. Consequently no post-deploy health check or auto-rollback runs, no external deploy notification (Slack/Discord/Telegram/generic) is sent, the deploy runs on the panel's local server even if the site lives on a remote server, and the existing hooks/pre-deploy.sh and hooks/post-deploy.sh files are deleted before the deploy (so the hooks do not run). Deploy-time test settings are applied.
- Content types other than application/json are rejected by Fastify with 415 before the handler runs (this includes GitHub's application/x-www-form-urlencoded option). A body that is not valid JSON, or a push payload without ref/after, ends in a 500 error.
- If another deploy claims the site at the same moment, runDeploy's "Deploy already in progress" error is not caught here and surfaces as a 500.
- Replay protection is in memory (lost on API restart).
- Audit entries come from the deploy itself (deploy.success / deploy.failed when it ends).
curl -X POST "https://panel.example.com/api/webhooks/github/3f9c2a7b1d4e8f6a0c5b9d2e7f1a4c8b" \
-H "X-GitHub-Event: value" \
-H "X-Hub-Signature-256: value" \
-H "Content-Type: value" \
-H "Content-Type: application/json" \
-d '{
"ref": "refs/heads/main",
"after": "a3f9c21d8e4b5f6a7c8d9e0f1a2b3c4d5e6f7a8b",
"repository": {
"full_name": "example/shop",
"clone_url": "https://github.com/example/shop.git",
"ssh_url": "[email protected]:example/shop.git"
}
}'{
"triggered": true,
"deploymentId": 349,
"commit": "a3f9c21"
}
Staging and promote
Clone sites, create staging copies and promote a tested commit to production.
/api/sites/{id}/clone
Clone a site
Creates a new site (status "pending") that copies the source site's deploy configuration under a new name and domain. Only the panel record is created; the clone still has to be provisioned and deployed.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
site.cloned
Path parameters
idintegerrequired- Source site id.
Body
namestringrequired- Name of the new site.1โ100 chars
domainstringrequired- Domain of the new site.3โ253 chars, pattern ^[a-zA-Z0-9][a-zA-Z0-9\-\.]*[a-zA-Z0-9]$
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Source site not foundNo site with this id.
- Copied: phpVersion, repoUrl, branch, preDeploy, postDeploy, healthCheck, healthCheckUrl (verbatim, so it may still point at the source domain), tags.
- Not copied: gitToken, webhookToken, dbName/dbUser, deployments, stackType (defaults to laravel), serverId (the clone is always on the local server), test settings, security and status-page settings.
- A duplicate domain is not checked by the handler; the unique constraint makes Prisma throw, which surfaces as a 500.
curl -X POST "https://panel.example.com/api/sites/12/clone" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Shop EU",
"domain": "eu.shop.example.com"
}'{
"id": 14,
"name": "Shop EU",
"domain": "eu.shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": null,
"dbName": null,
"dbUser": null,
"sslEnabled": false,
"rootPath": "/var/www/sites/eu.shop.example.com",
"status": "pending",
"repoUrl": "https://github.com/example/shop.git",
"branch": "main",
"webhookToken": null,
"preDeploy": null,
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://shop.example.com/up",
"runTests": false,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": false,
"disabled": false,
"tags": "[\"client-a\",\"production\"]",
"notes": null,
"createdAt": "2026-11-27T10:00:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"hasGitToken": false
}
/api/sites/{id}/staging
Create a staging copy
Creates a staging copy of the site at staging.<domain> (status "pending") with the same repository, branch, hooks, stack and server, and stagingOf set to the source site. Only the panel record is created; provision and deploy it with the normal endpoints.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
site.staging_created
Path parameters
idintegerrequired- Production (source) site id.
Errors
- 400
This site is already a staging copy.The source site itself has stagingOf set.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Source site not foundNo site with this id.- 409
A site for staging.shop.example.com already exists.A site with domain staging.<domain> already exists (message contains the actual domain).
- No request body. Send this request without a body (or with a JSON body such as {}). Sending Content-Type: application/json with an empty body is rejected by Fastify with 400 FST_ERR_CTP_EMPTY_JSON_BODY.
- Copied: phpVersion, stackType, repoUrl, branch, preDeploy, postDeploy, serverId. healthCheck is forced to false and tags is set to ["staging"].
- Not copied: gitToken (set one with PATCH /api/sites/{id} before deploying a private repository), webhookToken, healthCheckUrl, test settings, database settings.
- Enable basic auth on the staging site if the preview must not be public; this endpoint does not do it.
curl -X POST "https://panel.example.com/api/sites/12/staging" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"id": 15,
"name": "Shop (staging)",
"domain": "staging.shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": 12,
"dbName": null,
"dbUser": null,
"sslEnabled": false,
"rootPath": "/var/www/sites/staging.shop.example.com",
"status": "pending",
"repoUrl": "https://github.com/example/shop.git",
"branch": "main",
"webhookToken": null,
"preDeploy": null,
"postDeploy": "php artisan optimize",
"healthCheck": false,
"healthCheckUrl": null,
"runTests": false,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": false,
"disabled": false,
"tags": "[\"staging\"]",
"notes": null,
"createdAt": "2026-11-27T10:00:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"hasGitToken": false
}
/api/sites/{id}/staging-copies
List staging copies
Lists the staging copies of a production site (sites whose stagingOf is this id), oldest first, each with the commit of its last successful deploy.
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Production site id.
Errors
- 400
Invalid site idid is not an integer.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.
- lastCommit / lastDeployedAt come from the newest successful non-rollback deployment (null if none).
- No 404: an unknown id returns {"copies": []}.
curl "https://panel.example.com/api/sites/12/staging-copies" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"copies": [
{
"id": 15,
"name": "Shop (staging)",
"domain": "staging.shop.example.com",
"status": "active",
"branch": "main",
"lastCommit": "c81e0b4",
"lastDeployedAt": "2026-11-27T10:00:00.000Z"
}
]
}
/api/sites/{id}/promote/preview
Preview a promote
Called on the STAGING site. Shows what promoting would do: which commit staging is on, what production is on, and any blockers or warnings. Read-only.
- Token or session
- Any role
- Needs site access
Path parameters
idintegerrequired- Staging site id.
Errors
- 400
Invalid site idid is not an integer.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.
- Commits are the short hashes of the newest successful non-rollback deployment of each site. differs is false only when production is known to be on the same commit (prefix match) and was not rolled back since.
- Blocker codes (promote is refused): not_staging, production_missing, production_is_staging, production_inactive, no_repo, repo_mismatch, no_successful_deploy, staging_deploy_running, production_deploy_running, production_deploy_queued. Each item is {"code", "message"}.
- Warning codes: staging_rolled_back, production_rolled_back, branch_differs.
- When the site is not a staging copy, production is null and blockers contains not_staging (still 200).
curl "https://panel.example.com/api/sites/12/promote/preview" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"staging": {
"id": 15,
"name": "Shop (staging)",
"domain": "staging.shop.example.com",
"branch": "main"
},
"production": {
"id": 12,
"name": "Shop",
"domain": "shop.example.com",
"branch": "main",
"status": "active",
"stackType": "laravel"
},
"stagingCommit": "c81e0b4",
"stagingDeploymentId": 352,
"stagingDeployedAt": "2026-11-27T10:00:00.000Z",
"productionCommit": "a3f9c21",
"productionDeployedAt": "2026-11-20T09:30:00.000Z",
"differs": true,
"blockers": [],
"warnings": []
}
/api/sites/{id}/promote
Promote staging to production
Called on the STAGING site. Deploys the production site at exactly the commit staging is on, through the normal deploy pipeline (tests, health check, atomic release switch and auto-rollback apply). Optionally takes a production database backup first. Never queues.
- Token or session
- Admin
- Needs site access
- Audit:
site.promoted, site.promote_aborted
Path parameters
idintegerrequired- Staging site id.
Body
forceboolean- Promote even when production is already on this commit or staging was rolled back after deploying it.
backupDbboolean- Back up the production database first; abort the promote when the backup fails or is empty.
expectedCommitstring- The staging commit shown in the preview. If staging has moved on since, the promote is refused.max 64 chars
Errors
- 400
<blocker message>The plan has a blocker. Body: {"error": <first blocker message>, "code": <blocker code>, "blockers": [...]}. Status per code: production_missing 404; staging_deploy_running, production_deploy_running, production_deploy_queued 409; all others 400.- 400
Invalid site idid is not an integer.- 400
Nothing to promote.No production site or no staging commit (defensive).- 400
The production site is not active.Production became inactive while the backup ran (code "production_inactive").- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Site not foundNo site with this id.- 409
A deploy is already running or queued on the production site.Production became busy while the backup ran (code "production_deploy_running").- 409
Deploy already in progressRace with another deploy starting on production.- 409
Production is already on this commit.Production is on the same commit and force is not true (code "same_commit").- 409
Staging has changed since you opened this dialog. Review the new commit and try again.expectedCommit differs from the current staging commit (code "plan_changed").- 409
Staging was rolled back after its last deploy, so it is currently serving an older release than the commit that would be promoted.Staging was rolled back and force is not true (code "staging_rolled_back").- 422
Could not resolve the full commit hash for c81e0b4.The short hash could not be resolved to exactly one full SHA from the staging release checkouts or the remote refs (code "commit_unresolved", plus "details").- 502
Production database backup failed โ promote aborted. Nothing was deployed.backupDb=true and the backup failed or is under 64 bytes (code "backup_failed", plus "details").
- The new production Deployment row carries comment "Promoted from <staging domain> @ <short commit>"; the deploy uses production's own repository token, branch, hooks and test settings and deploys the resolved full SHA as ref.
- Follow the deploy with GET /api/sites/{productionId}/deploy/stream.
- backupDb calls POST /api/sites/{productionId}/database/backup internally with the caller's Authorization header; backup is null in the response when not requested.
- Error bodies other than the plain {"error"} ones carry a machine-readable "code" (and for 422/502 a "details" string).
- site.promote_aborted is written only when the backup fails.
- The body is optional; an empty JSON object is fine.
curl -X POST "https://panel.example.com/api/sites/12/promote" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"backupDb": true,
"expectedCommit": "c81e0b4"
}'{
"started": true,
"deploymentId": 353,
"productionId": 12,
"productionDomain": "shop.example.com",
"commit": "c81e0b4",
"backup": {
"filename": "shop-2026-11-27-100000.sql.gz",
"sizeBytes": 482113
}
}
Presets
Reusable deploy settings and applying them to sites.
/api/presets
List presets
Lists all site presets (reusable bundles of deploy settings), sorted by name.
- Token or session
- Admin ยท Developer
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is a viewer (only admin and developer may call this).
- Viewers cannot read presets (they contain deploy hook scripts).
- config is the parsed and re-validated JSON; a stored config that no longer validates is returned as {}.
curl "https://panel.example.com/api/presets" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"presets": [
{
"id": 3,
"name": "Laravel production",
"description": "Optimize after deploy, health check, tests",
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://{{domain}}/up",
"runTests": true,
"testCommand": "php artisan test",
"testFailureMode": "block",
"tags": [
"production"
]
},
"createdById": 1,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z"
}
]
}
/api/presets/{presetId}
Get a preset
Returns one preset.
- Token or session
- Admin ยท Developer
Path parameters
presetIdintegerrequired- Preset id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is a viewer (only admin and developer may call this).- 404
Preset not foundNo preset with this id.
curl "https://panel.example.com/api/presets/1" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"id": 3,
"name": "Laravel production",
"description": "Optimize after deploy, health check, tests",
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://{{domain}}/up",
"runTests": true,
"testCommand": "php artisan test",
"testFailureMode": "block",
"tags": [
"production"
]
},
"createdById": 1,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z"
}
/api/presets
Create a preset
Creates a named preset from an explicit settings object.
- Token or session
- Admin
- Audit:
preset.created
Body
namestringrequired- Unique preset name (trimmed).1โ80 chars
descriptionstring- Description (trimmed; empty โ null).max 500 chars
configobjectrequired- The settings the preset applies. See notes for the allowed keys.object; whitelisted keys only, at least one
Errors
- 400
Invalid preset: <reason>config fails validation, e.g. "Invalid preset: Unknown preset field: domain", "Invalid preset: testTimeout must be a whole number between 10 and 3600", "Invalid preset: A preset must contain at least one setting".- 400
Preset name is requiredname is only whitespace.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 409
A preset with this name already exists.Another preset has this name.
- config may only contain: preDeploy (string โค 4096), postDeploy (string โค 4096), healthCheck (boolean), healthCheckUrl (string โค 500; "{{domain}}" is replaced by the target site's domain when applied), runTests (boolean), testCommand (non-empty string โค 500), testFailureMode ("block" | "warn"), testTimeout (integer 10โ3600), testUseSqlite (boolean), tags (array of โค 10 strings of 1โ50 chars; trimmed and de-duplicated), uptimeMonitor (boolean). Unknown keys inside config are rejected with 400 (not dropped), and config must contain at least one setting.
curl -X POST "https://panel.example.com/api/presets" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Laravel production",
"description": "Optimize after deploy, health check, tests",
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://{{domain}}/up",
"runTests": true,
"testFailureMode": "block"
}
}'{
"id": 3,
"name": "Laravel production",
"description": "Optimize after deploy, health check, tests",
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://{{domain}}/up",
"runTests": true,
"testCommand": "php artisan test",
"testFailureMode": "block",
"tags": [
"production"
]
},
"createdById": 1,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z"
}
/api/presets/from-site/{id}
Create a preset from a site
Creates a preset from a site's current deploy settings (all preset fields, or the chosen subset). The site's own domain inside healthCheckUrl is stored as the {{domain}} placeholder.
- Token or session
- Admin
- Audit:
preset.created
Path parameters
idintegerrequired- Site id.
Body
namestringrequired- Unique preset name (trimmed).1โ80 chars
descriptionstring- Description.max 500 chars
fieldsarray- Preset fields to capture; default all.max 20 items; each one of: preDeploy, postDeploy, healthCheck, healthCheckUrl, runTests, testCommand, testFailureMode, testTimeout, testUseSqlite, tags, uptimeMonitor
Errors
- 400
Invalid preset: <reason>config fails validation, e.g. "Invalid preset: Unknown preset field: domain", "Invalid preset: testTimeout must be a whole number between 10 and 3600", "Invalid preset: A preset must contain at least one setting".- 400
Preset name is requiredname is only whitespace.- 400
Unknown preset field: <field>fields contains a name that is not a preset field.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 404
Site not foundNo site with this id.- 409
A preset with this name already exists.Another preset has this name.
- Mounted under /api/presets, so the site-access check does not run (admins have access to every site anyway).
- Empty values are captured as they are (e.g. preDeploy "" when the site has no hook); an empty testCommand is left out.
curl -X POST "https://panel.example.com/api/presets/from-site/1" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Shop defaults",
"fields": [
"postDeploy",
"healthCheck",
"healthCheckUrl"
]
}'{
"id": 4,
"name": "Shop defaults",
"description": null,
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://{{domain}}/up"
},
"createdById": 1,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z"
}
/api/presets/{presetId}
Update a preset
Renames a preset, changes its description, or replaces its whole config. Sites the preset was applied to are not changed.
- Token or session
- Admin
- Audit:
preset.updated
Path parameters
presetIdintegerrequired- Preset id.
Body
namestring- New name (trimmed).1โ80 chars
descriptionstring- New description; empty string clears it.max 500 chars
configobject- Replaces the full config (not merged).same rules as on create
Errors
- 400
Invalid preset: <reason>config fails validation, e.g. "Invalid preset: Unknown preset field: domain", "Invalid preset: testTimeout must be a whole number between 10 and 3600", "Invalid preset: A preset must contain at least one setting".- 400
Preset name is requiredname is only whitespace.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 404
Preset not foundNo preset with this id.- 409
A preset with this name already exists.Another preset has this name.
- config may only contain: preDeploy (string โค 4096), postDeploy (string โค 4096), healthCheck (boolean), healthCheckUrl (string โค 500; "{{domain}}" is replaced by the target site's domain when applied), runTests (boolean), testCommand (non-empty string โค 500), testFailureMode ("block" | "warn"), testTimeout (integer 10โ3600), testUseSqlite (boolean), tags (array of โค 10 strings of 1โ50 chars; trimmed and de-duplicated), uptimeMonitor (boolean). Unknown keys inside config are rejected with 400 (not dropped), and config must contain at least one setting.
curl -X PATCH "https://panel.example.com/api/presets/1" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Optimize after deploy + health check",
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true
}
}'{
"id": 3,
"name": "Laravel production",
"description": "Optimize after deploy, health check, tests",
"config": {
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://{{domain}}/up",
"runTests": true,
"testCommand": "php artisan test",
"testFailureMode": "block",
"tags": [
"production"
]
},
"createdById": 1,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z"
}
/api/presets/{presetId}
Delete a preset
Deletes a preset. Sites that had it applied keep their settings.
- Token or session
- Admin
- Audit:
preset.deleted
Path parameters
presetIdintegerrequired- Preset id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is not an admin.- 404
Preset not foundNo preset with this id.
curl -X DELETE "https://panel.example.com/api/presets/1" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"ok": true
}
/api/sites/{id}/preset-preview/{presetId}
Preview applying a preset
Shows which of the site's settings applying the preset would change (with old and new values) and which already match. Read-only.
- Token or session
- Admin ยท Developer
- Needs site access
Path parameters
idintegerrequired- Site id.
presetIdintegerrequired- Preset id.
Errors
- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleCaller is a viewer (only admin and developer may call this).- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Preset not foundNo preset with this id.- 404
Site not foundNo site with this id.
- "to" values have {{domain}} already replaced by this site's domain. Unset site values appear as "" (strings) in "from"; tags are compared as arrays.
curl "https://panel.example.com/api/sites/12/preset-preview/1" \
-H "Authorization: Bearer $ORCH_TOKEN"{
"preset": {
"id": 3,
"name": "Laravel production"
},
"changes": [
{
"field": "runTests",
"from": false,
"to": true
},
{
"field": "healthCheckUrl",
"from": "",
"to": "https://shop.example.com/up"
}
],
"unchanged": [
"postDeploy",
"healthCheck"
]
}
/api/sites/{id}/apply-preset
Apply a preset to a site
Copies the preset's settings onto the site; only the columns the preset contains are written. For an active site the deploy hook files are rewritten on the server when the preset contains preDeploy or postDeploy.
- Token or session
- Admin ยท Developer
- Needs site access
- Audit:
site.preset_applied
Path parameters
idintegerrequired- Site id.
Body
presetIdintegerrequired- Preset to apply.minimum 1
Errors
- 400
This preset is empty or invalid.The stored config is empty or no longer validates.- 401
Invalid or expired access tokenThe personal access token is unknown, revoked or expired.- 401
UnauthorizedNo token, or an invalid session.- 403
Forbidden: insufficient roleYour role may not call this endpoint.- 403
Forbidden: no access to this siteYour account has no access to this site.- 404
Preset not foundNo preset with this id.- 404
Site not foundNo site with this id.
- site is the Site row without deployments, gitToken replaced by hasGitToken.
- hookWarning (string) is added when writing the hook files failed; the settings are saved anyway (every deploy rewrites the hooks).
- A preset never changes the repository, branch, domain, stack, tokens, nginx, PHP-FPM, database or .env. An empty healthCheckUrl in the preset is stored as null.
curl -X POST "https://panel.example.com/api/sites/12/apply-preset" \
-H "Authorization: Bearer $ORCH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"presetId": 3
}'{
"ok": true,
"site": {
"id": 12,
"name": "Shop",
"domain": "shop.example.com",
"serverId": null,
"phpVersion": "8.3",
"stackType": "laravel",
"stagingOf": null,
"dbName": "shop",
"dbUser": "shop",
"sslEnabled": true,
"rootPath": "/var/www/sites/shop.example.com",
"status": "active",
"repoUrl": "https://github.com/example/shop.git",
"branch": "main",
"webhookToken": "5f0c2a9e7b1d4c3a8e6f0b2d4a6c8e0f1a3b5c7d9e1f2a4b",
"preDeploy": null,
"postDeploy": "php artisan optimize",
"healthCheck": true,
"healthCheckUrl": "https://shop.example.com/up",
"runTests": true,
"testCommand": "php artisan test",
"testFailureMode": "block",
"testTimeout": 300,
"testUseSqlite": true,
"deployQueued": false,
"maintenanceMode": false,
"uptimeMonitor": true,
"statusPageEnabled": false,
"statusPageToken": null,
"secBasicAuth": false,
"secBasicUser": null,
"secBasicHash": null,
"secIpMode": null,
"secIpList": null,
"pinned": true,
"disabled": false,
"tags": "[\"client-a\",\"production\"]",
"notes": null,
"createdAt": "2026-11-20T09:30:00.000Z",
"updatedAt": "2026-11-27T10:00:00.000Z",
"trafficLog": false,
"hasGitToken": true
},
"changed": [
"runTests",
"healthCheckUrl"
]
}