API Reference.
All endpoints are under the base path /api/v1/. Every request requires a Bearer token via the Authorization header. Set the token with the KEYOKU_SESSION_TOKEN environment variable.
Default port: 18900. All request/response bodies are JSON.
Authentication
Bearer token on every request.
# All API calls require the session token
curl -H "Authorization: Bearer $KEYOKU_SESSION_TOKEN" \
http://localhost:18900/api/v1/healthHealth endpoints.
/api/v1/healthReturns engine health status, version, uptime, and database stats.
Memory endpoints.
/api/v1/rememberIngests a conversation exchange. The LLM extracts structured memories, runs dedup, and stores results. Body: { entity_id, content, source?, session_id?, agent_id?, schema_id?, team_id?, visibility? }.
/api/v1/seedInsert memories directly without LLM extraction. Useful for testing, migration, and bootstrapping. Body: { memories: [{ entity_id, content, type, importance?, ... }] }.
/api/v1/searchSemantic search over stored memories. Body: { entity_id, query, limit?, mode?, agent_id?, team_aware?, min_score? }. Returns ranked results with similarity scores.
/api/v1/memoriesList all memories for an entity. Query params: entity_id, type?, state?, limit?, offset?. Returns paginated results.
/api/v1/memories/:idFetch a single memory by ID. Returns the full memory object including metadata, embedding status, and access history.
/api/v1/memories/:idSoft-delete a memory by ID. Sets state to DELETED. Memory is purged after retention period (default 90 days).
/api/v1/memoriesBulk delete memories for an entity. Query params: entity_id, type?, before?. Use with caution.
/api/v1/memories/:id/tagsUpdate tags on a memory. Body: { tags: string[] }. Replaces existing tags.
/api/v1/memories/sampleReturns a random sample of memories for an entity. Query params: entity_id, limit?. Useful for debugging and testing.
Stats endpoints.
/api/v1/statsGlobal engine statistics: total memories, entities, memory type distribution, storage size, HNSW index stats.
/api/v1/stats/:entity_idPer-entity statistics: memory count by type, average importance, decay distribution, relationship count, last activity.
Heartbeat endpoints.
/api/v1/heartbeat/checkRun the heartbeat signal scan. Body: { entity_id, deadline_window?, decay_threshold?, importance_floor?, max_results?, agent_id?, team_id? }. Returns { should_act, pending_work, deadlines, scheduled, decaying, conflicts, summary }.
/api/v1/heartbeat/contextCombined heartbeat check + context-relevant memory search in a single call. Body: { entity_id, query?, top_k?, min_score?, autonomy?, analyze?, agent_id?, in_conversation? }. Returns heartbeat signals plus relevant memories.
/api/v1/heartbeat/record-messageRecord the actual message text sent in a heartbeat for dedup tracking. Body: { entity_id, agent_id, action_id?, message }.
Scheduling endpoints.
/api/v1/scheduleCreate a scheduled reminder. Body: { entity_id, content, cron_expression?, trigger_at?, repeat? }.
/api/v1/scheduledList scheduled items. Query params: entity_id?, active_only?. Returns all scheduled reminders with next trigger time.
/api/v1/schedule/ackAcknowledge a triggered schedule. Body: { schedule_id }. Prevents re-triggering for one-shot schedules.
/api/v1/schedule/:idUpdate a scheduled item. Body: { content?, cron_expression?, trigger_at?, active? }.
/api/v1/schedule/:idDelete a scheduled item permanently.
Watcher endpoints.
/api/v1/watcher/statusReturns the current watcher state including running status, adaptive mode, watched entities, and next tick time.
/api/v1/watcher/historyReturns the tick history ring buffer for auditing. Shows recent heartbeat check results and timing.
/api/v1/watcher/startStart the heartbeat watcher loop. Body: { entity_ids, interval_ms?, adaptive?, delivery? }. Begins polling for watched entities.
/api/v1/watcher/stopStop the heartbeat watcher loop. No more automatic heartbeat checks until restarted.
/api/v1/watcher/watchAdd an entity to the watch list. Body: { entity_id }. The watcher will include this entity in heartbeat scans.
/api/v1/watcher/unwatchRemove an entity from the watch list. Body: { entity_id }. Stops heartbeat scanning for this entity.
Teams endpoints.
/api/v1/teamsCreate a new team. Body: { name, description? }. Returns team ID.
/api/v1/teams/:idGet team details including member list, shared memory count, and team stats.
/api/v1/teams/:idDelete a team. Does not delete member entities or their memories.
/api/v1/teams/:id/membersAdd a member to a team. Body: { agent_id, role? }. Members share team-scoped memories.
/api/v1/teams/:id/members/:agent_idRemove a member from a team. Their personal memories are unaffected.
/api/v1/teams/:id/membersList all members of a team with their roles and join dates.
Other endpoints.
/api/v1/entitiesList all known entities (people, orgs, locations, products) and their relationship graph. Query params: type?, limit?.
/api/v1/consolidateTrigger memory consolidation for an entity. Merges near-duplicates, resolves conflicts, and rebuilds the HNSW index. Body: { entity_id }.
/api/v1/eventsServer-Sent Events stream. Real-time notifications for memory changes, heartbeat signals, and watcher events. Connect with EventSource.
Example
Store and search memories.
# Store a conversation exchange
curl -X POST http://localhost:18900/api/v1/remember \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"entity_id": "user-1",
"content": "User: I just got promoted to senior engineer\nAgent: Congratulations!"
}'
# Search memories
curl -X POST http://localhost:18900/api/v1/search \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"entity_id": "user-1",
"query": "career milestones",
"limit": 5
}'Standard HTTP responses.
| Code | Meaning |
|---|---|
200 | Success |
201 | Created (new memory, schedule, team) |
400 | Bad request — missing or invalid parameters |
401 | Unauthorized — missing or invalid Bearer token |
404 | Not found — invalid memory/schedule/team ID |
500 | Internal server error |