Workers
Status, doctor, smoke tests, n8n bundle import, and local AI CLI sessions.
Worker and readiness endpoints under /api/v1/workers. Unless noted, send Authorization: Bearer (any valid API key scoped to the workspace). Session twins under /api/workers/* use the app cookie and workspaceId query or body.
Wrong or missing bearer → 401 { error: "Valid bearer API key is required" }. Session calls without workspace access → the workspace-auth error for that action.
Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/workers/status | Public worker status |
| GET | /api/v1/workers/doctor | Compact platform doctor |
| POST | /api/v1/workers/smoke-test | Temporary safe deployment smoke |
| POST | /api/v1/workers/n8n/import-bundle | Import server bundle JSON or path |
| POST | /api/v1/workers/n8n/smoke-test | Imported n8n bundle smoke + audit |
| POST | /api/v1/workers/n8n/credentials/bootstrap-from-env | Create missing n8n-mapped credentials from env |
| POST | /api/v1/workers/n8n/subflows/import-originals | Import original n8n child JSON |
| POST | /api/v1/workers/luminai/smoke-test | LuminAI alias of n8n smoke |
| POST | /api/v1/workers/luminai/credentials/bootstrap-from-env | LuminAI credential bootstrap |
| POST | /api/v1/workers/luminai/subflows/import-originals | LuminAI subflow import |
| POST | /api/v1/workers/local-ai-cli/session | prepare / verify / disconnect |
| POST | /api/v1/workers/local-ai-cli/login | Start CLI login |
| POST | /api/v1/workers/local-ai-cli/callback | Finish browser login |
| POST | /api/v1/workers/local-ai-cli/token | Claude Code token capture |
| GET | /api/v1/workers/local-ai-cli/models | Discovered CLI models |
Status
GET /api/v1/workers/status?now= optional ISO timestamp (invalid → 400). Returns { status } from toPublicWorkerStatus: queue (direct | bullmq, queueName: "workflow-runs", workerConcurrency, optional counts, error), persistence, database, scheduler, health, localAiCli, managedWorkspaces, agentRuntime, sideEffectTransports (no envVar), deployment (labels, not env names), run counters, recentRuns, latestSmokeTest, checkedAt.
Doctor
GET /api/v1/workers/doctor?now=&bundlePath=. Returns { doctor } compact: status, workspaceId, checkedAt, source, appUrl, persistence/database, queue subset, scheduler subset, workerHealth, deployment missing lists, localAiCli, managedWorkspaces, agentRuntime, n8nBundle, blockers, warnings, nextActions. Connection strings and env var names are stripped.
Smoke test
POST /api/v1/workers/smoke-test
| Field | Type | Effect |
|---|---|---|
targetWorkflowId | string | Audit only; temp workflow still runs |
useQueue | boolean | Force queue or inline |
waitForWorkerMs | number | How long to wait for a queued temp run |
Envelope { smokeTest }. HTTP 200 passed, 202 attention, 500 failed.
The wait is bounded to 30 seconds. An accepted run can remain queued or active after the response.
Until a terminal state is positively observed, cleanup.scheduleDeleted and
cleanup.workflowDeleted remain false and cleanup.retainedWorkflowReason explains retention.
This also applies if reading the accepted run fails. Keep both resources: the schedule is the run's
execution principal. Use the returned runId to inspect that same execution, then remove the retained
temporary schedule and workflow after it succeeds, fails or is canceled.
n8n smoke: POST /api/v1/workers/n8n/smoke-test { bundlePath?, useQueue?, waitForWorkerMs? } → { importedWorkflowSmokeTest } with the same status codes. Includes persistence.durable.
n8n bundle
POST /api/v1/workers/n8n/import-bundle { importBundleJson?, bundlePath? } → 201 import result + doctor. 400 on parse/import failure.
POST /api/v1/workers/n8n/credentials/bootstrap-from-env { bundlePath? } → { bootstrap, doctor } (public bootstrap: created/skipped counts, no secret values). 400 on bootstrap error.
POST /api/v1/workers/n8n/subflows/import-originals { importJson? \| importBundleJson } → 201 { importResult, doctor }.
Local AI CLI
Session POST body { action?, kind? }. action default verify; allowed prepare, verify, disconnect. kind optional claudeCode | codexCli. Returns { session: { workspaceId, ...public readiness } }.
Login: { kind } required. Callback: { callbackUrl } required. Token: { kind: "claudeCode", token } only. Models: ?kind= (400 if invalid). Persistence failure after a successful verify → 500.
Session HTTP copies: /api/workers/status, /doctor, /smoke-test, /n8n/*, /luminai/*, /local-ai-cli/*.
