Create a cookie session with email and password.
Request:
{
"email": "user@example.com",
"password": "secret-password",
"turnstileToken": "<token-from-turnstile-widget>"
}turnstileToken: Turnstile widget response token (string, required when Turnstile is enabled)
Response 200:
{
"user": {
"id": "user-1",
"email": "user@example.com",
"role": "user"
}
}Return the current authenticated user from the session cookie.
Clear the session cookie.
Send a registration verification code to an email address.
Request:
{
"email": "user@example.com",
"turnstileToken": "<token-from-turnstile-widget>"
}turnstileToken: Turnstile widget response token (string, required when Turnstile is enabled)
Response 202 Accepted:
{ "ok": true }Error codes:
email_already_exists(409): email already registeredemail_code_cooldown(429): too many requests, cooldown period activeemail_code_rate_limited(429): rate limitedemail_send_failed(500): failed to send email
Create a new user with a valid email verification code.
Request:
{
"email": "user@example.com",
"password": "secret-password",
"emailCode": "123456",
"turnstileToken": "<token-from-turnstile-widget>"
}turnstileToken: Turnstile widget response token (string, required when Turnstile is enabled)
Response 201 Created:
{
"user": {
"id": "user-1",
"email": "user@example.com",
"role": "user"
}
}Error codes:
email_code_required(400): email code missingemail_code_expired(400): email code expiredemail_code_attempts_exhausted(400): too many failed attemptsemail_code_invalid(400): invalid email codeemail_already_exists(409): email already registeredinvalid_password(400): invalid password
Public endpoint (no authentication required). Returns configuration for rendering the Turnstile widget in the frontend.
Response 200:
{ "sitekey": "<sitekey-or-empty>", "enabled": true }enabled: Whether the backend has Turnstile secret configuredsitekey: Sitekey for the frontend (empty string if not configured)
This endpoint itself does not require Turnstile verification.
Return basic API health.
List published templates only.
Get one published template.
Draft and archived templates are not visible on public routes.
All /api/admin/templates* routes require an admin session.
List active templates for admin management.
Archived templates are hidden from this default list.
Get one template for admin management.
Create a draft template.
Request:
{
"name": "Support Concierge",
"description": "Handles private support requests."
}Update template metadata.
Archive a template.
Read SOUL.md.
Write SOUL.md.
Request:
{
"content": "# Soul\nCalm and direct."
}Read USER.md.
Write USER.md.
List skills for the template.
Add one complete skill.
Request: multipart/form-data with a file field containing a ZIP archive.
The ZIP must contain exactly one top-level directory. That directory name becomes the skill name, and it must include SKILL.md.
Read one skill and its SKILL.md content.
Delete one complete skill.
There is intentionally no skill edit or skill replace endpoint in MVP.
Publish a template.
Return a published template to a new draft and archive the published version.
Create an Agent from a published template and queue runtime provisioning.
Request:
{
"templateId": "template-1",
"name": "Support Concierge Agent"
}List Agents.
- admins see all Agents
- normal users see only their own Agents
Get one Agent.
Get runtime state.
List runtime jobs for one Agent.
Get one runtime job.
Create a runtime job. MVP only supports restart.
Request:
{
"type": "restart_runtime"
}物理删除 agent:停止并移除其 Docker 容器、删除 hermes-home 目录、删除数据库记录(关联的 runtime_jobs/agent_channels/agent_runtime_events 通过外键 CASCADE 自动清理)。
权限:owner 或 admin。
响应:
| 状态码 | error code | 说明 |
|---|---|---|
| 204 No Content | — | 删除成功 |
| 401 | unauthorized | 未登录 |
| 403 | forbidden | 不是 owner 也不是 admin |
| 404 | agent_not_found / not_found | agent 不存在 |
| 409 | agent_cannot_delete | 当前状态(provisioning/starting)不允许删除,请等状态稳定后重试 |
| 409 | agent_has_unfinished_jobs | 存在未完成的运行时任务,请稍后重试 |
| 500 | internal_error | 删除过程内部错误(agent 转 error 状态,可重试同一接口) |
注意:500 错误后 agent 进入 error 状态并写入 last_error_code:delete_inspect_failed / delete_stop_failed / delete_remove_failed / delete_home_failed。再次调用 DELETE 会从中断处接续完成清理(每一步都幂等)。
Get channel state. If the channel has not been created yet, the response still returns a synthetic not_configured state.
Ensure the Weixin channel exists. The Agent must already be running.
No-op delete for MVP.
List pairing sessions for the Agent's Weixin channel.
Create or reuse an active pairing session and queue channel work.
Get one pairing session.
Typical response codes:
401 unauthorized403 forbidden404 not_found409 conflict400 invalid_request
Important 400 error codes:
turnstile_required: Turnstile token is required but not providedturnstile_invalid: Turnstile token is invalid or expired
Important conflict cases:
- Agent runtime not available for restart
- Agent not running when ensuring Weixin channel
- duplicate skill name inside the same template
API responses must not expose:
- provider API keys
WEIXIN_TOKENbot_token- session password hashes