Skip to content

HTTP routes

MethodPathAuthPurpose
GET/healthopenLiveness probe.
Auth (better-auth)
POST/api/auth/sign-up/emailopenCreate user.
POST/api/auth/sign-in/emailopenEmail+password sign-in.
POST/api/auth/sign-outsessionEnd session.
GET/api/auth/get-sessionopenCurrent session + user.
POST/api/auth/organization/createsessionCreate an org.
GET/api/auth/organization/listsessionList orgs.
POST/api/auth/organization/set-activesessionSwitch active org.
POST/api/auth/organization/invite-membersessionInvite teammate.
POST/api/auth/api-key/createsessionMint a thd_ key.
GET/api/auth/api-key/listsessionList keys.
POST/api/auth/api-key/deletesessionRevoke a key.
Bootstrap
GET/api/bootstrap?token=…signedFirst-run admin (when armed AND user table empty).
Workflows
POST/api/workflowsCreate empty workflow.
GET/api/workflows/:idRead workflow JSON + version.
POST/api/workflows/:id/operationsApply EditOp[].
DELETE/api/workflows/:idSoft-delete.
POST/api/workflows/:id/runDispatch a run.
Runs
GET/api/runs/:runIdDescribe a run.
GET/api/runs/:runId/logs?after&limitPaginated step attempts.
POST/api/runs/:runId/cancelCancel an in-flight run.
Connectors
GET/api/connectors?detail=summary|fullCatalog.
GET/api/connectors/:typeOne connector’s metadata.
Schedules
POST/api/schedulesRegister a cron schedule.
GET/api/schedulesList schedules in the active org.
DELETE/api/schedules/:idRemove a schedule.
POST/api/admin/tickManual dispatcher tick.
Webhooks
ALL/api/webhooks/*per-routeProgrammatically registered routes.

= requires session OR API key. The auth guard rejects with 401 (unauthorized or no_active_organization) before the route handler runs.

HeaderWhenPurpose
Authorization: Bearer thd_…API-key authProgrammatic access.
Authorization: Bearer <session_token>Bearer sessionsCookie-less session auth (bearer plugin).
Cookie: better-auth.session_token=…Browser UIStandard cookie session.
x-api-key: thd_…Alt API-keySame as Authorization Bearer for keys.
Origin: https://yourdomainAll /api/auth/*better-auth CSRF gate.
If-Match: <version>Workflow patchOptimistic concurrency.
Content-Type: application/jsonAll bodiesRequired for JSON.
// 200 / 201 / 202 — handler-specific JSON
{ "id": "", "version": 1 }
// 400 — validation
{ "error": "invalid_body", "issues": [/* zod issues */] }
// 401 — auth
{ "error": "unauthorized" }
{ "error": "no_active_organization" }
// 404 — not found OR cross-org probe
{ "error": "not_found" }
// 412 — optimistic concurrency
{ "error": "version_mismatch", "current": 7 }
// 429 — rate limit
{ "error": "rate_limited", "retryAfterMs": 12345 }
// 5xx — handler errors
{ "error": "dispatch_failed", "message": "" }

See Error codes for the full table.