OpenCognitOpenCognitDOCS

API Reference

Full REST API documentation. Base URL: http://localhost:3201

Overview

The OpenCognit backend provides a full REST API on port 3201. All responses are returned in JSON format.

Base URL: http://localhost:3201


Authentication

OpenCognit uses JWT (JSON Web Token) for all protected endpoints. Pass the token in the Authorization header as a Bearer token.

Authorization: Bearer <your-jwt-token>
POST /api/auth/registrieren
Content-Type: application/json

{
  "name": "Jane Smith",
  "email": "jane@example.com",
  "passwort": "secure-password-123"
}
POST /api/auth/anmelden
Content-Type: application/json

{
  "email": "jane@example.com",
  "passwort": "secure-password-123"
}

Response: { "token": "eyJhbGci...", "benutzer": { ... } }

GET /api/auth/ich
Authorization: Bearer <token>

Companies

MethodEndpointDescription
GET/api/unternehmenList all companies
POST/api/unternehmenCreate company
GET/api/unternehmen/:idCompany details
PATCH/api/unternehmen/:idUpdate company
GET/api/unternehmen/:id/dashboardDashboard data
GET/api/unternehmen/:id/aktivitaetActivity feed
GET/api/unternehmen/:id/kosten/zusammenfassungCost summary

Experts (Agents)

MethodEndpointDescription
GET/api/unternehmen/:id/expertenList agents
POST/api/unternehmen/:id/expertenCreate agent
GET/api/experten/:idAgent details
PATCH/api/experten/:idUpdate agent
DELETE/api/experten/:idDelete agent
POST/api/experten/:id/pausierenPause heartbeat
POST/api/experten/:id/fortsetzenResume heartbeat
GET/api/experten/:id/inboxOpen tasks (heartbeat inbox)
POST/api/experten/:id/skillsAdd skill
DELETE/api/experten/:id/skills/:skillIdRemove skill

Tasks

MethodEndpointDescription
GET/api/unternehmen/:id/aufgabenList tasks
POST/api/unternehmen/:id/aufgabenCreate task
GET/api/aufgaben/:idTask details
PATCH/api/aufgaben/:idUpdate task
POST/api/aufgaben/:id/checkoutSet execution lock
POST/api/aufgaben/:id/releaseRelease execution lock
GET/api/aufgaben/:id/kommentareGet comments
POST/api/aufgaben/:id/kommentareAdd comment

Routines

MethodEndpointDescription
GET/api/unternehmen/:id/routinenList routines
POST/api/unternehmen/:id/routinenCreate routine
PATCH/api/routinen/:idUpdate routine
DELETE/api/routinen/:idDelete routine
POST/api/routinen/:id/triggersCreate trigger
POST/api/routinen/:id/triggerTrigger manually
GET/api/routinen/:id/ausfuehrungenExecution history

Chat

Direct board ↔ agent messaging per company:

MethodEndpointDescription
GET/api/unternehmen/:id/chatGet chat history
POST/api/unternehmen/:id/chatSend message
POST /api/unternehmen/:id/chat
Authorization: Bearer <token>
Content-Type: application/json

{ "nachricht": "What's the status on the login page?", "empfaengerId": "<agent-id>" }

Settings

MethodEndpointDescription
GET/api/einstellungenGet all settings
PUT/api/einstellungen/:keySet a value
PUT /api/einstellungen/anthropic_api_key
Authorization: Bearer <token>
Content-Type: application/json

{ "wert": "sk-ant-api03-..." }

Approvals

MethodEndpointDescription
GET/api/unternehmen/:id/genehmigungenList open approvals
POST/api/genehmigungen/:id/genehmigenApprove
POST/api/genehmigungen/:id/ablehnenReject

System & Health

GET /api/health
# Response: { "status": "UP", "timestamp": "2026-04-05T10:00:00Z" }

GET /api/system/status
# Response: { "aktiveAgenten": 3, "offeneAufgaben": 12, "heartbeatsHeute": 47 }

WebSocket — Real-Time Updates

const ws = new WebSocket('ws://localhost:3201/ws');
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data.type, data);
};
Event typeDescription
agent_statusAgent status changed (idle / running / paused / error)
task_startedAgent picked up a task and set execution lock
task_completedTask marked done after successful execution
task_escalatedTask escalated to CEO after 3 consecutive failures
tasks_unblockedBlocked tasks released after a dependency resolved
approval_neededNew approval request pending board action
goal_achievedCompany goal marked as achieved by CEO
budget_warningAgent approaching or exceeding monthly budget
expert_deletedAn agent was deleted
meeting_createdAgents scheduled a coordination meeting
meeting_updatedMeeting outcome or status changed
agents_importedBulk agent import completed
routine_executedA scheduled routine finished execution
aktivitaetNew activity log entry
kosten_updateToken cost tracking updated

Error Responses

{
  "fehler": "Task not found",
  "code": "NOT_FOUND",
  "status": 404
}
HTTP StatusMeaning
200Success
201Resource created
400Bad request
401Not authenticated
403Forbidden
404Resource not found
409Conflict (e.g. execution lock active)
500Server error