Skip to content

Ontheia API Reference

This documentation describes the available API endpoints of the Ontheia host.

All endpoints (except /auth/login and /auth/signup) require a valid Bearer token in the Authorization header.

MethodPathDescription
POST/auth/signupRegisters a new user. Respects global settings (allow_self_signup, require_admin_approval).
POST/auth/loginLogs in a user. Blocks accounts with status suspended or pending.
POST/auth/logoutLogs out the current user (invalidates session).
GET/auth/meReturns user profile information including role and status.
DELETE/auth/meArt. 17 GDPR – Permanently deletes the user’s own account and all personal data. Agents, tasks, chains, and providers are retained (system resources).
GET/auth/me/exportArt. 20 GDPR – Exports all personal data as ontheia-export.json (profile, chats, run logs, memory entries).
PUT/auth/profileUpdates the user profile. Allows controlling admin memory access via allow_admin_memory.
POST/auth/change-passwordChanges the user’s password.
GET/user/settingsRetrieves user settings, including runtime, uiFlags, promptOptimizer, builder, rollingSummary.
PUT/user/settingsSaves user settings. Admins can persist global fields (e.g. rollingSummary) system-wide. Example payload: { "rollingSummary": { "providerId": "openai", "modelId": "gpt-5.6-luna", "thresholdTokens": 32000, "minRecent": 20 } }.
GET/user/auditReturns audit logs for the user (sessions, runs).
  • active: Full access to the system.
  • pending: Account created, waiting for admin approval. Login blocked (account_pending).
  • suspended: Account blocked by admin. Login blocked (account_suspended).

Agents are configurations for LLMs; tasks are specific task profiles within an agent.

MethodPathDescription
GET/agentsLists all available agents.
POST/agentsCreates a new agent.
GET/agents/:idReturns details for a specific agent.
PATCH/agents/:idUpdates an agent.
DELETE/agents/:idDeletes an agent.
POST/tasksCreates a new task.
PATCH/tasks/:idUpdates a task.
DELETE/tasks/:idDeletes a task.
GET/tasks/:id/versionsLists the superseded versions of the task context, newest first. Admin only.
POST/tasks/:id/versions/:version/restoreWrites an earlier version back into the task and returns the updated task. Admin only.
GET/agents/:agentId/memoryReturns memory settings for an agent.
PUT/agents/:agentId/memoryUpdates memory settings for an agent.
GET/tasks/:taskId/memoryReturns memory settings for a task.
PUT/tasks/:taskId/memoryUpdates memory settings for a task.

System and user prompts for context expansion.

MethodPathDescription
GET/prompt-templatesLists templates (filtered by scope/target).
POST/prompt-templatesCreates a new template.
PUT/prompt-templates/:idUpdates an existing template.
DELETE/prompt-templates/:idDeletes a template.

Chains are complex workflows that can consist of multiple steps.

MethodPathDescription
GET/chainsLists all available chains.
POST/chainsCreates a new chain (initial version).
GET/chains/:idReturns details for a chain.
PATCH/chains/:idUpdates metadata of a chain.
DELETE/chains/:idDeletes an entire chain.
GET/chains/:id/versionsLists all versions of a chain.
POST/chains/:id/versionsCreates a new version for a chain.
POST/chains/:id/versions/activateSets a specific version as active.
POST/chains/:id/runStarts the execution of a chain.

Scheduled agent interactions based on time intervals or one-time timestamps.

MethodPathDescription
GET/api/cronLists all configured cron jobs for the user.
POST/api/cronCreates a new cron job.
PATCH/api/cron/:idUpdates the configuration of a cron job (e.g., schedule, status).
DELETE/api/cron/:idPermanently deletes a cron job.
POST/api/cron/:id/runTriggers a cron job manually immediately.
GET/api/cron/:id/runsReturns the execution history (last 20 runs) for this specific job.

Fields POST/PATCH /api/cron:

FieldTypeDescription
namestringDisplay name of the job.
schedulestring | nullCron expression for recurring jobs. Mutually exclusive with run_at.
run_atISO 8601 | nullOne-time execution timestamp. Mutually exclusive with schedule.
agent_iduuidAssigned agent.
task_iduuid | nullOptional task.
chain_iduuid | nullOptional chain.
prompt_template_iduuid | nullOptional prompt template sent as a user message.
prompt_textstring | nullDirect text input as user message (alternative to prompt_template_id).
chat_idstring | nullExisting chat to continue the job in.
chat_title_templatestring | nullTitle template with {{name}} and {{timestamp}}.
notifybooleanSend desktop notification on completion.
prevent_overlapbooleanPrevent overlapping executions.
activebooleanEnable/disable the job.

Real-time Notifications (SSE):

MethodPathDescription
GET/api/eventsSSE stream for real-time push events (e.g., cron_complete). Authentication via Bearer token. Event type: notification, payload contains type, job_id, job_name, chat_id, success.

Reusable capability modules that extend agents with specialized knowledge and workflows. Skills are stored as SKILL.md files in sources/skills/ and indexed into the database by the ScanService.

MethodPathDescription
GET/api/skillsLists all skills visible to the current user (global + own user-scope skills).
GET/api/skills/:idReturns a single skill including its full body content.
PATCH/api/skills/:idUpdates skill metadata — enabled, disable_model_invocation, user_invocable, model_override (not body — edit the file directly for content changes; active is scanner-managed and not patchable).
DELETE/api/skills/:idDisables a skill persistently (enabled = false) — does not delete the file from disk and is not undone by a rescan.
POST/api/skills/scanTriggers a manual rescan of sources/skills/. Admin only.
GET/api/agents/:id/skillsReturns all skills assigned to the specified agent.
PUT/api/agents/:id/skillsSets the skill assignments for an agent (replaces existing). Body: { "skill_ids": ["uuid", ...] }. Admin only.

Skill object fields:

FieldTypeDescription
iduuidUnique identifier. Stable across rescans (UNIQUE NULLS NOT DISTINCT on name + scope + owner).
namestringKebab-case skill name (from SKILL.md frontmatter).
descriptionstringWhat the skill does and when to use it (max 1024 chars).
when_to_usestring | nullAdditional trigger context (optional frontmatter field).
contentstringFull SKILL.md body (returned by GET /api/skills/:id only).
skill_dirstringAbsolute path to the skill directory inside the container. Used by the MCP server as path boundary.
scopeglobal | userglobal = visible to all; user = owner only.
owner_iduuid | nullUser ID for user-scope skills; null for global skills.
activebooleanScanner-managed: false if the skill directory no longer exists on disk. Reset automatically on every rescan.
enabledbooleanAdmin-managed: persistent on/off switch, independent of file presence. Survives rescans. A skill is only usable when active = true AND enabled = true.

Internal MCP tools (available to agents at runtime):

ToolDescription
list_skillsReturns all skills assigned to this agent.
activate_skill(name)Loads full skill body from DB into context. Returns body + resource file listing.
read_skill_resource(skill_name, path)Reads a file from the skill directory (path-bounded).
write_skill_resource(skill_name, path, content)Writes a file to the skill directory (scope-permission enforced).
create_skill(name, scope, content)Creates a new skill on disk and triggers a rescan.

Runs represent the actual execution of an agent or a chain.

MethodPathDescription
POST/runsStarts a new agent run (chat interaction).
GET/runs/:idReturns details and events of a run.
POST/runs/:id/stopCancels a running run.
GET/runs/:id/streamSSE endpoint for streaming events of a run.
POST/runs/:id/tool-approvalApproves or denies a tool approval request (requires call_id).
GET/runs/recentLists recently executed runs.

Interaction with long-term memory (pgvector).

MethodPathDescription
GET/memory/searchSemantic search. Query parameters: namespace (repeatable), query, top_k, min_score (default 0.3), include_hidden, project_id, lang, tags, metadata. Responds with { namespaces, hits }namespaces names where it actually looked. Every hit carries similarity (raw cosine, 0…1) and relevance (after namespace bonus and recency, can exceed 1); min_score checks the relevance.
GET/memory/namespacesLists all namespaces accessible to the user.
GET/memory/healthStatus check of the memory system (pgvector connection).
POST/memory/documentsCreates entries (array or single object). Fields: namespace, content, metadata, ttl_seconds, class, observed_at.
DELETE/memory/documentsDeletes entries (soft delete) by namespace + content.
POST/memory/documents/:id/statusSets the maturity of an entry: { "status": "confirmed" | "unconfirmed" }. Responds with { ok, id, status, status_changed_at }. 409 if the entry has since been superseded, 404 if it is deleted. superseded cannot be set through this route.
POST/memory/documents/statusesCurrent state of several entries: { "ids": [...] }{ statuses: { id: { status, statusChangedAt, superseded, deleted } } }. A read as POST, because the id list does not belong in a URL. Deleted and superseded entries are returned with a flag rather than omitted — otherwise “deleted” would be indistinguishable from “unknown”.
PUT/memory/documents/:idEdits an entry. In addition to the fields above: restore: true clears deletion and supersession. Reaches entries that have dropped out of search.
DELETE/memory/namespaceClears an entire namespace.
POST/memory/reembed⚠️ Experimental – Adds entries to the re-embedding queue. The worker is not yet fully implemented.
GET/memory/auditAudit logs. Query parameters: limit, namespace (with * as prefix search), agent_id, task_id.
GET/memory/statsReturns statistics on memory usage.
POST/memory/ingest/directoryDirectory import with progress reporting (SSE).
POST/memory/convert/pdf2mdConverts PDF files in a directory to Markdown.
POST/memory/maintenance/cleanupDuplicate cleanup (hard delete, with a backup taken first).
POST/memory/maintenance/cleanup-expiredPermanently deletes expired entries.

Organization of conversations into projects.

MethodPathDescription
GET/projectsLists all projects of the user.
POST/projectsCreates a new project.
PATCH/projects/:idRenames a project or changes metadata.
DELETE/projects/:idDeletes a project including associated chats.
GET/chatsLists chats (global or filtered by project).
GET/chats/:chatIdReturns metadata of a chat.
PATCH/chats/:chatIdUpdates chat settings or project assignment.
DELETE/chats/:chatIdDeletes a chat history.
GET/chats/:chatId/messagesLists all messages of a chat.
PATCH/chats/:chatId/messages/:messageIdDeletes a message (soft-delete) or edits it.

File cards and the panel editor. Every file access goes through the files skill scripts so that its root whitelist and {user} isolation apply. All routes are restricted to the calling user by RLS.

MethodPathDescription
GET/api/artifacts/by-pathResolves a file path to its artifact (query path).
GET/api/artifacts/:idReturns metadata and the stored content of the current version.
GET/api/artifacts/:id/rawStreams the bytes of a binary artifact (PDF) for the viewer.
POST/api/artifacts/:id/refreshRe-reads the file and stores a new version if it changed.
POST/api/artifacts/:id/saveWrites edited content back; 409 on a checksum conflict.
POST/api/artifacts/materializeCreates a chat draft as a new file; 409 if it already exists.

Management of Model Context Protocol servers and tool configurations.

MethodPathDescription
GET/servers/configsLists MCP server configurations.
POST/servers/configsSaves/updates an MCP server configuration.
DELETE/servers/configs/:nameDeletes an MCP server configuration.
POST/servers/validateValidates a configuration for correctness.
POST/servers/startStarts an MCP server manually.
POST/servers/stop/:nameStops a specific MCP server process.
POST/servers/stop-allStops all running MCP servers.
GET/servers/processesLists currently running MCP processes.
GET/mcp/toolsLists all available tools from all active servers.
GET/providersLists all registered LLM providers.
POST/providersCreates or updates an LLM provider.
PUT/providers/:idUpdates a specific LLM provider.
DELETE/providers/:idDeletes a specific LLM provider.
POST/providers/testTests the connection to an LLM provider.

These endpoints serve as a bridge for MCP tools to interact directly with the host system.

MethodPathDescription
POST/mcp/tools/memory-searchSearch in vector memory (tool call).
POST/mcp/tools/memory-writeWrite to vector memory (tool call).
POST/mcp/tools/memory-deleteDelete from vector memory (tool call).

Functions exclusive to users with the admin role.

Administrators can manage user accounts but, for privacy reasons (GDPR), cannot enable memory access for themselves. This must be done by the respective user in their own profile settings.

MethodPathDescription
GET/admin/usersLists all users in the system (alphabetically sorted).
POST/admin/usersCreates a new user (password, role, status).
PATCH/admin/users/:idUpdates a user (name, role, status).
DELETE/admin/users/:idPermanently deletes a user.

Global configuration of the Ontheia host.

MethodPathDescription
GET/admin/settingsRetrieves all global system settings.
PATCH/admin/settingsUpdates specific system settings (e.g., allow_self_signup).
GET/admin/system/statusReturns system status: memory mode (disabled/cloud/local) and installed version. Useful for monitoring and scripts.
MethodPathDescription
GET/admin/namespace-rulesLists rules for vector namespaces.
POST/admin/namespace-rulesCreates a new namespace rule.
PUT/admin/namespace-rules/:idUpdates a namespace rule.
DELETE/admin/namespace-rules/:idDeletes a namespace rule.
GET/vector/healthStatus check of the pgvector connection including index statistics.
POST/vector/maintenanceTriggers maintenance tasks (vacuum, reindex).
POST/admin/memory/bulk-ingestBulk import of .md files from a container directory into a vector namespace. Body: { namespace, path?, recursive? }. Only vector.global.* namespaces allowed. Returns { ok, inserted, files, chunks }.

Ontheia follows a strict data privacy approach for long-term memory.

Every user can manage their own data independently — without administrator involvement.

GET /auth/me/export — Right to Data Portability (Art. 20 GDPR)

Section titled “GET /auth/me/export — Right to Data Portability (Art. 20 GDPR)”

Exports all personal data of the logged-in user as structured JSON.

Includes:

  • User profile (name, email, role, creation date)
  • User settings (theme, language, UI flags)
  • Chats and chat messages
  • Run logs (execution history)
  • Cron jobs (automation schedules)
  • Memory entries from both vector tables (vector.documents, vector.documents_768)

Not included (system resources shared across users):

  • Agents, tasks, chains, chain versions
  • Providers, MCP server configurations

Response: application/json as file download (Content-Disposition: attachment; filename="ontheia-export.json")

{
"exportedAt": "iso-timestamp",
"user": { "id": "uuid", "email": "string", "name": "string", "role": "string", "created_at": "timestamp" },
"chats": [
{
"id": "string", "title": "string", "created_at": "timestamp",
"messages": [{ "role": "user|agent|system|tool", "content": "string", "createdAt": "timestamp" }]
}
],
"runs": [{ "id": "uuid", "run_id": "uuid", "agent_id": "string", "chain_id": "uuid|null", "created_at": "timestamp" }],
"memoryEntries": [{ "namespace": "string", "content": "string", "createdAt": "timestamp" }]
}

DELETE /auth/me — Right to Erasure (Art. 17 GDPR)

Section titled “DELETE /auth/me — Right to Erasure (Art. 17 GDPR)”

Permanently and irreversibly deletes the logged-in user’s account and all personal data.

Deleted:

  • User profile (app.users)
  • All sessions (app.sessions)
  • User settings (app.user_settings)
  • Chats and chat messages (app.chats, app.chat_messages)
  • Run logs (app.run_logs) with the user’s user_id
  • Cron jobs (app.cron_jobs) belonging to the user
  • All vector entries in vector.documents and vector.documents_768 whose namespace contains the user ID as a path segment (e.g., vector.user.<id>.*, vector.agent.<agent-id>.<id>.*)

Not deleted (system resources):

  • Agents, tasks, chains, providers, MCP server configurations, embeddings

Response: 204 No Content

⚠️ This operation cannot be undone. The current session is also invalidated.


To view or manage a user’s memory (e.g., for support purposes), an administrator needs the user’s explicit permission.

  1. User Control: The user activates the allow_admin_memory option in their profile (/auth/profile).
  2. Auditing: Every access by an administrator to a user’s memory is logged in the system audit log.
  3. Technical Blocking: Without this permission, the database’s Row Level Security (RLS) system blocks all access, even if the administrator has administrative rights.
  4. No Self-Assignment: Administrators cannot change the allow_admin_memory field via the /admin/users API.

Memory Namespace Security (Note for Admins)

Section titled “Memory Namespace Security (Note for Admins)”

An agent’s memory policy (allowed_write_namespaces, write_namespace) supports template variables that are populated at runtime with the session user’s ID:

VariableMeaning
${user_id}UUID of the logged-in user
${agent_id}UUID of the executing agent
${chat_id}UUID of the active chat
${session_id}UUID of the current run

Recommendation: Always configure namespaces for personal data using ${user_id} — never hardcode a UUID. Otherwise, all users of that agent write to the same namespace.

✅ vector.user.${user_id}.memory
✅ vector.agent.${agent_id}.session.${chat_id}
✅ vector.global.knowledge
❌ vector.user.b6a38fa5-ed09-4bde-8634-eb7e80275989.memory ← hardcoded UUID
❌ vector.user.*.memory ← wildcard at user_id position

The memory-write tool shows the LLM the logged-in user’s concrete ID in the tool description at runtime — this prevents accidental use of foreign namespaces. Server-side namespace validation (allowed_write_namespaces) is the last line of defense.


General system information and health checks.

MethodPathDescription
GET/healthStatus check. Returns { status: 'ok', rootless: boolean | null }. The rootless field reports the result of the Docker rootless check at server startup (true=rootless, false=not rootless, null=could not verify).
GET/metricsDelivers Prometheus metrics.

{
"id": "uuid",
"email": "string",
"name": "string | null",
"role": "admin | user",
"status": "active | pending | suspended",
"lastLoginAt": "iso-timestamp | null",
"createdAt": "iso-timestamp",
"allowAdminMemory": "boolean (read-only for administrators)"
}

Represents a single message in a chat.

{
"id": "uuid",
"role": "user | agent | system | tool",
"content": "string",
"createdAt": "iso-timestamp",
"metadata": {
"usage": {
"prompt": "integer",
"completion": "integer"
},
"status": "running | success | error",
"streaming": "boolean"
}
}

Used in the POST /runs endpoint.

{
"agent_id": "uuid (optional)",
"task_id": "uuid (optional)",
"chain_id": "uuid (optional)",
"chain_version_id": "uuid (optional)",
"provider_id": "string (required, pattern: ^[a-z0-9][a-z0-9_-]{0,63}$)",
"model_id": "string (required, max: 200)",
"messages": [
{
"id": "string (optional)",
"role": "system | user | assistant | tool",
"content": "string | [{ type: 'text', text: 'string' }]",
"name": "string (optional)",
"tool_call_id": "string (optional)"
}
],
"options": {
"temperature": "number (0-2)",
"max_tokens": "integer (1-32768)",
"metadata": "object"
}
}

Used in the POST /runs/:id/tool-approval endpoint.

{
"tool_key": "string (required, e.g., 'server::tool')",
"call_id": "string (required, unique ID of the tool call)",
"mode": "once | always | deny (required)"
}

Used in the POST /agents and PATCH /agents/:id endpoints (both admin-only; all fields optional for PATCH).

{
"label": "string (required)",
"description": "string",
"provider_id": "string",
"model_id": "string",
"tool_approval_mode": "prompt | granted | denied",
"default_mcp_servers": ["string"],
"default_tools": [ { "server": "string", "tool": "string" } ],
"default_tool_permissions": { "<server>::<tool>": "once | always" },
"metadata": {},
"visibility": "private | public",
"owner_id": "uuid (optional — owner; default: creating admin. On PATCH: ownership transfer.)",
"allowed_user_ids": ["uuid or email (authorized users)"],
"active": "boolean",
"show_in_composer": "boolean",
"tasks": [ "TaskCreate Object" ]
}

Used in the POST /tasks endpoint or embedded in AgentCreate.

{
"name": "string (required)",
"description": "string",
"prompt": "string",
"tools": [
{
"server": "string",
"tool": "string"
}
],
"chains": [
{
"role": "pre | main | post",
"chain_version_id": "uuid",
"overrides": {}
}
]
}

Defines the workflow of a chain. Used in POST /chains/:id/versions.

Steps (Array of Step objects): A step must have id and type. Available types: llm, tool, router, branch, parallel, delay, loop, rest_call, memory_search, memory_write.

Example Step (LLM):

{
"id": "step1",
"type": "llm",
"prompt": "Hello ${input.text}",
"model": "gpt-5.6-terra",
"provider": "openai"
}

Edges (Connections):

[
{
"from": "step1",
"to": "step2",
"map": {
"output": "input"
}
}
]