Skip to content

API reference

Automation, AI and Telegram

Webhooks and automation rules, the AI assistant and the Telegram bot.

Automation

Outgoing webhooks, automation rules and their logs.

GET /api/automation/event-types

List event and action types

Returns the catalogue of panel event types (for webhook filters and rule triggers) and the supported rule action types.

  • Token or session
  • Admin

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • site.down, site.up and ssl.expiring are listed but no code in apps/api/src currently emits them.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/automation/event-types" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "events": [
        "deploy.succeeded",
        "deploy.failed",
        "site.down",
        "site.up",
        "ssl.expiring",
        "billing.invoice_paid",
        "billing.suspended",
        "billing.restored",
        "fleet.alert",
        "fleet.alert_resolved"
    ],
    "actions": [
        "notify",
        "telegram",
        "webhook"
    ]
}
GET /api/automation/webhooks

List outbound webhooks

Lists outbound webhooks, newest first. Secrets are never returned; hasSecret tells whether one is set.

  • Token or session
  • Admin

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • events is the parsed filter array ([] = all events).
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/automation/webhooks" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "webhooks": [
        {
            "id": 4,
            "name": "Ops channel",
            "url": "https://hooks.example.com/orchestrator",
            "events": [
                "deploy.failed",
                "billing.suspended"
            ],
            "active": true,
            "hasSecret": true,
            "createdAt": "2026-11-27T10:00:00.000Z"
        }
    ]
}
POST /api/automation/webhooks

Create an outbound webhook

Creates an outbound webhook. While active, the panel POSTs every matching event as JSON { event, data, at } with headers x-orchestrator-event and, when a secret is set, x-orchestrator-signature: sha256=<hex HMAC-SHA256 of the raw body>. Inactive by default.

  • Token or session
  • Admin
  • Audit: webhook.created

Body

name stringrequired
Display name.1–100 chars
url stringrequired
Endpoint the panel POSTs events to.1–2000 chars; must start with http:// or https://
secret string
HMAC-SHA256 signing key (write-only; encrypted at rest, never returned β€” responses only show hasSecret).max 200 chars
events array
Event types to deliver; [] (default) = all events.array of strings, max 50 items; values are not checked against the event catalogue
active boolean
Deliveries only happen while active.default false

Errors

400
URL must start with http:// or https:// url has another scheme.
400
body must have required property 'url' Schema validation failure (FST_ERR_VALIDATION; message varies).
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • Deliveries are fire-and-forget with a 10-second timeout and no retries; each attempt is logged (newest 100 kept per webhook).
  • Unknown body fields are removed silently (additionalProperties: false).
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/automation/webhooks" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ops channel",
    "url": "https://hooks.example.com/orchestrator",
    "secret": "example-signing-secret",
    "events": [
        "deploy.failed",
        "billing.suspended"
    ],
    "active": true
}'
201Response Β· application/json
{
    "id": 4,
    "name": "Ops channel",
    "url": "https://hooks.example.com/orchestrator",
    "events": [
        "deploy.failed",
        "billing.suspended"
    ],
    "active": true,
    "hasSecret": true,
    "createdAt": "2026-11-27T10:00:00.000Z"
}
PATCH /api/automation/webhooks/{id}

Update an outbound webhook

Updates the given webhook fields only. Sending secret replaces the signing key; an empty string removes it.

  • Token or session
  • Admin
  • Audit: webhook.updated

Path parameters

id integerrequired
Webhook id.not validated (Number(...) of the path segment)

Body

name string
Display name.1–100 chars
url string
Endpoint the panel POSTs events to.1–2000 chars; must start with http:// or https://
secret string
HMAC-SHA256 signing key (write-only; encrypted at rest, never returned β€” responses only show hasSecret). An empty string removes the secret.max 200 chars
events array
Event types to deliver; [] (default) = all events.array of strings, max 50 items; values are not checked against the event catalogue
active boolean
Deliveries only happen while active.

Errors

400
URL must start with http:// or https:// url given with another scheme.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Webhook not found No webhook with this id (any update failure is reported as 404).
  • Unknown body fields are removed silently (additionalProperties: false).
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X PATCH "https://panel.example.com/api/automation/webhooks/3" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "active": false,
    "events": []
}'
200Response Β· application/json
{
    "id": 4,
    "name": "Ops channel",
    "url": "https://hooks.example.com/orchestrator",
    "events": [],
    "active": false,
    "hasSecret": true,
    "createdAt": "2026-11-27T10:00:00.000Z"
}
DELETE /api/automation/webhooks/{id}

Delete an outbound webhook

Deletes a webhook and its delivery log.

  • Token or session
  • Admin
  • Audit: webhook.deleted

Path parameters

id integerrequired
Webhook id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • Returns { ok: true } (and writes the audit entry) even when no webhook has this id.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X DELETE "https://panel.example.com/api/automation/webhooks/3" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true
}
GET /api/automation/webhooks/{id}/deliveries

List webhook deliveries

Returns the newest 50 delivery attempts of a webhook, including test pings.

  • Token or session
  • Admin

Path parameters

id integerrequired
Webhook id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • statusCode is null and error holds the exception message when the request failed or timed out. An unknown webhook id returns an empty list.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/automation/webhooks/3/deliveries" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "deliveries": [
        {
            "id": 310,
            "webhookId": 4,
            "event": "deploy.failed",
            "success": false,
            "statusCode": 500,
            "error": "HTTP 500",
            "createdAt": "2026-11-27T10:00:00.000Z"
        }
    ]
}
POST /api/automation/webhooks/{id}/test

Send a test delivery

Immediately POSTs a test.ping event to the webhook URL (even if the webhook is inactive), signed like a real delivery, waits up to 10 seconds, logs the attempt and reports the outcome.

  • Token or session
  • Admin

Path parameters

id integerrequired
Webhook id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Webhook not found No webhook with this id.
502
<network or timeout error message> The request could not be sent or timed out after 10 s; body is { ok: false, error: <message> }.
  • Sent body: { "event": "test.ping", "data": { "message": "Orchestrator test delivery" }, "at": <ISO time> } with headers content-type: application/json, x-orchestrator-event: test.ping and, when a secret is set, x-orchestrator-signature: sha256=<hex HMAC-SHA256 of the body>.
  • A non-2xx answer from the endpoint still returns HTTP 200 here, with ok: false and its statusCode.
  • No audit entry is written. The test route itself does not prune the delivery log (real deliveries keep the newest 100).
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/automation/webhooks/3/test" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true,
    "statusCode": 200
}
GET /api/automation/rules

List automation rules

Lists automation rules, newest first, with conditions and actionConfig parsed from JSON.

  • Token or session
  • Admin

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • Rules run asynchronously (fire-and-forget) when the panel emits an event whose type equals trigger, and only while enabled. Each evaluation is logged as an AutomationRun (newest 100 kept per rule); with dryRun the run records actionTaken "would <actionType>".
  • Actions: notify creates a panel notification; telegram sends via the configured notification channel; webhook POSTs { event, data: <payload>, at } as JSON to actionConfig.url with a 10-second timeout. No action can change a hosted site.
  • Event payload fields usable in conditions/placeholders: deploy.succeeded / deploy.failed β†’ siteId, domain, branch, commit, status, testsPassed, testsFailed, testsTotal; billing.invoice_paid β†’ invoiceId, number, currency, fullyPaid, restored; billing.suspended β†’ siteId, domain, level; billing.restored β†’ invoiceId, subscriptionId; fleet.alert β†’ eventId, serverId, serverName, kind, ruleId, message, value; fleet.alert_resolved β†’ eventId, serverId, serverName, kind, ruleId, message.
  • site.down, site.up and ssl.expiring are in the event catalogue but no code in apps/api/src currently emits them.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/automation/rules" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "rules": [
        {
            "id": 2,
            "name": "Alert on failed deploys",
            "trigger": "deploy.failed",
            "conditions": [
                {
                    "field": "domain",
                    "op": "contains",
                    "value": "shop"
                }
            ],
            "actionType": "notify",
            "actionConfig": {
                "title": "Deploy failed on {{domain}}",
                "body": "Branch {{branch}} at {{commit}}",
                "level": "critical"
            },
            "enabled": true,
            "dryRun": false,
            "lastFiredAt": "2026-11-27T10:00:00.000Z",
            "createdAt": "2026-11-27T10:00:00.000Z",
            "updatedAt": "2026-11-27T10:00:00.000Z"
        }
    ]
}
POST /api/automation/rules

Create an automation rule

Creates a rule that reacts to a panel event: when an event of type trigger is emitted and all conditions match, the action runs. New rules are disabled and in dry-run mode unless enabled/dryRun say otherwise.

  • Token or session
  • Admin
  • Audit: automation.rule_created

Body

name stringrequired
Rule name.1–100 chars
trigger stringrequired
Event type that fires the rule (exact match).1–64 chars; not checked against the event catalogue
conditions array
Conditions, all of which must match (AND). [] = always matches.max 20 items; items not validated; default []
conditions[].field string
Dotted path into the event payload, e.g. domain or testsFailed.not validated
conditions[].op string
Comparison operator. eq/neq compare as strings; gt/gte/lt/lte compare as numbers; contains is a case-insensitive substring test. Any other value never matches.one of: eq, neq, gt, gte, lt, lte, contains (not validated)
conditions[].value string
Value to compare with.not validated; any JSON value
actionType stringrequired
What to do when the rule matches.one of: notify, telegram, webhook
actionConfig object
Action parameters (keys depend on actionType; see notes). title/body/message support {{field}} placeholders from the event payload.object; keys not validated; default {}
actionConfig.title string
notify: notification title (default "Automation: <event>"); telegram: message title (default the event type).not validated
actionConfig.body string
notify: notification body.not validated
actionConfig.message string
telegram: message text.not validated
actionConfig.level string
notify: notification level (default info). telegram: "critical" sends as a failure, anything else as a warning.notify: info, success, warning, critical (not validated)
actionConfig.url string
webhook: URL to POST the event to (required for that action at run time; no placeholders, no signature).not validated
enabled boolean
Rules only run while enabled.default false
dryRun boolean
Record what would happen without performing the action.default true

Errors

400
body/actionType must be equal to one of the allowed values Schema validation failure (FST_ERR_VALIDATION; message varies).
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • Unlike GET /rules, the response returns conditions and actionConfig as raw JSON strings.
  • Unknown body fields are removed silently (additionalProperties: false).
  • Rules run asynchronously (fire-and-forget) when the panel emits an event whose type equals trigger, and only while enabled. Each evaluation is logged as an AutomationRun (newest 100 kept per rule); with dryRun the run records actionTaken "would <actionType>".
  • Actions: notify creates a panel notification; telegram sends via the configured notification channel; webhook POSTs { event, data: <payload>, at } as JSON to actionConfig.url with a 10-second timeout. No action can change a hosted site.
  • Event payload fields usable in conditions/placeholders: deploy.succeeded / deploy.failed β†’ siteId, domain, branch, commit, status, testsPassed, testsFailed, testsTotal; billing.invoice_paid β†’ invoiceId, number, currency, fullyPaid, restored; billing.suspended β†’ siteId, domain, level; billing.restored β†’ invoiceId, subscriptionId; fleet.alert β†’ eventId, serverId, serverName, kind, ruleId, message, value; fleet.alert_resolved β†’ eventId, serverId, serverName, kind, ruleId, message.
  • site.down, site.up and ssl.expiring are in the event catalogue but no code in apps/api/src currently emits them.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/automation/rules" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alert on failed deploys",
    "trigger": "deploy.failed",
    "conditions": [
        {
            "field": "domain",
            "op": "contains",
            "value": "shop"
        }
    ],
    "actionType": "notify",
    "actionConfig": {
        "title": "Deploy failed on {{domain}}",
        "body": "Branch {{branch}} at {{commit}}",
        "level": "critical"
    },
    "enabled": false,
    "dryRun": true
}'
201Response Β· application/json
{
    "id": 2,
    "name": "Alert on failed deploys",
    "trigger": "deploy.failed",
    "conditions": "[{\"field\":\"domain\",\"op\":\"contains\",\"value\":\"shop\"}]",
    "actionType": "notify",
    "actionConfig": "{\"title\":\"Deploy failed on {{domain}}\",\"body\":\"Branch {{branch}} at {{commit}}\",\"level\":\"critical\"}",
    "enabled": false,
    "dryRun": true,
    "lastFiredAt": null,
    "createdAt": "2026-11-27T10:00:00.000Z",
    "updatedAt": "2026-11-27T10:00:00.000Z"
}
PATCH /api/automation/rules/{id}

Update an automation rule

Updates the given rule fields only (e.g. enable it or switch dry-run off).

  • Token or session
  • Admin
  • Audit: automation.rule_updated

Path parameters

id integerrequired
Rule id.not validated (Number(...) of the path segment)

Body

name string
Rule name.1–100 chars
trigger string
Event type that fires the rule (exact match).1–64 chars; not checked against the event catalogue
conditions array
Conditions, all of which must match (AND). [] = always matches.max 20 items; items not validated
conditions[].field string
Dotted path into the event payload, e.g. domain or testsFailed.not validated
conditions[].op string
Comparison operator. eq/neq compare as strings; gt/gte/lt/lte compare as numbers; contains is a case-insensitive substring test. Any other value never matches.one of: eq, neq, gt, gte, lt, lte, contains (not validated)
conditions[].value string
Value to compare with.not validated; any JSON value
actionType string
What to do when the rule matches.one of: notify, telegram, webhook
actionConfig object
Action parameters (keys depend on actionType; see notes). title/body/message support {{field}} placeholders from the event payload.object; keys not validated
actionConfig.title string
notify: notification title (default "Automation: <event>"); telegram: message title (default the event type).not validated
actionConfig.body string
notify: notification body.not validated
actionConfig.message string
telegram: message text.not validated
actionConfig.level string
notify: notification level (default info). telegram: "critical" sends as a failure, anything else as a warning.notify: info, success, warning, critical (not validated)
actionConfig.url string
webhook: URL to POST the event to (required for that action at run time; no placeholders, no signature).not validated
enabled boolean
Rules only run while enabled.
dryRun boolean
Record what would happen without performing the action.

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Rule not found No rule with this id (any update failure is reported as 404).
  • The response returns conditions and actionConfig as raw JSON strings.
  • Unknown body fields are removed silently (additionalProperties: false).
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X PATCH "https://panel.example.com/api/automation/rules/3" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "dryRun": false
}'
200Response Β· application/json
{
    "id": 2,
    "name": "Alert on failed deploys",
    "trigger": "deploy.failed",
    "conditions": "[{\"field\":\"domain\",\"op\":\"contains\",\"value\":\"shop\"}]",
    "actionType": "notify",
    "actionConfig": "{\"title\":\"Deploy failed on {{domain}}\",\"body\":\"Branch {{branch}} at {{commit}}\",\"level\":\"critical\"}",
    "enabled": true,
    "dryRun": false,
    "lastFiredAt": "2026-11-27T10:00:00.000Z",
    "createdAt": "2026-11-27T10:00:00.000Z",
    "updatedAt": "2026-11-27T10:00:00.000Z"
}
DELETE /api/automation/rules/{id}

Delete an automation rule

Deletes a rule and its run log.

  • Token or session
  • Admin
  • Audit: automation.rule_deleted

Path parameters

id integerrequired
Rule id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • Returns { ok: true } (and writes the audit entry) even when no rule has this id.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X DELETE "https://panel.example.com/api/automation/rules/3" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true
}
GET /api/automation/rules/{id}/runs

List rule runs

Returns the newest 50 evaluations of a rule: whether its conditions matched, whether it was a dry run, and what action was taken.

  • Token or session
  • Admin

Path parameters

id integerrequired
Rule id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • actionTaken: the action type when executed, "would <type>" in dry run, "error" when the action threw (detail = error message), null when conditions did not match. detail examples: "notification created", "telegram sent", "POST <url> β†’ 200", or in dry run "notify: <title>" / "telegram: <message>" / "POST <url>".
  • An unknown rule id returns an empty list.
  • All /api/automation routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/automation/rules/3/runs" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "runs": [
        {
            "id": 77,
            "ruleId": 2,
            "event": "deploy.failed",
            "matched": true,
            "dryRun": false,
            "actionTaken": "notify",
            "detail": "notification created",
            "createdAt": "2026-11-27T10:00:00.000Z"
        }
    ]
}

AI assistant

AI configuration, chat, explanations and history.

GET /api/ai/config

Get AI configuration

Returns the AI assistant configuration and today's usage. The API key is never returned; configured tells whether one is stored.

  • Token or session
  • Admin

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • model is the effective model (the provider's default model when none is set, e.g. gpt-4o-mini for openai); baseUrl is the raw stored value ("" = provider default https://api.anthropic.com or https://api.openai.com/v1).
  • provider is openai unless the stored value is anthropic. usageToday counts provider requests for the current UTC date; dailyLimit 0 = unlimited.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/config" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "enabled": true,
    "provider": "openai",
    "model": "gpt-4o-mini",
    "baseUrl": "",
    "configured": true,
    "usageToday": 14,
    "dailyLimit": 100
}
PATCH /api/ai/config

Update AI configuration

Updates the AI provider settings; only the fields sent are changed. The API key is write-only and stored encrypted.

  • Token or session
  • Admin
  • Audit: ai.config

Body

enabled boolean
Turn the assistant on or off.
provider string
Provider API style. openai covers any OpenAI-compatible endpoint (Ollama, LocalAI, groq…).one of: openai, anthropic
model string
Model name; "" = provider default.max 100 chars
baseUrl string
API base URL; "" = provider default. Trailing slashes are removed when used.max 300 chars; format not checked
apiKey string
Provider API key (write-only, encrypted at rest).max 300 chars; an empty string is ignored (the stored key is kept)
dailyLimit integer
Max provider requests per UTC day; 0 = unlimited.0–100000

Errors

400
body/provider must be equal to one of the allowed values Schema validation failure (FST_ERR_VALIDATION; message varies).
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • The stored API key cannot be cleared through this endpoint (empty strings are ignored).
  • Unknown body fields are removed silently (additionalProperties: false).
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X PATCH "https://panel.example.com/api/ai/config" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "provider": "openai",
    "model": "gpt-4o-mini",
    "apiKey": "sk-ant-example-key",
    "dailyLimit": 100
}'
200Response Β· application/json
{
    "ok": true
}
POST /api/ai/test

Test the AI connection

Sends a tiny prompt ("Reply with the single word: OK", max 5 tokens) to the configured provider to check connectivity and the API key. The attempt is stored in the AI history as kind test.

  • Token or session
  • Admin

Errors

400
AI assistant is disabled. Enable it in Settings β†’ Integrations. The assistant is not enabled.
400
No AI API key configured. No API key is stored.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
502
<provider error message> The provider call failed: its own error message, "AI request failed (<status>)", or "AI request timed out." after 45 s.
502
Daily AI request limit reached (100). Raise it in Settings β†’ Integrations. The daily limit is exceeded β€” this route maps it to 502, not 429.
  • Every provider request counts toward the daily limit (dailyLimit; 0 = unlimited) per UTC day; the counter is incremented before the check, so refused requests count too.
  • No body is read. No audit entry is written.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/ai/test" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true,
    "reply": "OK"
}
POST /api/ai/chat

Chat with the assistant

Asks the read-only assistant a question, optionally grounded in a site's context (PHP version, status, last deploy and up to 5 unresolved errors, redacted). Conversations are stored server-side per user: omit conversationId to start a new one, pass it to continue (the last 8 answered turns are replayed). Secrets and email addresses are redacted before anything is sent to the provider.

  • Token or session
  • Admin
  • Audit: ai.chat

Body

message stringrequired
The question.1–4000 chars
siteId integer
Site to use as context (an unknown id is ignored).
conversationId integer
Your existing conversation to continue.must belong to the caller
history array
Legacy: client-side transcript, only used when no stored conversation is continued (last 10 items).max 20 items
history[].role stringrequired
Speaker.one of: user, assistant
history[].content stringrequired
Message text.max 4000 chars

Errors

400
AI assistant is disabled. Enable it in Settings β†’ Integrations. The assistant is not enabled.
400
No AI API key configured. No API key is stored.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Conversation not found conversationId does not exist or belongs to another user.
429
Daily AI request limit reached (100). Raise it in Settings β†’ Integrations. The daily limit is exceeded.
502
<provider error message> The provider call failed: its own error message, "AI request failed (<status>)", or "AI request timed out." after 45 s. The body then also carries conversationId and interactionId of the stored failed turn.
  • Error bodies: pre-flight refusals (disabled / no key / limit) for a NEW conversation return { error } and the just-created conversation is deleted again; otherwise errors return { error, conversationId, interactionId } (interactionId null when nothing reached the provider).
  • conversationId in the reply is null only when the conversation could not be stored (the answer is still valid); interactionId is null when the history row could not be written. title is the conversation title (first ~80 chars of the first question by default).
  • The answer is capped at 900 tokens; the provider call times out after 45 s. Every provider request counts toward the daily limit (dailyLimit; 0 = unlimited) per UTC day; the counter is incremented before the check, so refused requests count too.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/ai/chat" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Why is the queue on shop.example.com backing up?",
    "siteId": 7,
    "conversationId": 31
}'
200Response Β· application/json
{
    "reply": "Check whether the queue worker is running: supervisorctl status…",
    "conversationId": 31,
    "title": "Why is the queue on shop.example.com backing up?",
    "interactionId": 512,
    "model": "gpt-4o-mini"
}
GET /api/ai/conversations

List my conversations

Lists the caller's own chat conversations (up to 200), most recently updated first, with the number of stored turns.

  • Token or session
  • Admin

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • Only conversations whose userId is the caller are returned (works the same with a personal access token, which acts as its owner).
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/conversations" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "conversations": [
        {
            "id": 31,
            "title": "Why is the queue on shop.example.com backing up?",
            "siteId": 7,
            "createdAt": "2026-11-27T10:00:00.000Z",
            "updatedAt": "2026-11-27T10:00:00.000Z",
            "messages": 4
        }
    ]
}
GET /api/ai/conversations/{id}

Get a conversation

Returns one of the caller's conversations with its turns, oldest first (the newest 200 turns at most).

  • Token or session
  • Admin

Path parameters

id integerrequired
Conversation id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Conversation not found No such conversation or it belongs to another user.
  • question is the redacted question without the site-context prefix; a failed turn has response null and error set.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/conversations/14" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "id": 31,
    "title": "Why is the queue on shop.example.com backing up?",
    "siteId": 7,
    "createdAt": "2026-11-27T10:00:00.000Z",
    "updatedAt": "2026-11-27T10:00:00.000Z",
    "turns": [
        {
            "id": 512,
            "createdAt": "2026-11-27T10:00:00.000Z",
            "question": "Why is the queue on shop.example.com backing up?",
            "response": "Check whether the queue worker is running…",
            "error": null,
            "model": "gpt-4o-mini",
            "siteId": 7,
            "siteDomain": "shop.example.com"
        }
    ]
}
PATCH /api/ai/conversations/{id}

Rename a conversation

Renames one of the caller's conversations. Whitespace runs are collapsed and the title is trimmed.

  • Token or session
  • Admin

Path parameters

id integerrequired
Conversation id.not validated (Number(...) of the path segment)

Body

title stringrequired
New title.1–120 chars

Errors

400
Title is required The title is only whitespace.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Conversation not found No such conversation or it belongs to another user.
  • No audit entry is written.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X PATCH "https://panel.example.com/api/ai/conversations/14" \
  -H "Authorization: Bearer $ORCH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Queue backlog on shop"
}'
200Response Β· application/json
{
    "ok": true,
    "title": "Queue backlog on shop"
}
DELETE /api/ai/conversations/{id}

Delete a conversation

Removes one of the caller's conversations from the chat list. Its questions and answers stay in the AI history (detached from the conversation).

  • Token or session
  • Admin
  • Audit: ai.conversation_deleted

Path parameters

id integerrequired
Conversation id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Conversation not found No such conversation or it belongs to another user.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X DELETE "https://panel.example.com/api/ai/conversations/14" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true
}
GET /api/ai/explain-error/{id}

Get stored error explanations

Returns what the AI has already said about a grouped log error β€” the cached explanation and every stored explanation (newest first, up to 100) β€” without calling the provider.

  • Token or session
  • Admin

Path parameters

id integerrequired
Grouped log error id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Error not found No log error with this id.
  • explanation is null when the error was never explained. A history read failure yields an empty history rather than an error.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/explain-error/14" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "explanation": "Likely cause: the queue worker cannot reach Redis…",
    "history": [
        {
            "id": 120,
            "kind": "explain_error",
            "createdAt": "2026-11-27T10:00:00.000Z",
            "userEmail": "[email protected]",
            "provider": "openai",
            "model": "gpt-4o-mini",
            "durationMs": 4210,
            "response": "Likely cause: the queue worker cannot reach Redis…",
            "error": null
        }
    ]
}
POST /api/ai/explain-error/{id}

Explain a log error

Asks the AI to explain a grouped log error (level, exception class, count, redacted message and sample line) and caches the answer on the error. Returns the cached explanation without calling the provider unless force=1.

  • Token or session
  • Admin
  • Audit: ai.explain_error

Path parameters

id integerrequired
Grouped log error id.not validated (Number(...) of the path segment)

Query parameters

force string
Set to 1 to regenerate even when an explanation is cached.only the exact value "1" forces

Errors

400
AI assistant is disabled. Enable it in Settings β†’ Integrations. The assistant is not enabled.
400
No AI API key configured. No API key is stored.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Error not found No log error with this id.
502
<provider error message> The provider call failed: its own error message, "AI request failed (<status>)", or "AI request timed out." after 45 s.
502
Daily AI request limit reached (100). Raise it in Settings β†’ Integrations. The daily limit is exceeded β€” this route maps it to 502, not 429.
  • Cached response: { explanation, cached: true, history } (no interactionId, no provider call, no audit). No body is read.
  • Every provider request counts toward the daily limit (dailyLimit; 0 = unlimited) per UTC day; the counter is incremented before the check, so refused requests count too.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/ai/explain-error/14" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "explanation": "Likely cause: the queue worker cannot reach Redis…",
    "cached": false,
    "interactionId": 120,
    "history": [
        {
            "id": 120,
            "kind": "explain_error",
            "createdAt": "2026-11-27T10:00:00.000Z",
            "userEmail": "[email protected]",
            "provider": "openai",
            "model": "gpt-4o-mini",
            "durationMs": 4210,
            "response": "Likely cause: the queue worker cannot reach Redis…",
            "error": null
        }
    ]
}
GET /api/ai/explain-deploy/{deploymentId}

Get stored deploy diagnoses

Returns the stored AI diagnoses of a deployment (newest first, up to 100) and the latest successful one, without calling the provider.

  • Token or session
  • Admin

Path parameters

deploymentId integerrequired
Deployment id.not validated

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • explanation is null when there is no successful diagnosis. An unknown deployment id returns { explanation: null, history: [] } (no 404).
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/explain-deploy/318" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "explanation": "The build failed because composer could not resolve…",
    "history": [
        {
            "id": 121,
            "kind": "explain_deploy",
            "createdAt": "2026-11-27T10:00:00.000Z",
            "userEmail": "[email protected]",
            "provider": "openai",
            "model": "gpt-4o-mini",
            "durationMs": 4210,
            "response": "The build failed because composer could not resolve…",
            "error": null
        }
    ]
}
POST /api/ai/explain-deploy/{deploymentId}

Diagnose a deployment

Asks the AI to diagnose a deployment from the redacted tail of its log (last 6000 chars) plus site, status, branch and commit. Returns the latest stored diagnosis without calling the provider unless force=1.

  • Token or session
  • Admin
  • Audit: ai.explain_deploy

Path parameters

deploymentId integerrequired
Deployment id.not validated

Query parameters

force string
Set to 1 to diagnose again even when a diagnosis is stored.only the exact value "1" forces

Errors

400
AI assistant is disabled. Enable it in Settings β†’ Integrations. The assistant is not enabled.
400
No AI API key configured. No API key is stored.
400
This deployment has no log to analyse. A new diagnosis is needed and the deployment has no log.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
Deployment not found No deployment with this id.
502
<provider error message> The provider call failed: its own error message, "AI request failed (<status>)", or "AI request timed out." after 45 s.
502
Daily AI request limit reached (100). Raise it in Settings β†’ Integrations. The daily limit is exceeded β€” this route maps it to 502, not 429.
  • Cached response: { explanation, cached: true, interactionId: <id of the stored answer>, history } with no provider call and no audit. The answer is capped at 800 tokens. No body is read.
  • Every provider request counts toward the daily limit (dailyLimit; 0 = unlimited) per UTC day; the counter is incremented before the check, so refused requests count too.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X POST "https://panel.example.com/api/ai/explain-deploy/318" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "explanation": "The build failed because composer could not resolve…",
    "cached": false,
    "interactionId": 121,
    "history": [
        {
            "id": 121,
            "kind": "explain_deploy",
            "createdAt": "2026-11-27T10:00:00.000Z",
            "userEmail": "[email protected]",
            "provider": "openai",
            "model": "gpt-4o-mini",
            "durationMs": 4210,
            "response": "The build failed because composer could not resolve…",
            "error": null
        }
    ]
}
GET /api/ai/history

List AI history

Lists everything the AI was asked across the panel, by any user, newest first, with cursor pagination. Each item carries a short title and a preview of the answer.

  • Token or session
  • Admin

Query parameters

kind string
Only this kind of interaction.one of: chat, explain_error, explain_deploy, test
siteId integer
Only interactions about this site.digits only; other values are ignored
q string
Text search in title, prompt, response, site domain and error.trimmed, first 200 chars used
logErrorId integer
Only explanations of this log error.digits only; other values are ignored
deploymentId integer
Only diagnoses of this deployment.digits only; other values are ignored
cursor integer
nextCursor from the previous page: returns entries with an id lower than this.digits only; other values are ignored
limit integer
Page size.default 30, min 1, max 100 (clamped)

Errors

400
Unknown history kind kind is not one of chat, explain_error, explain_deploy, test.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
  • nextCursor is the id of the last item when more entries exist, otherwise null. Pass it as cursor to get the next page.
  • preview is the first 220 chars of the response (null when the call failed; then failed is true); error is also truncated to 220 chars; title falls back to the first 120 chars of the question/prompt.
  • All admins see every user's entries. Only the newest ~5000 interactions are retained. The first call per process also backfills explanations created before the history existed.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/history" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "items": [
        {
            "id": 512,
            "kind": "chat",
            "createdAt": "2026-11-27T10:00:00.000Z",
            "userEmail": "[email protected]",
            "siteId": 7,
            "siteDomain": "shop.example.com",
            "logErrorId": null,
            "deploymentId": null,
            "conversationId": 31,
            "title": "Why is the queue on shop.example.com backing up?",
            "preview": "Check whether the queue worker is running…",
            "failed": false,
            "error": null,
            "provider": "openai",
            "model": "gpt-4o-mini",
            "durationMs": 3920
        }
    ],
    "nextCursor": 512
}
GET /api/ai/history/{id}

Get an AI history entry

Returns one stored AI interaction in full (prompt as sent, response or error), plus whether the site, error, deployment and conversation it refers to still exist.

  • Token or session
  • Admin

Path parameters

id integerrequired
Interaction id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
404
History entry not found No interaction with this id.
  • conversationOpenable is true only when the conversation still exists and belongs to the caller. prompt is stored already redacted.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl "https://panel.example.com/api/ai/history/14" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "id": 512,
    "kind": "chat",
    "createdAt": "2026-11-27T10:00:00.000Z",
    "userEmail": "[email protected]",
    "siteId": 7,
    "siteDomain": "shop.example.com",
    "logErrorId": null,
    "deploymentId": null,
    "conversationId": 31,
    "title": "Why is the queue on shop.example.com backing up?",
    "prompt": "CONTEXT β€” site shop.example.com (PHP 8.3), status active. …\n\nQuestion: Why is the queue on shop.example.com backing up?",
    "response": "Check whether the queue worker is running…",
    "error": null,
    "provider": "openai",
    "model": "gpt-4o-mini",
    "durationMs": 3920,
    "siteExists": true,
    "errorExists": false,
    "deploymentExists": false,
    "conversationTitle": "Why is the queue on shop.example.com backing up?",
    "conversationOpenable": true
}
DELETE /api/ai/history/{id}

Delete an AI history entry

Permanently deletes one stored AI interaction. Chat entries can only be deleted by the user who asked. Deleting the explanation currently cached on a log error replaces that cache with the newest remaining explanation (or clears it).

  • Token or session
  • Admin
  • Audit: ai.history_deleted

Path parameters

id integerrequired
Interaction id.not validated (Number(...) of the path segment)

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role Your role may not call this endpoint.
403
Only the person who asked can delete a chat entry. The entry is a chat turn of another user.
404
History entry not found No interaction with this id.
  • All /api/ai routes are admin-only (file-level preHandler hooks: authenticate + requireRole(['admin'])).
cURL
curl -X DELETE "https://panel.example.com/api/ai/history/14" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true
}

Telegram

Telegram bot connection and account linking.

POST /api/telegram/webhook/{secret}

Receive Telegram bot updates

Webhook called by Telegram's Bot API with bot updates (messages and button presses). The secret in the path is the credential. The update is acknowledged immediately and processed in the background by the panel's Telegram bot.

  • Secret in URL

Path parameters

secret stringrequired
Webhook secret generated by POST /api/telegram/setup.48 hex chars

Headers

X-Telegram-Bot-Api-Secret-Token string
Secret token Telegram sends with each update. If present it must equal the webhook secret.

Body

message object
Telegram Update.message; handled when it has text (commands such as /start <link code>).not validated
callback_query object
Telegram Update.callback_query (inline keyboard button press).not validated

Errors

404
No webhook secret is configured, the path secret is wrong, or the header token is present and does not match. The body is empty.
  • Intended for Telegram only; it is not meant to be called by API clients.
  • Processing errors are never reported to the caller. Updates are ignored when no bot token is configured; other update types are ignored.
  • Sending /start <code> to the bot with a code from POST /api/telegram/link-code links the Telegram account to the panel user.
cURL
curl -X POST "https://panel.example.com/api/telegram/webhook/value" \
  -H "Content-Type: application/json" \
  -d '{
    "update_id": 100000001,
    "message": {
        "message_id": 7,
        "from": {
            "id": 555000111,
            "username": "ada_example"
        },
        "chat": {
            "id": 555000111,
            "type": "private"
        },
        "date": 1795773600,
        "text": "/start 1a2b3c4d"
    }
}'
200Response Β· application/json
{
    "ok": true
}
GET /api/telegram/me

Get Telegram link status

Returns whether the caller's Telegram account is linked, and whether the panel's Telegram bot and webhook are configured.

  • Token or session
  • Any role

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
  • When a bot token is set, the handler calls Telegram's getMe to read botUsername; it is an empty string when that call fails or no token is set.
  • webhookConfigured only means a webhook secret has been generated; it stays true after POST /api/telegram/remove-webhook.
cURL
curl "https://panel.example.com/api/telegram/me" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "linked": true,
    "username": "ada_example",
    "linkedAt": "2026-11-27T10:00:00.000Z",
    "botConfigured": true,
    "botUsername": "orchestrator_example_bot",
    "webhookConfigured": true
}
POST /api/telegram/setup

Register the Telegram webhook

Registers the panel's webhook URL with Telegram so the bot receives messages. Generates the webhook secret on first use and reuses it afterwards. Admin only.

  • Token or session
  • Admin
  • Audit: telegram.webhook_set

Errors

400
Set the Panel URL in Settings β†’ General first (needed for the webhook URL). The panel_url setting is empty.
400
Set the Telegram bot token in Settings β†’ Notifications first. No Telegram bot token is configured.
401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role The caller is not an admin.
  • ok is always true; check result.ok for Telegram's verdict. result is null when Telegram could not be reached.
  • The webhook is registered for message and callback_query updates only.
  • The returned url contains the webhook secret, and the same url is stored in the audit entry's meta.
cURL
curl -X POST "https://panel.example.com/api/telegram/setup" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true,
    "url": "https://panel.example.com/api/telegram/webhook/3f1c0000000000000000000000000000000000000000a9e2",
    "result": {
        "ok": true,
        "result": true,
        "description": "Webhook was set"
    }
}
POST /api/telegram/remove-webhook

Remove the Telegram webhook

Asks Telegram to stop sending updates to the panel (deleteWebhook). Admin only.

  • Token or session
  • Admin
  • Audit: telegram.webhook_removed

Errors

401
Invalid or expired access token The personal access token is unknown, revoked or expired.
401
Unauthorized No token, or an invalid session.
403
Forbidden: insufficient role The caller is not an admin.
  • Returns ok even when no bot token is set or Telegram's answer is an error (the answer is not returned).
  • The stored webhook secret is not deleted: the webhook endpoint keeps accepting requests with the old secret, and GET /api/telegram/me still reports webhookConfigured: true.
cURL
curl -X POST "https://panel.example.com/api/telegram/remove-webhook" \
  -H "Authorization: Bearer $ORCH_TOKEN"
200Response Β· application/json
{
    "ok": true
}