REST API and authentication
The current machine-readable specification is available at /api/openapi.json. Resources always belong to the workspace of the account or API key. You do not pass an arbitrary workspace ID of someone else to the entity endpoints.
API key
Owners/admins create keys with read, write and/or chat scopes. The full token is returned only when the key is created and is then stored exclusively as a SHA-256 hash. Copy it into a secret manager or a secure process environment.
curl http://127.0.0.1:5090/api/entities/agents \
-H "Authorization: Bearer $AIHUB_API_KEY"
read allows ordinary read actions, write changes and manual tools, chat playground, individual calls, campaign launches and voice endpoints. A key has editor rights; settings, team management, key management and full workspace export remain reserved for the owner/admin session.
Browser session and CSRF
Alternatively, the session cookie provides authentication. GET /api/bootstrap returns a session-bound csrf-value. For POST/PATCH/DELETE/PUT, send it as X-CSRF-Token. Auth forms use csrf_token. Bearer requests do not need an additional CSRF token. Public widget callbacks and signed Twilio callbacks use their own access path.
Public SIHub helper
The website chat uses POST /api/site-chat. Visitors need neither an account nor an API key. The public page creates an anonymous session; its chat passes the session-bound CSRF token as X-CSRF-Token. Requests stay on the same website. This endpoint answers product questions and does not perform any workspace actions.
{
"message": "Welche Agenten gibt es?",
"history": []
}
A message contains a maximum of 4,000 characters. The optional history contains a maximum of eight messages with the roles user or assistant. The response contains reply, matching links with title and href as well as mode. knowledge marks answers from public SIHub knowledge; assistant marks an answer that was actually generated by a model. Customer data, client receipts and your own workspace agents are not part of this knowledge base. Unknown questions get general guidance and contact options. Prices are never made up; binding offers are available in the shop and at checkout.
The website chat uses the operator's central AI access. The provider and model are determined on the server. If the configuration is missing or the provider returns an error, the request ends with an error; no local fallback answer is output as a model response.
If Cloudflare Turnstile is activated, a new request also contains turnstile_token. For POST /api/site-chat the token belongs to the action site_chat; after a successful check, a ten-minute session approval applies to further questions. For a new request via /api/site-chat/inquiry or /api/site-chat/consultation a fresh token for the action contact is required on final submission. The server checks the success flag, the allowed hostname and the action. HTTP 403 with code: "bot_rejected" requires a new check; HTTP 503 with code: "bot_unavailable" reports that the check is unavailable. Failed checks do not save a new request and do not trigger an email.
The token is not part of the business identifier and is not passed to the mail or AppHub queue. A request that has already been saved can be confirmed again using the same valid session token and submission_token values; the consumed Turnstile token is not reused for this. CSRF, origin, size and rate checks remain active. The server-to-server endpoint in AppHub still requires only the portal credentials.
After the tutorial video, the helper opens and asks about further questions or a request for a conversation. For an explicit conversation request, the chat returns via POST /api/site-chat additionally action: "consultation" and a session-bound submission_token. The chat guides the visitor through the required details and shows a summary before submitting. Collecting the data does not require a model provider.
Under /contact the same agent automatically starts the general contact flow. A request to the team returns action: "inquiry" with a session-bound submission_token. POST /api/site-chat/inquiry takes submission_token, name, email, subject, message, optional company and phone as well as privacy: true as input. The request is only submitted explicitly after the summary has been reviewed. Contact details and the message are not sent to a model provider or to the public question history while they are being collected.
General inquiries return mode: "inquiry", one reference and independent delivery fields: confirmation_status for the customer confirmation, and apphub_status and apphub_thread_id for the central inbox. A saved request counts as successfully accepted even if its delivery is temporarily still pending. With SIHUB_APPHUB_URL AppHub handles both the customer confirmation and replies via the assigned mailbox. Without this route, SIHub uses its local SMTP queue. The browser API supports ?lang=SPRACHE, so that the language of an explicitly selected page is kept even if a language cookie already exists.
POST /api/site-chat/consultation uses the same browser session and the same CSRF protection. The JSON body contains the received token, contact details, topic, preferred appointment and confirmation of the privacy notice:
{
"submission_token": "TOKEN_AUS_DER_CHATANTWORT",
"name": "Erika Beispiel",
"email": "[email protected]",
"phone": "",
"company": "Beispielfirma",
"preferred_date": "2027-01-20",
"preferred_time": "10:30",
"topic": "SIHub für unsere Kanzlei",
"privacy": true
}
phone and company are optional. All other fields are required; privacy must be the JSON value true (a boolean). Date and time are interpreted in Austrian time (Europe/Vienna) and must be in the future. Invalid times, or times that are ambiguous because of a clock change, are rejected. Only an explicit submission saves a contact request in contact_messages and queues its AppHub delivery or local SMTP sending. The preferred appointment is only a request; the team then confirms the time and availability personally.
The response contains reply, reference, status, mode: "consultation", the same independent delivery fields and contact links. saved confirms that the request was saved, sent additionally confirms the handover to AppHub or to local notification sending, and unknown signals an SMTP delivery whose outcome is still unknown. The customer confirmation is independent of this. If the connection drops and the outcome is unclear, a retry uses the same submission_token, so that only one request and one confirmation are saved. Field errors return HTTP 400 with errors; an invalid session token returns 403. Disabled contact acceptance returns 503. General inquiries and conversation requests share a limit of five requests per hour and IP address.
The chat stores questions, answers and details not yet submitted in the open browser window. It does not create any conversation or message rows in MariaDB; explicitly submitted conversation requests are saved as contact requests. The server-side IP rate limit counts requests; optional model providers receive the submitted chat messages and the public knowledge context. If a model provider is enabled, the operator adds the actual data processing to its privacy notice.
Change data
/api/entities/{kind} supports listing and creating; /api/entities/{kind}/{id} read, PATCH and DELETE. Possible kinds: agents, knowledge, tools, channels, campaigns, contacts, tasks, reviews. The general body consists of name, optional status and a module-specific data-object.
With PATCH, a supplied data-object is replaced completely, not merged recursively. So load the existing data first, change the required fields and send the complete object back. Field assignments such as knowledge/tool/agent IDs are checked per workspace.
POST /api/agents/{id}/publish requires the following JSON body when knowledge, tools, browser access, memory or specialist agents are assigned: {"confirm_data_access":true}. Check the provider, permissions and safeguards beforehand. POST /api/bot-setup/{id} requires the same confirmation value when activate_live=true is sent. Likewise, PATCH /api/settings requires it when live_enabled changes to true for the first time.
{"agent_id": "AGENT_ID", "message": "Wann ist geöffnet?", "mode": "live"}
Sending this body to POST /api/chat returns reply, conversation_id and mode. Send the conversation ID back with further messages. Knowledge import uses multipart; voice transcription uses the multipart field audio. The maximum request size is 2 MB including multipart overhead.
Errors usually contain {"error":"..."} under /api/. Typical status codes are 400, 401, 403, 404, 409, 413, 429 and 502. Live provider errors are not replaced by demo responses. The limits apply on the server side; do not increase usage through parallel retries.
Provider API accounts and work orders
Agents use only the operator's centrally configured AI access. Customer fields cannot override the provider, model or billing source. PUT /api/provider-accounts/{provider} and POST /api/provider-accounts/{provider}/test are disabled with HTTP 410. Existing encrypted account entries are kept; owners/admins can delete them with a DELETE request. GET /api/provider-accounts reports enabled: false. Personal ChatGPT connections are also disabled. Central AI access.
{"agent_id":"VEROEFFENTLICHTER_AGENT_ID","prompt":"Bearbeite die offene Kundenanfrage.","mode":"live","max_steps":8}
POST /api/jobs queues this job and returns {"job":{...}} with status 201. GET /api/jobs/{id} returns the result, model usage and action history. POST /api/jobs/{id}/cancel stops further steps. The creator and owners/admins of the same workspace have access. Creating and canceling require scope chat, reading read. A running Agent worker processes jobs; the web request does not perform any external action.
If the agent asks a follow-up question, the job has the status waiting_input and contains input_request with id, job_id, question, optional hint/options and max_answer_length. A follow-up question from a specialist agent is also shown on the waiting parent job; in that case, use the job_id from input_request. POST /api/jobs/{job_id}/input takes {"request_id":"FRAGE_ID","answer":"Deine Antwort"} as input and requeues the same job. This requires a signed-in owner/admin/editor browser session with CSRF protection and access to the job. API keys cannot answer follow-up questions. Empty or overly long answers are rejected; a follow-up question that has already been answered or canceled returns 409.
GET /api/automation returns jobs, routines, pending approvals, accessible memory, templates and worker status. Routines are managed via POST /api/routines, PATCH/DELETE /api/routines/{id} and POST /api/routines/{id}/run endpoints. They support interval, daily and event; a one-time routine run uses live mode; mode=test is rejected. POST /api/automation/events takes event, stable event_id, optional source_agent_id and limited data as input. Duplicate events do not create a second job per routine. These mutations require scope chat.
Owners/admins decide approvals via POST /api/approvals/{id} with decision=approve|reject and optionally edited arguments. After external verification, unclear actions require confirm_succeeded|confirm_failed and, if applicable, the confirmed result. A status confirmation does not repeat the action. Memory CRUD uses /api/memories and /api/memories/{id} with scope write; private entries remain assigned to the person they belong to.
Real-time and usage
GET /api/voice/status returns the LiveKit configuration status and shared Redis usage. GET /api/voice/latency returns measured latencies with their source, sample count and an estimate flag. Showing a capacity target does not mean a load test has passed.
POST /api/voice/web-session requires {"channel_id":"WEBVOICE_KANAL_ID"} and the scope chat. It reserves capacity and returns the LiveKit URL, a short-lived room-bound microphone token, and the room_name and conversation_id values. Outbound SIP calls still use /api/test-call with an explicitly selected mode=live and confirmed consent.
GET /api/usage?month=2026-10 returns monthly aggregates and up to 1,000 detail rows. The period is based on UTC and the last ledger update. total.prices_configured and total.revenue_configured indicate separately whether cost and revenue rates are configured. Monetary amounts are returned as integer micro-EUR (1,000,000 = 1 EUR). GET /api/usage/export?month=2026-10 exports all matching rows as CSV. These are configured estimates, not a provider/customer invoice.
The /internal/voice/*-endpoints serve only the separate worker with an operator bearer token and session-bound identifiers. Customer API keys do not grant this access. They are not part of the public API contract.
Lightweight Python and JavaScript clients
The repository contains sdk/aihub.py and sdk/aihub.mjs. They provide entity listing, creation/update, publishing, chat and conversation details as well as a generic REST call. They are small custom clients, not published registry packages, and do not include complete TypeScript type definitions.
Python example from the project directory:
import os
from sdk.sihub import SIHub
client = SIHub("http://127.0.0.1:5090", os.environ["AIHUB_API_KEY"])
try:
agents = client.entities("agents")
result = client.chat(agents[0]["id"], "Wann ist geöffnet?", mode="test")
print(result["reply"])
finally:
client.close()
JavaScript example as an .mjs-file in the project directory with server-side fetch:
import { SIHub } from './sdk/sihub.mjs';
const client = new SIHub({
baseUrl: 'http://127.0.0.1:5090',
apiKey: process.env.AIHUB_API_KEY
});
const agents = await client.entities('agents');
const result = await client.chat(agents[0].id, 'Wann ist geöffnet?', {mode: 'test'});
console.log(result.reply);
Both examples require a matching workspace key, at least one agent and the required scopes. Run clients with API keys on the server; public browser widgets need a separate public channel.
Private website control and demonstrated workflows
The endpoints under /api/browser/* require a signed-in portal session. API keys do not grant browser control. A browser connection belongs to a single person within their workspace; even administrators do not get screen access to other people's connections this way. Users with edit permissions can operate their own connections. Write requests additionally require X-CSRF-Token; screen access and control remain bound to the authorized user and their connection.
GET /api/browser/status returns enabled, worker_ready, browser_ready and reason. A saved workflow can be checked even when the browser service is not running. Actual website control requires the private browser service and its configured Chromium browser.
| Endpoint | Behavior |
|---|---|
GET /api/browser/sessions |
List your own connections with status open or closed, allowed domains and sanitized addresses. |
POST /api/browser/sessions |
Open a connection with name, url and allowed_hosts set; returns {"session":{...}}, status 201. |
GET /api/browser/sessions/{id}/screen |
Return the current PNG as image-data URL along with width, height, revision, sanitized url, title and status fields. The response is not cacheable. |
GET /api/browser/sessions/{id}/observe |
Return a sanitized page reference with text, visible non-confidential elements and short-lived ref-identifiers. |
POST /api/browser/sessions/{id}/actions |
Run an explicitly triggered manual action with type and the matching details. |
POST /api/browser/sessions/{id}/takeover |
Cancel a related active agent job and take over manual control. |
POST /api/browser/sessions/{id}/close |
Close browser and remove saved credentials for this connection. |
Domains are specified individually, for example portal.beispiel.at; paths, ports and wildcards do not belong in allowed_hosts. Start addresses use HTTPS and contain no embedded credentials, query parameters or anchors. The connection may only reach its allowed public domains. Sign-ins are performed directly in the private browser view; the protected sign-in state is stored encrypted and bound to the workspace, person and connection.
Manual actions are navigate, click, fill, press, scroll, select and check. navigate uses url; click uses screen coordinates x and y; fill uses text; press uses key; scroll uses, for example, {"x":0,"y":500}; select uses value; check uses checked. Target IDs from an observation can be passed as ref values. For actions on the current screen, its revision is sent along. Coordinates refer to the returned screen dimensions, not to the scaled-down view in the portal.
{"type":"fill","text":"VERTRAULICHE_EINGABE","sensitive":true,"revision":"REVISION_AUS_SCREEN"}
Confidential entries are masked in the portal and removed from the local field after sending. They are not included in recordings, model prompts or action logs. Screenshots mask protected fields. An action outcome that cannot be confirmed reliably is marked as uncertain and is checked in the target system before any retry.
The workflow for recurring work is: open the website, sign in manually, start recording, demonstrate the steps, stop recording, check steps and parameters, publish the reviewed version.
| Endpoint | Behavior |
|---|---|
GET /api/browser/workflows |
List accessible workflows as safe metadata. |
POST /api/browser/sessions/{id}/recordings |
Start a recording with name and an optional description set; returns {"workflow":{...}}. |
GET /api/browser/workflows/{id} |
Check steps, parameters, omissions, and version metadata. |
POST /api/browser/workflows/{id}/stop |
Stop recording; the workflow becomes a draft. |
PATCH /api/browser/workflows/{id} |
name, description, steps and parameters can be corrected; any change requires a new review and publication. |
POST /api/browser/workflows/{id}/publish |
Owners/admins publish with {"reviewed":true}; if steps were skipped, also acknowledge_exclusions:true. |
POST /api/browser/workflows/{id}/prepare |
{"variables":{"parametername":"Wert"}} is validated and a plan is created with workflow_id, version and the filled-in steps; no execution is started. |
DELETE /api/browser/workflows/{id} |
Archive the workflow and lock it against further use; immutable versions are retained. |
For input fields, the recording stores parameters such as {{eingabe_1}}, not the demonstrated input values. Known password, one-time code, payment and credential fields are omitted; exclusions contains only reasons and counts. Steps use action and, for DOM actions, a unique locator with strategy role, label, test_id, placeholder or css. Named embedded pages can have a verified frame value. Unsupported content is not silently saved as working steps. Saved browser interactions require approval when they run; wait does not change any data.
A published assistant explicitly allows website work via browser_enabled, its browser_session_id and the list browser_workflow_ids. Jobs and scheduled routines can use the browser_session_id, browser_workflow_id and browser_variables fields. The connection must belong to the person running the job, and a selected workflow must be published and allowed for the assistant. A deterministic website workflow does not need a model call; its interactions are still checked through the approval inbox. Preparation does not replace these approvals.
Your own ModelServer models for agents
GET /api/providers/modelserver/models requires a sign-in or a SIHub API key with read-level permission. The response contains, for example:
{"provider":"modelserver","models":[{"id":"gpt-oss-120b","available":false},{"id":"gpt-oss-20b","available":true}]}
available is checked on the operator's own model server. Unavailable models can be saved as an agent draft; real model requests require an available backend and the necessary access rights. An unreachable gateway returns HTTP 503.
When creating or updating an assistant, pass its data with
model_provider: "modelserver", billing_source: "operator" and the selected
model-ID. The server key remains exclusively in the operator environment. Chat and work orders use SIHub's existing APIs and the same permissions. Setup and model registry.