REST API Reference
The MemoryLayer server exposes a RESTful API at http://localhost:61001 by default. Endpoints accept and return JSON unless noted otherwise (document upload is multipart/form-data; workspace export streams NDJSON).
This page is reconciled against the OpenAPI schema of MemoryLayer server 0.2.0. A running server also publishes its own live schema:
| URL | Content |
|---|---|
GET /openapi.json | Machine-readable OpenAPI schema for the exact build you are running |
GET /docs | Interactive Swagger UI |
GET /redoc | ReDoc rendering of the same schema |
The schema includes any routes contributed by installed server plugins (for example the /v1/rpg routes from memorylayer-server-rpg).
Authentication
The core server ships with open authentication (MEMORYLAYER_AUTHENTICATION_SERVICE=default): every request is allowed and no key is needed for local development. When an authentication service that checks credentials is configured (for example aether), send the API key in the Authorization header. Both Bearer <key> and a raw key are accepted:
Authorization: Bearer your-api-keyContext headers:
| Header | Purpose |
|---|---|
X-Session-ID | Session whose workspace and context are used when the request does not name a workspace. Required by the Context Environment endpoints. |
X-Workspace-ID | Workspace to use when neither the request body nor the workspace_id query parameter names one |
The workspace is resolved in this order: workspace_id in the request body, the workspace_id query parameter, the X-Workspace-ID header, the session’s workspace, then _default.
Conditional writes: versioned resources (the memory revision endpoints, skill manifests, prompt notes, agent specifications, refinement records, and workspace views) use HTTP preconditions. Create calls need Idempotency-Key plus If-None-Match: *. Replace, delete, and restore calls need Idempotency-Key plus If-Match: <etag>. Current ETags come back in the ETag response header. A missing header returns 428 Precondition Required, a stale ETag returns 412 Precondition Failed, and a conflicting replay returns 409 Conflict.
Root
GET /
Returns the API name, server version, and a short description.
curl http://localhost:61001/{ "name": "MemoryLayer.ai", "version": "0.2.0", "description": "API-first memory infrastructure for LLM-powered agents"}Memory Operations
POST /v1/memories
Store a new memory with automatic embedding and classification.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | yes | — | Memory content to store |
workspace_id | string | no | from session or _default | Workspace override |
type | string | no | auto-classified | Cognitive type: episodic, semantic, procedural, working |
subtype | string | no | null | Domain-specific classification |
importance | float | no | 0.5 | Memory importance (0.0-1.0) |
tags | string[] | no | [] | Tags for categorization |
metadata | object | no | {} | Arbitrary metadata |
logical_key | string | no | null | Stable workspace/owner-scoped key for conditional refinement. Requires the Idempotency-Key and If-None-Match: * headers. |
refinement_metadata | object | no | {} | Semantic metadata protected by the memory resource ETag |
pinned | boolean | no | false | Pin the memory against retention decay |
associations | string[] | no | [] | Memory IDs to associate with |
relations | object[] | no | [] | Typed structural entity relations evidenced by this memory. Each item has relationship plus a source and target, given as source_entity_id/source_entity_name and target_entity_id/target_entity_name. Optional fields are confidence, evidence_kind, and the span offsets. |
context_id | string | no | from session | Target memory context |
observer_id | string | no | null | Entity doing the observing (agent ID, user ID) |
subject_id | string | no | null | Entity this memory is about |
user_id | string | no | from auth | User scope for this memory |
scope | string | no | workspace | workspace (stored in the workspace) or user (cross-workspace user-global memory; requires a user_id) |
Sending Idempotency-Key and If-None-Match: * makes the create conditional and idempotent. A retried request with the same key returns the original memory with "replayed": true.
Response: 201 Created
{ "memory": { "id": "mem_abc123", "content": "User prefers Python for backend development", "type": "semantic", "subtype": "preference", "importance": 0.8, "tags": ["preferences", "programming"], "created_at": "2026-01-15T10:30:00Z" }, "replayed": false}curl example:
curl -X POST http://localhost:61001/v1/memories \ -H "Content-Type: application/json" \ -d '{ "content": "User prefers Python for backend development", "type": "semantic", "importance": 0.8, "tags": ["preferences", "programming"] }'GET /v1/memories
List memories in a workspace, newest first (created_at descending).
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 50 | Maximum memories to return |
offset | integer | 0 | Number of memories to skip |
type | string | null | Filter by cognitive type |
subtype | string | null | Filter by domain subtype |
tag | string | null | Filter by a single tag |
context_id | string | null | Filter by memory context |
include_embeddings | boolean | false | Include each memory’s raw embedding vector. Vectors are omitted by default because they dominate the payload. |
Response: 200 OK with {"memories": [...], "total_count": N}
curl "http://localhost:61001/v1/memories?limit=20&type=semantic"GET /v1/memories/{memory_id}
Retrieve a single memory by ID.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Memory identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
include_deleted | boolean | false | Return the memory even if it has been soft-deleted |
workspace_id | string | from context | Workspace override |
Response: 200 OK
{ "memory": { "id": "mem_abc123", "content": "User prefers Python for backend development", "type": "semantic", "importance": 0.8, "tags": ["preferences", "programming"], "created_at": "2026-01-15T10:30:00Z", "updated_at": "2026-01-15T10:30:00Z" }}curl example:
curl http://localhost:61001/v1/memories/mem_abc123PUT /v1/memories/{memory_id}
Update an existing memory. Only provided fields are updated.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Memory identifier |
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
content | string | no | Updated content |
type | string | no | Updated cognitive type |
subtype | string | no | Updated domain classification |
importance | float | no | Updated importance (0.0-1.0) |
tags | string[] | no | Updated tags |
metadata | object | no | Updated metadata |
refinement_metadata | object | no | Updated semantic refinement metadata |
pinned | boolean | no | Pin/unpin memory (pinned memories are exempt from decay) |
Response: 200 OK
{ "memory": { "id": "mem_abc123", "content": "User strongly prefers Python for backend development", "importance": 0.9, "pinned": true }}curl example:
curl -X PUT http://localhost:61001/v1/memories/mem_abc123 \ -H "Content-Type: application/json" \ -d '{ "importance": 0.9, "pinned": true }'DELETE /v1/memories/{memory_id}
Delete a memory (soft delete by default).
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Memory identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
hard | boolean | false | Permanently delete instead of archiving |
Response: 204 No Content
curl example:
# Soft delete (archive)curl -X DELETE http://localhost:61001/v1/memories/mem_abc123
# Hard delete (permanent)curl -X DELETE "http://localhost:61001/v1/memories/mem_abc123?hard=true"POST /v1/memories/recall
Search memories with a natural-language query. Vector similarity is combined with the filters below and, where enabled, with graph, entity, fact, and typed-relation retrieval channels.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | yes | — | Natural language query |
workspace_id | string | no | from session | Workspace override |
types | string[] | no | [] | Filter by cognitive types |
subtypes | string[] | no | [] | Filter by domain subtypes |
tags | string[] | no | [] | Filter by tags (AND logic) |
context_id | string | no | from session | Filter by memory context |
observer_id | string | no | null | Filter by observer entity |
subject_id | string | no | null | Filter by subject entity |
user_id | string | no | from auth | Filter by user |
include_global | boolean | no | true | Also search the _global workspace |
include_global_user | boolean | no | true | Also search the user-scoped global workspace (_global_user), filtered by the same user_id |
mode | string | no | rag | Retrieval strategy (see below) |
tolerance | string | no | moderate | Search precision: loose, moderate, strict |
limit | integer | no | 10 | Maximum memories to return (1-100) |
offset | integer | no | 0 | Results to skip, for pagination |
include_embeddings | boolean | no | false | Include each memory’s raw embedding vector |
min_relevance | float | no | server default | Minimum relevance score (0.0-1.0) |
recency_weight | float | no | server default | Weight for recency boosting (0.0-1.0) |
include_associations | boolean | no | server default | Include linked memories |
traverse_depth | integer | no | server default | Multi-hop graph traversal depth (0-5) |
max_expansion | integer | no | server default | Max memories via graph expansion (1-500) |
created_after | datetime | no | null | Filter memories created after this time |
created_before | datetime | no | null | Filter memories created before this time |
event_after | datetime | no | null | Keep memories whose effective event time is on or after this |
event_before | datetime | no | null | Keep memories whose effective event time is on or before this |
time_order | string | no | null | Order by effective event time, asc or desc (null = by relevance) |
context | object[] | no | [] | Recent conversation context |
rag_threshold | float | no | 0.8 | In hybrid mode, fall back to LLM retrieval when the top RAG score is below this |
detail_level | string | no | full | abstract, overview, or full |
include_archived | boolean | no | false | Include archived memories |
exclude_ids | string[] | no | [] | Memory IDs to exclude from results |
budget_tokens | integer | no | null | Hard estimated-token budget for returned content |
include_confidence | boolean | no | true | Include deterministic retrieval confidence (retrieval_confidence, confidence_reasons) |
include_relations | boolean | no | true | Allow bounded typed-relation retrieval when it is enabled on the server |
Retrieval Modes:
| Mode | Description |
|---|---|
rag | Default. Vector similarity plus the enabled retrieval channels, no LLM calls. |
llm | Query rewriting with an LLM, then tiered search. Requires a configured LLM provider and a generation policy that allows query rewriting. |
hybrid | Runs rag first and falls back to llm when the top result scores below rag_threshold and query rewriting is available. |
agentic | An iterative, LLM-controlled expand/re-query loop implemented by MemoryLayer Enterprise. The core server handles it like hybrid. |
For multi-step, LLM-driven analysis over memories, see the Context Environment and its RLM loop.
Response: 200 OK
{ "memories": [ { "id": "mem_abc123", "content": "User prefers Python for backend development", "type": "semantic", "importance": 0.8, "tags": ["preferences", "programming"] } ], "total_count": 1, "mode_used": "rag", "search_latency_ms": 42, "retrieval_confidence": "strong", "confidence_reasons": []}Additional optional response fields include query_rewritten, budget_summary, generation_summary, relation_paths, drift_caveat, and freshness_metadata.
curl example:
curl -X POST http://localhost:61001/v1/memories/recall \ -H "Content-Type: application/json" \ -H "X-Session-ID: sess_abc123" \ -d '{ "query": "What programming languages does the user prefer?", "limit": 10, "types": ["semantic"], "tags": ["preferences"] }'POST /v1/memories/reflect
Synthesize insights across memories using LLM reflection.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | yes | — | What to reflect on |
workspace_id | string | no | from session | Workspace override |
detail_level | string | no | server default | Level of detail: abstract, overview, full |
include_sources | boolean | no | true | Include source memory references |
depth | integer | no | 2 | Association traversal depth (1-5) |
types | string[] | no | [] | Filter by types |
subtypes | string[] | no | [] | Filter by subtypes |
tags | string[] | no | [] | Filter by tags |
context_id | string | no | from session | Filter by memory context |
observer_id | string | no | null | Filter by observer entity |
subject_id | string | no | null | Filter by subject entity |
Response: 200 OK
{ "reflection": "Based on stored memories, the user prefers...", "source_memories": ["mem_abc123", "mem_def456"], "confidence": 0.85, "tokens_processed": 1840}curl example:
curl -X POST http://localhost:61001/v1/memories/reflect \ -H "Content-Type: application/json" \ -d '{ "query": "Summarize user technology preferences", "detail_level": "overview", "include_sources": true, "depth": 2 }'POST /v1/memories/{memory_id}/decay
Apply decay to reduce a memory’s importance over time. Pinned memories are exempt from decay.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Memory identifier |
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
decay_rate | float | no | 0.1 | Decay rate to apply (0.0-1.0) |
Response: 200 OK — returns the updated memory with decayed importance.
curl example:
curl -X POST http://localhost:61001/v1/memories/mem_abc123/decay \ -H "Content-Type: application/json" \ -d '{"decay_rate": 0.1}'POST /v1/memories/batch
Perform multiple memory operations in a single request. Supports create, update, and delete operations.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
operations | object[] | yes | List of typed batch operations |
Each operation must include an op field set to "create", "update", or "delete".
Create operation fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
op | string | yes | — | Must be "create" |
content | string | yes | — | Memory content |
type | string | no | auto-classified | Cognitive type |
subtype | string | no | null | Domain classification |
importance | float | no | 0.5 | Importance (0.0-1.0) |
tags | string[] | no | [] | Tags |
metadata | object | no | {} | Metadata |
observer_id | string | no | null | Observer entity |
subject_id | string | no | null | Subject entity |
Update operation fields:
| Field | Type | Required | Description |
|---|---|---|---|
op | string | yes | Must be "update" |
memory_id | string | yes | Memory ID to update |
content | string | no | Updated content |
type | string | no | Updated type |
subtype | string | no | Updated subtype |
importance | float | no | Updated importance |
tags | string[] | no | Updated tags |
metadata | object | no | Updated metadata |
pinned | boolean | no | Pin/unpin memory |
Delete operation fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
op | string | yes | — | Must be "delete" |
memory_id | string | yes | — | Memory ID to delete |
hard | boolean | no | false | Hard delete (permanent) |
Response: 200 OK
{ "total_operations": 3, "successful": 2, "failed": 1, "results": [ {"index": 0, "type": "create", "status": "success", "memory_id": "mem_new1"}, {"index": 1, "type": "create", "status": "success", "memory_id": "mem_new2"}, {"index": 2, "type": "delete", "status": "error", "error": "Memory not found: mem_old"} ]}curl example:
curl -X POST http://localhost:61001/v1/memories/batch \ -H "Content-Type: application/json" \ -d '{ "operations": [ {"op": "create", "content": "Memory 1", "importance": 0.7}, {"op": "create", "content": "Memory 2", "importance": 0.8}, {"op": "delete", "memory_id": "mem_old", "hard": false} ] }'Versioned memory operations
These endpoints treat a memory as a versioned resource with immutable revisions. They need the conditional-write headers described under Authentication: Idempotency-Key plus If-Match: <etag>. The current ETag is returned in the ETag response header. All of them accept an optional workspace_id query parameter.
| Endpoint | Purpose |
|---|---|
PUT /v1/memories/{memory_id}/semantic | Conditionally replace the full refinement-owned memory document. Body: content (required), type (required), subtype, tags, refinement_metadata, pinned. |
POST /v1/memories/{memory_id}/delete | Conditionally tombstone a memory. Returns {"memory": ..., "replayed": bool}. |
POST /v1/memories/{memory_id}/restore | Conditionally restore a tombstoned memory |
GET /v1/memories/{memory_id}/revisions | List immutable revisions, newest first. Query: limit (default 100), page_token. |
curl -X PUT http://localhost:61001/v1/memories/mem_abc123/semantic \ -H "Content-Type: application/json" \ -H "Idempotency-Key: refine-2026-01-15-001" \ -H 'If-Match: "etag-from-previous-response"' \ -d '{"content": "User prefers Python 3.12 for backend work", "type": "semantic", "tags": ["preferences"]}'Associations
Relationship types are lowercase identifiers such as similar_to, causes, solves, leads_to, part_of, depends_on, and supersedes. GET /v1/workspaces/{workspace_id}/schema returns the full list.
POST /v1/memories/{memory_id}/associate
Create a typed relationship between two memories.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Source memory ID |
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
target_id | string | yes | — | Target memory ID |
relationship | string | yes | — | Relationship type (e.g., similar_to, causes, solves) |
strength | float | no | 0.5 | Relationship strength (0.0-1.0) |
metadata | object | no | {} | Arbitrary metadata |
workspace_id | string | no | from session | Workspace override |
Response: 201 Created
{ "association": { "id": "assoc_xyz789", "source_id": "mem_problem_123", "target_id": "mem_solution_456", "relationship": "solves", "strength": 0.9, "created_at": "2026-01-15T10:30:00Z" }}curl example:
curl -X POST http://localhost:61001/v1/memories/mem_problem_123/associate \ -H "Content-Type: application/json" \ -d '{ "target_id": "mem_solution_456", "relationship": "solves", "strength": 0.9 }'GET /v1/memories/{memory_id}/associations
Get all associations for a memory.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Memory identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
relationships | string | null | Comma-separated relationship types to filter by |
direction | string | both | outgoing, incoming, or both |
Response: 200 OK
{ "associations": [ { "id": "assoc_xyz789", "source_id": "mem_problem_123", "target_id": "mem_solution_456", "relationship": "solves", "strength": 0.9 } ], "total_count": 1}curl example:
# All associationscurl http://localhost:61001/v1/memories/mem_abc123/associations
# Filter by relationship type and directioncurl "http://localhost:61001/v1/memories/mem_abc123/associations?relationships=causes,solves&direction=outgoing"PATCH /v1/memories/{memory_id}/associations/{association_id}
Update an association’s strength and/or metadata. Omitted fields are unchanged; metadata, when given, replaces the existing metadata.
| Field | Type | Required | Description |
|---|---|---|---|
strength | float | no | New relationship strength (0.0-1.0) |
metadata | object | no | Replacement metadata |
Response: 204 No Content
curl -X PATCH http://localhost:61001/v1/memories/mem_abc123/associations/assoc_xyz789 \ -H "Content-Type: application/json" \ -d '{"strength": 0.95}'DELETE /v1/memories/{memory_id}/associations/{association_id}
Delete an association (graph edge) by ID.
Response: 204 No Content
POST /v1/memories/{memory_id}/traverse
Multi-hop graph traversal starting from a specific memory.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
memory_id | string | Starting memory for traversal |
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
workspace_id | string | no | from session | Workspace override |
max_depth | integer | no | 2 | Maximum traversal depth (1-5) |
relationship_types | string[] | no | [] | Filter by relationship types (empty = all) |
direction | string | no | both | outgoing, incoming, or both |
min_strength | float | no | 0.0 | Minimum edge strength (0.0-1.0) |
Response: 200 OK
{ "paths": [ { "nodes": ["mem_a", "mem_b", "mem_c"], "edges": [ {"id": "assoc_1", "source_id": "mem_a", "target_id": "mem_b", "relationship": "causes", "strength": 0.9}, {"id": "assoc_2", "source_id": "mem_b", "target_id": "mem_c", "relationship": "leads_to", "strength": 0.8} ], "total_strength": 0.72, "depth": 2 } ], "unique_nodes": ["mem_a", "mem_b", "mem_c"], "total_paths": 1, "query_latency_ms": 12}curl example:
curl -X POST http://localhost:61001/v1/memories/mem_abc123/traverse \ -H "Content-Type: application/json" \ -d '{ "relationship_types": ["causes", "leads_to"], "max_depth": 3, "direction": "both", "min_strength": 0.5 }'Sessions
POST /v1/sessions
Create a new working memory session. Workspaces and contexts are auto-created if they do not exist.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
session_id | string | no | auto-generated | Client-provided session ID |
workspace_id | string | no | _default | Workspace ID (auto-created if absent) |
ttl_seconds | integer | no | 3600 | Session TTL in seconds (60-86400) |
metadata | object | no | {} | Session metadata |
context_id | string | no | _default | Context to bind session to |
working_memory | object | no | null | Initial working memory key-value pairs |
briefing | boolean | no | false | Include briefing with relevant memories |
briefing_options | object | no | null | Briefing options: lookback_hours, detail_level, limit |
Response: 201 Created
{ "session": { "id": "sess_abc123", "workspace_id": "my-workspace", "context_id": "_default", "expires_at": "2026-01-15T11:30:00Z", "metadata": {"task": "debugging"} }, "briefing": null}curl example:
curl -X POST http://localhost:61001/v1/sessions \ -H "Content-Type: application/json" \ -d '{ "workspace_id": "my-workspace", "ttl_seconds": 3600, "metadata": {"task": "debugging"}, "briefing": true }'GET /v1/sessions
List sessions in a workspace.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace to list sessions for |
context_id | string | null | Filter by context |
include_expired | boolean | false | Include expired sessions |
Response: 200 OK
{ "sessions": [ { "id": "sess_abc123", "workspace_id": "my-workspace", "expires_at": "2026-01-15T11:30:00Z" } ], "total_count": 1}curl example:
curl "http://localhost:61001/v1/sessions?workspace_id=my-workspace&include_expired=false"GET /v1/sessions/briefing
Get a briefing of recent workspace activity and context. Includes workspace summary, recent sessions, open threads, and detected contradictions.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace to get briefing for |
lookback_minutes | integer | 60 | How far back to look for activity |
detail_level | string | abstract | Detail level for memory content |
limit | integer | 10 | Maximum items to include |
include_memories | boolean | true | Include recent memories |
include_contradictions | boolean | true | Include detected contradictions |
Response: 200 OK
{ "briefing": { "workspace_id": "my-workspace", "summary": "Workspace has 142 memories. 3 sessions active.", "recent_memories": [], "contradictions": [] }}curl example:
curl "http://localhost:61001/v1/sessions/briefing?workspace_id=my-workspace&lookback_minutes=120"GET /v1/sessions/{session_id}
Retrieve a session by ID.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
session_id | string | Session identifier |
Response: 200 OK
{ "session": { "id": "sess_abc123", "workspace_id": "my-workspace", "expires_at": "2026-01-15T11:30:00Z", "metadata": {"task": "debugging"} }}curl example:
curl http://localhost:61001/v1/sessions/sess_abc123DELETE /v1/sessions/{session_id}
Delete a session and all its context data.
Response: 204 No Content
curl example:
curl -X DELETE http://localhost:61001/v1/sessions/sess_abc123POST /v1/sessions/{session_id}/memory
Store a key-value pair in session working memory.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
session_id | string | Session identifier |
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
key | string | yes | — | Working memory key |
value | any | yes | — | Working memory value (JSON-serializable) |
ttl_seconds | integer | no | null | Optional TTL override for this entry |
Response: 201 Created
{ "key": "current_task", "value": {"description": "Debugging auth", "file": "auth.py"}, "ttl_seconds": null, "created_at": "2026-01-15T10:30:00Z", "updated_at": "2026-01-15T10:30:00Z"}curl example:
curl -X POST http://localhost:61001/v1/sessions/sess_abc123/memory \ -H "Content-Type: application/json" \ -d '{ "key": "current_task", "value": {"description": "Debugging auth", "file": "auth.py"} }'GET /v1/sessions/{session_id}/memory
Retrieve working memory from a session. Returns a single entry if key is specified, or all entries otherwise.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
session_id | string | Session identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | null | Specific key to retrieve (returns all if omitted) |
Response: 200 OK
{ "current_task": {"description": "Debugging auth", "file": "auth.py"}, "findings": ["Issue in token validation"]}curl example:
# Get all working memorycurl http://localhost:61001/v1/sessions/sess_abc123/memory
# Get specific keycurl "http://localhost:61001/v1/sessions/sess_abc123/memory?key=current_task"POST /v1/sessions/{session_id}/commit
Commit session working memory to long-term storage. Working memories are persisted via write-behind as they are written during the session, so this operation is lightweight.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
session_id | string | Session identifier |
Request Body (optional):
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
min_importance | float | no | 0.5 | Minimum importance threshold (0.0-1.0) |
deduplicate | boolean | no | true | Enable deduplication of extracted memories |
categories | string[] | no | null | Category names to commit (null for all) |
max_memories | integer | no | 50 | Maximum memories to extract (1-500) |
Response: 200 OK
{ "session_id": "sess_abc123", "memories_extracted": 5, "memories_deduplicated": 1, "memories_created": 4, "breakdown": {"task": 2, "findings": 2}, "extraction_time_ms": 150}curl example:
curl -X POST http://localhost:61001/v1/sessions/sess_abc123/commit \ -H "Content-Type: application/json" \ -d '{ "min_importance": 0.5, "deduplicate": true, "max_memories": 50 }'POST /v1/sessions/{session_id}/touch
Extend session TTL using sliding window. Resets the session’s expires_at to now + TTL.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
session_id | string | Session identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
extend_seconds | integer | server default | Seconds to extend TTL (60-86400) |
Response: 200 OK
{ "expires_at": "2026-01-15T12:30:00Z"}curl example:
# Extend with default TTLcurl -X POST http://localhost:61001/v1/sessions/sess_abc123/touch
# Extend by 2 hourscurl -X POST "http://localhost:61001/v1/sessions/sess_abc123/touch?extend_seconds=7200"POST /v1/sessions/{session_id}/checkpoints
Durably capture a raw transcript segment for a session, for example just before an agent host compacts its context. The segment is stored as a raw memory, then indexed and enriched in the background. The request is idempotent on idempotency_key.
Capture is on by default. It is controlled by MEMORYLAYER_SESSION_CHECKPOINT_CAPTURE_ENABLED, and segment size is capped by MEMORYLAYER_SESSION_CHECKPOINT_MAX_BYTES (default 1 MiB). The endpoint returns 503 when capture is disabled and 501 when the storage backend lacks checkpoint support.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
transcript_segment | string | yes | — | Raw transcript text to capture |
content_hash | string | yes | — | Hex SHA-256 of the UTF-8 encoded segment (64 chars); a mismatch returns 400 |
idempotency_key | string | yes | — | Client key that makes retries safe (1-255 chars) |
source_kind | string | no | transcript | Kind of source being captured |
source_sequence | integer | no | null | Monotonic sequence number from the source |
source_boundary | integer | no | null | Boundary offset within the source |
Response: 201 Created returns a checkpoint with id, raw_memory_id, byte_count, capture_status, index_status, enrichment_status, and timestamps.
curl -X POST http://localhost:61001/v1/sessions/sess_abc123/checkpoints \ -H "Content-Type: application/json" \ -d '{ "transcript_segment": "user: ...\nassistant: ...", "content_hash": "<sha256-hex-of-segment>", "idempotency_key": "sess_abc123-precompact-7" }'GET /v1/sessions/{session_id}/checkpoints/{checkpoint_id}
Fetch a single checkpoint and its capture, index, and enrichment status.
POST /v1/sessions/{session_id}/context-pack
Build a budgeted, deterministic context pack for a session. It combines directives, working memory, recent activity, open threads, unresolved contradictions, a sandbox summary, and checkpoint recovery, all fitted to a token budget. The response includes a signed cursor that you can pass to context-delta later. Context packs are on by default (MEMORYLAYER_CONTEXT_PACK_ENABLED) and return 503 when disabled.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
topic | string | no | null | Optional topic to focus the pack |
entity_ids | string[] | no | [] | Canonical entity IDs to focus on |
entity_names | string[] | no | [] | Entity surface names to focus on |
budget_tokens | integer | no | 2048 | Token budget (32-200000) |
section_limits | object | no | see below | Per-section item caps: directives (8), working_memory (20), recent_activity (20), contradictions (5), checkpoints (8) |
include_directives | boolean | no | true | Include directive memories |
include_working_memory | boolean | no | true | Include session working memory |
include_recent_activity | boolean | no | true | Include recent activity |
include_contradictions | boolean | no | true | Include unresolved contradictions |
include_sandbox_summary | boolean | no | true | Include a Context Environment summary |
include_checkpoint_recovery | boolean | no | true | Include recovered checkpoint content |
Response: 200 OK
{ "rendered": "...", "items": [ {"id": "mem_1", "kind": "directives", "content": "Always run tests before committing", "importance": 0.9, "match_signals": ["explicit"]} ], "open_threads": [], "unresolved_contradictions": [], "budget_summary": {"requested": 2048, "used": 812, "estimator": "...", "truncated_items": 0, "omitted_items": 0}, "cursor": "<signed-cursor>", "degradation_notices": []}curl -X POST http://localhost:61001/v1/sessions/sess_abc123/context-pack \ -H "Content-Type: application/json" \ -d '{"topic": "auth refactor", "budget_tokens": 4096}'POST /v1/sessions/{session_id}/context-delta
Return only what changed since a previous pack or delta, starting from its cursor.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
cursor | string | yes | — | Cursor from a previous context pack or delta |
budget_tokens | integer | no | 2048 | Token budget (32-200000) |
Response: 200 OK with rendered, items, budget_summary, a new cursor, and has_more. An expired cursor returns 409 Conflict with "recovery": "request_context_pack". When that happens, request a fresh pack.
curl -X POST http://localhost:61001/v1/sessions/sess_abc123/context-delta \ -H "Content-Type: application/json" \ -d '{"cursor": "<cursor-from-previous-pack>"}'Workspaces
POST /v1/workspaces
Create a new workspace. Workspaces provide memory isolation.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | no | generated | Optional workspace ID |
name | string | yes | — | Workspace name |
settings | object | no | {} | Workspace-level settings |
tags | string[] | no | [] | Tags for discovery/lookup (e.g. knowledge, topic:finance) |
Response: 201 Created
{ "workspace": { "id": "ws_a1b2c3d4e5f6g7h8", "tenant_id": "_default", "name": "My Project", "settings": {}, "tags": [], "created_at": "2026-01-15T10:30:00Z" }}curl example:
curl -X POST http://localhost:61001/v1/workspaces \ -H "Content-Type: application/json" \ -d '{"name": "My Project", "settings": {}}'GET /v1/workspaces
List workspaces, optionally filtered by tag.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
tags | string[] | null | Tag filter; repeat the parameter for several tags (?tags=knowledge&tags=topic:finance) |
match | string | all | all (every tag must match) or any (at least one) |
Response: 200 OK
{ "workspaces": [ {"id": "ws_abc123", "name": "Project Alpha"}, {"id": "_default", "name": "Default"} ]}curl example:
curl http://localhost:61001/v1/workspacesGET /v1/workspaces/{workspace_id}
Get workspace details.
Response: 200 OK
{ "workspace": { "id": "ws_abc123", "name": "Project Alpha", "settings": {}, "created_at": "2026-01-15T10:30:00Z" }}curl example:
curl http://localhost:61001/v1/workspaces/ws_abc123PUT /v1/workspaces/{workspace_id}
Update workspace name, settings, or tags.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | Updated workspace name |
settings | object | no | Updated settings |
tags | string[] | no | Updated tags |
Response: 200 OK — returns the updated workspace.
curl example:
curl -X PUT http://localhost:61001/v1/workspaces/ws_abc123 \ -H "Content-Type: application/json" \ -d '{"name": "Project Alpha v2"}'DELETE /v1/workspaces/{workspace_id}
Delete a workspace and all associated data.
Response: 204 No Content
curl example:
curl -X DELETE http://localhost:61001/v1/workspaces/ws_abc123GET /v1/workspaces/{workspace_id}/schema
Get workspace schema including available relationship types and memory subtypes.
Response: 200 OK
{ "relationship_types": ["parent_of", "part_of", "causes", "leads_to", "similar_to", "solves", "..."], "memory_subtypes": ["solution", "problem", "code_pattern", "preference", "decision", "directive", "..."], "can_customize": false}curl example:
curl http://localhost:61001/v1/workspaces/ws_abc123/schemaGET /v1/workspaces/{workspace_id}/export
Export workspace memories and associations as streaming NDJSON.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
offset | integer | 0 | Skip first N memories |
limit | integer | 0 | Max memories to export (0 = unlimited) |
include_associations | boolean | true | Include memory associations |
Response: 200 OK with Content-Type: application/x-ndjson
The stream contains lines of JSON objects with these types:
| Line type | Description |
|---|---|
header | Export metadata (version, workspace, counts) |
memory | Individual memory with index |
association | Individual association |
footer | Summary counts |
curl example:
# Export all memories to filecurl http://localhost:61001/v1/workspaces/ws_abc123/export -o export.ndjson
# Export first 100 memories without associationscurl "http://localhost:61001/v1/workspaces/ws_abc123/export?limit=100&include_associations=false"POST /v1/workspaces/{workspace_id}/import
Import memories and associations from JSON or NDJSON export. Supports both application/json and application/x-ndjson content types. Duplicate memories (by content hash) are automatically skipped.
Request Body (JSON format):
{ "data": { "version": "1.0", "workspace_id": "source-workspace", "exported_at": "2026-01-15T10:30:00Z", "memories": [ {"id": "mem_1", "content": "...", "content_hash": "...", "type": "semantic"} ], "associations": [ {"source_id": "mem_1", "target_id": "mem_2", "relationship_type": "SIMILAR_TO", "strength": 0.8} ] }}Response: 200 OK
{ "imported": 10, "skipped_duplicates": 2, "errors": 0, "details": ["Imported 5 associations"]}curl example:
# Import from NDJSON filecurl -X POST http://localhost:61001/v1/workspaces/ws_abc123/import \ -H "Content-Type: application/x-ndjson" \ --data-binary @export.ndjson
# Import from JSONcurl -X POST http://localhost:61001/v1/workspaces/ws_abc123/import \ -H "Content-Type: application/json" \ -d @import.jsonWorkspace contexts
Contexts are logical groupings inside a workspace (sessions, threads, and memories can target a context_id).
| Endpoint | Purpose |
|---|---|
POST /v1/workspaces/{workspace_id}/contexts | Create a context. Body: name (required, unique within the workspace), optional id, description, settings. Returns 201. |
GET /v1/workspaces/{workspace_id}/contexts | List all contexts in the workspace |
DELETE /v1/workspaces/{workspace_id}/contexts/{context_id} | Delete a context. Its memories are not deleted. Returns 204. |
curl -X POST http://localhost:61001/v1/workspaces/my-workspace/contexts \ -H "Content-Type: application/json" \ -d '{"name": "backend", "description": "Backend service work"}'Workspace views
Workspace views are versioned records that describe a concrete working copy of a workspace (a directory, git worktree, checkout, snapshot, or overlay). Each view can hold per-observer observations of its state (root reference, capabilities, and VCS status). Writes use the conditional-write headers described under Authentication.
| Endpoint | Purpose |
|---|---|
POST /v1/workspaces/{workspace_id}/views | Create a view. Body: view_id (required), kind (required: directory, git_worktree, checkout, snapshot, overlay), display_name, memory_context_id, capabilities, metadata. |
GET /v1/workspaces/{workspace_id}/views | List views (limit, page_token, include_deleted) |
GET /v1/workspaces/{workspace_id}/views/{view_id} | Get a view (include_deleted) |
PUT /v1/workspaces/{workspace_id}/views/{view_id} | Replace a view |
DELETE /v1/workspaces/{workspace_id}/views/{view_id} | Tombstone a view |
POST /v1/workspaces/{workspace_id}/views/{view_id}/restore | Restore a tombstoned view |
GET /v1/workspaces/{workspace_id}/views/{view_id}/revisions | List view revisions |
GET /v1/workspaces/{workspace_id}/views/{view_id}/observations | List observations of a view |
GET /v1/workspaces/{workspace_id}/views/{view_id}/observations/{observer_id} | Get one observer’s observation |
PUT /v1/workspaces/{workspace_id}/views/{view_id}/observations/{observer_id} | Write an observation. Body: generation and sequence (required), plus optional tool_host_id, execution_site (client, worker, remote), root_ref, capabilities, vcs, observed_at, expires_at, metadata. |
DELETE /v1/workspaces/{workspace_id}/views/{view_id}/observations/{observer_id} | Tombstone an observation |
POST /v1/workspaces/{workspace_id}/views/{view_id}/observations/{observer_id}/restore | Restore an observation |
GET /v1/workspaces/{workspace_id}/views/{view_id}/observations/{observer_id}/revisions | List observation revisions |
Contradictions
GET /v1/workspaces/{workspace_id}/contradictions
List unresolved contradictions in a workspace.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
workspace_id | string | Workspace identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 10 | Maximum contradictions to return |
Response: 200 OK
{ "contradictions": [ { "id": "ctr_abc123", "workspace_id": "my-workspace", "memory_a_id": "mem_1", "memory_b_id": "mem_2", "contradiction_type": "value_conflict", "confidence": 0.85, "detection_method": "semantic", "detected_at": "2026-01-15T10:30:00Z", "resolved_at": null, "resolution": null } ], "count": 1}curl example:
curl "http://localhost:61001/v1/workspaces/my-workspace/contradictions?limit=20"POST /v1/contradictions/{contradiction_id}/resolve
Resolve a contradiction with a chosen strategy.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
contradiction_id | string | Contradiction identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace override |
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
resolution | string | yes | Strategy: keep_a, keep_b, keep_both, or merge |
merged_content | string | when merge | Merged content (required when resolution is merge) |
Response: 200 OK — returns the resolved contradiction.
curl example:
# Keep one memorycurl -X POST http://localhost:61001/v1/contradictions/ctr_abc123/resolve \ -H "Content-Type: application/json" \ -d '{"resolution": "keep_a"}'
# Merge conflicting memoriescurl -X POST http://localhost:61001/v1/contradictions/ctr_abc123/resolve \ -H "Content-Type: application/json" \ -d '{"resolution": "merge", "merged_content": "User prefers Python 3.11+ for backend work"}'POST /v1/workspaces/{workspace_id}/contradictions/scan
Trigger a workspace-wide scan for contradictions among stored memories.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
workspace_id | string | Workspace identifier |
Request Body (optional):
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
batch_size | integer | no | server default | Memories to process per batch (1-500) |
Response: 200 OK
{ "workspace_id": "my-workspace", "contradictions_found": 2, "contradictions": [ { "id": "ctr_new1", "memory_a_id": "mem_1", "memory_b_id": "mem_5", "contradiction_type": "negation", "confidence": 0.92 } ]}curl example:
curl -X POST http://localhost:61001/v1/workspaces/my-workspace/contradictions/scan \ -H "Content-Type: application/json" \ -d '{"batch_size": 100}'Entities
MemoryLayer keeps a registry of canonical entities (people, organizations, projects, places, concepts, events, and ontology domain types). Each entity has aliases, provenance, and a merge history. Entities accrete as memories are stored, and recall uses them to anchor on entities.
GET /v1/entities
List canonical entities in a workspace, in deterministic ID order.
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from context | Workspace override |
status | string | active | active or merged |
limit | integer | 100 | Maximum entities to return |
Response: 200 OK
{ "entities": [ { "id": "ent_abc123", "workspace_id": "my-workspace", "entity_type": "person", "canonical_name": "Ada Lovelace", "normalized_name": "ada lovelace", "aliases": ["Ada", "Countess of Lovelace"], "confidence": 1.0, "status": "active" } ], "total_count": 1}GET /v1/entities/resolve
Resolve a surface name or alias to an existing canonical entity. This endpoint never creates entities.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Surface name to resolve |
entity_type | string | no | person | person, org, project, place, concept, or event |
workspace_id | string | no | from context | Workspace override |
Response: 200 OK returns {"resolution": {"entity": {...}, "matched_via": "exact" | "alias" | "embedding", "score": 1.0}}.
curl "http://localhost:61001/v1/entities/resolve?name=Ada&entity_type=person"Other entity endpoints
| Endpoint | Purpose |
|---|---|
GET /v1/entities/{entity_id} | Get one canonical entity (workspace_id) |
GET /v1/entities/{entity_id}/provenance | Normalized lineage: how the entity originated, which memories first surfaced it, and its external-KB links |
GET /v1/entities/{entity_id}/related | Co-occurrence neighborhood, meaning entities mentioned together in shared memories. Query: limit (default 10), min_shared (default 1). |
POST /v1/entities/merge | Merge source_id into target_id (body also requires a reason, recorded in provenance). The source is tombstoned and the surviving target is returned. |
POST /v1/entities/dedupe | Batch dedup: cluster transitively similar entities and merge each cluster into its most-established representative. Query: threshold, limit (default 1000). Requires an embedding-capable registry. |
POST /v1/entities/seed | Create or update a curated catalog of canonical entities. Body: entities[], each with name, entity_type (default concept), aliases, description, external_ids (e.g. {"wikidata": "Q95"}), confidence. |
POST /v1/entities/backfill | Replay entity extraction and accretion over the workspace’s existing memories. Query: batch_size (default 200), max_memories, reset (wipe existing entities first for a clean rebuild). |
POST /v1/entities/enrich | Link canonical entities to an external KB (Wikidata) and fold the IDs into provenance. Query: types (default org,person,place), limit (default 500), overwrite. |
POST /v1/entities/{entity_id}/derive
Trigger inference derivation for an entity. Analyzes all memories about the entity and derives higher-order insights (patterns, preferences, tendencies) stored as INFERENCE-subtype memories.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
entity_id | string | Entity identifier (agent ID, user ID, etc.) |
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
workspace_id | string | no | from session | Workspace override |
observer_id | string | no | null | Optional observer perspective filter |
force | boolean | no | false | Force re-derivation even if recent insights exist |
Response: 200 OK
{ "subject_id": "user_123", "workspace_id": "my-workspace", "insights_created": 3, "insights_updated": 1, "source_memory_count": 25, "insights": []}curl example:
curl -X POST http://localhost:61001/v1/entities/user_123/derive \ -H "Content-Type: application/json" \ -d '{"force": true}'GET /v1/entities/{entity_id}/card
Get a cached entity profile card — a synthesized view combining reflection and derived insights. Results are cached and lazily recalculated.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
entity_id | string | Entity identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace override |
force_refresh | boolean | false | Trigger immediate recalculation |
Response: 200 OK
{ "entity_id": "user_123", "workspace_id": "my-workspace", "reflection": "This user is a senior Python developer who...", "insights": [], "source_memories": ["mem_1", "mem_2", "mem_3"], "confidence": 0.85, "cached": true, "generated_at": "2026-01-15T10:30:00Z"}curl example:
# Get cached cardcurl "http://localhost:61001/v1/entities/user_123/card?workspace_id=my-workspace"
# Force refreshcurl "http://localhost:61001/v1/entities/user_123/card?force_refresh=true"GET /v1/entities/{entity_id}/insights
Get derived insights for an entity. Returns existing INFERENCE-subtype memories without triggering new derivation.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
entity_id | string | Entity identifier |
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace override |
observer_id | string | null | Filter by observer perspective |
limit | integer | 20 | Maximum insights to return |
Response: 200 OK
{ "entity_id": "user_123", "workspace_id": "my-workspace", "insights": [], "total_count": 0}curl example:
curl "http://localhost:61001/v1/entities/user_123/insights?workspace_id=my-workspace&limit=10"Chat Threads
POST /v1/threads
Create a new chat thread for conversation history storage.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
workspace_id | string | no | from session | Workspace override |
user_id | string | no | null | User scope for this thread |
context_id | string | no | _default | Context within workspace |
observer_id | string | no | null | Observer entity ID (typically the AI agent) |
subject_id | string | no | null | Subject entity ID (typically the human user) |
title | string | no | null | Optional display title |
metadata | object | no | {} | Arbitrary metadata |
expires_at | datetime | no | null | Optional expiration (null = permanent) |
idle_action | string | no | null | Idle policy: null (never idles out), hide, or delete |
scope | string | no | null | Surface scope: web or office (null is treated as web) |
ownership | string | no | user | user (private to the owning user, listable across workspaces) or workspace (shared in the workspace) |
parent_thread | string | no | null | Parent thread ID. Creates a sub-thread that inherits the parent’s workspace and ownership. |
Response: 201 Created
{ "thread": { "id": "thread_abc123", "workspace_id": "my-workspace", "title": "Debugging session", "ownership": "user", "parent_thread": null, "message_count": 0, "created_at": "2026-01-15T10:30:00Z" }}curl example:
curl -X POST http://localhost:61001/v1/threads \ -H "Content-Type: application/json" \ -d '{ "workspace_id": "my-workspace", "title": "Debugging session", "observer_id": "agent_1", "subject_id": "user_123" }'GET /v1/threads
List chat threads, optionally filtered by workspace, user, scope, and ownership.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
user_id | string | null | User filter |
limit | integer | 50 | Max threads to return (1-200) |
offset | integer | 0 | Pagination offset |
scope_filter | string | null | web or office (null returns all) |
ownership_filter | string | null | user or workspace (null returns all) |
include_hidden | boolean | false | Include archived/hidden threads |
parent_thread | string | null | List this thread’s sub-threads. If omitted, only top-level threads are listed. |
Response: 200 OK
{ "threads": [ { "id": "thread_abc123", "title": "Debugging session", "message_count": 12 } ], "total_count": 1}curl example:
curl "http://localhost:61001/v1/threads?workspace_id=my-workspace&limit=20"GET /v1/threads/user/{user_id}
List threads owned by a user across all workspaces. It accepts the same scope_filter, limit, offset, include_hidden, and parent_thread parameters as GET /v1/threads, plus ownership (default user). User-owned threads are isolated per on-behalf-of user.
curl "http://localhost:61001/v1/threads/user/user_123?limit=20"GET /v1/threads/{thread_id}
Get thread metadata by ID.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
Response: 200 OK — returns the thread object.
curl example:
curl "http://localhost:61001/v1/threads/thread_abc123?workspace_id=my-workspace"PUT /v1/threads/{thread_id}
Update a thread (e.g., rename).
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | no | Updated display title |
metadata | object | no | Updated metadata |
idle_action | string | no | Idle policy: null, hide, or delete |
Response: 200 OK — returns the updated thread.
curl example:
curl -X PUT "http://localhost:61001/v1/threads/thread_abc123?workspace_id=my-workspace" \ -H "Content-Type: application/json" \ -d '{"title": "Auth debugging session"}'GET /v1/threads/{thread_id}/full
Get thread with all messages inlined (paginated).
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
limit | integer | 100 | Max messages to return (1-1000) |
offset | integer | 0 | Message pagination offset |
order | string | asc | Message order: asc or desc |
Response: 200 OK
{ "thread": { "id": "thread_abc123", "title": "Debugging session" }, "messages": [ { "id": "msg_1", "thread_id": "thread_abc123", "message_index": 0, "role": "user", "content": "Help me debug this auth issue" } ], "total_messages": 12}curl example:
curl "http://localhost:61001/v1/threads/thread_abc123/full?limit=50&order=asc"DELETE /v1/threads/{thread_id}
Delete a thread and all its messages.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
Response: 204 No Content
curl example:
curl -X DELETE "http://localhost:61001/v1/threads/thread_abc123?workspace_id=my-workspace"POST /v1/threads/{thread_id}/archive
Archive (hide) a thread without deleting it. Hidden threads are left out of default listings. They come back when restored or when a new message is appended.
POST /v1/threads/{thread_id}/restore
Restore (un-archive) a hidden thread.
Both endpoints accept an optional workspace_id query parameter and return the updated thread.
POST /v1/threads/{thread_id}/messages
Append messages to a chat thread.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
messages | object[] | yes | Messages to append (minimum 1) |
Each message object:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | no | generated | Optional client-supplied message ID |
role | string | yes | — | Message role: user, assistant, system, tool |
content | any | yes | — | Message content (string or structured content blocks) |
metadata | object | no | {} | Arbitrary metadata |
Response: 201 Created
{ "messages": [ { "id": "msg_new1", "thread_id": "thread_abc123", "message_index": 12, "role": "user", "content": "What caused the auth failure?" } ], "thread_id": "thread_abc123", "new_message_count": 13}curl example:
curl -X POST "http://localhost:61001/v1/threads/thread_abc123/messages?workspace_id=my-workspace" \ -H "Content-Type: application/json" \ -d '{ "messages": [ {"role": "user", "content": "What caused the auth failure?"}, {"role": "assistant", "content": "The token was expired."} ] }'GET /v1/threads/{thread_id}/messages
Get messages from a chat thread with pagination.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
limit | integer | 100 | Max messages to return (1-1000) |
offset | integer | 0 | Pagination offset |
after_index | integer | null | Get messages after this index |
order | string | asc | Message order: asc or desc |
Response: 200 OK
{ "messages": [], "thread_id": "thread_abc123", "total_count": 12}curl example:
# Get latest messagescurl "http://localhost:61001/v1/threads/thread_abc123/messages?order=desc&limit=10"
# Get messages after index 5curl "http://localhost:61001/v1/threads/thread_abc123/messages?after_index=5"DELETE /v1/threads/{thread_id}/messages/{message_id}
Delete a single message from a thread without deleting the thread itself.
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
thread_id | string | Thread to delete from |
message_id | string | Message to delete |
Response: 204 No Content
POST /v1/threads/{thread_id}/decompose
Trigger on-demand memory decomposition for unprocessed messages in a thread. Extracts memories from conversation content.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
workspace_id | string | from auth context | Workspace filter |
Response: 200 OK
{ "thread_id": "thread_abc123", "workspace_id": "my-workspace", "messages_processed": 8, "memories_created": 5, "from_index": 4, "to_index": 12}curl example:
curl -X POST "http://localhost:61001/v1/threads/thread_abc123/decompose?workspace_id=my-workspace"Representation
Perspective-anchored views of what one party knows about another. The observer and subject are resolved through the entity registry and are never created. Assembly is deterministic and scoped, so observations visible only to other observers do not leak into the result.
POST /v1/representation
Assemble what observer understands about subject.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
observer | string | yes | — | Observing entity (surface name) |
subject | string | yes | — | Entity the representation is about (surface name) |
workspace_id | string | no | from session | Workspace override |
observer_type | string | no | null | Entity type hint for resolving the observer |
subject_type | string | no | null | Entity type hint for resolving the subject |
limit | integer | no | 20 | Max observations to return (1-200) |
include_profile | boolean | no | true | Attach a deterministic profile assembled from the scoped observations |
Response: 200 OK
{ "observer": {"id": "ent_agent", "canonical_name": "support-agent", "entity_type": "concept"}, "subject": {"id": "ent_ada", "canonical_name": "Ada Lovelace", "entity_type": "person"}, "is_self": false, "observations": [ {"memory_id": "mem_1", "content": "Ada prefers concise answers", "role": "subject_tagged", "relevance": 0.91} ], "profile": {"summary": "...", "source_memory_ids": ["mem_1"], "derived": false}, "derived_beliefs": [], "provenance": {}}curl -X POST http://localhost:61001/v1/representation \ -H "Content-Type: application/json" \ -d '{"observer": "support-agent", "subject": "Ada Lovelace", "subject_type": "person"}'POST /v1/representation/user
Assemble a user’s user-scope self-representation: preferences and facts stored with scope: "user" that follow the user across workspaces. The assembly reads only the user-global store and is safe across users.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
user_id | string | no | authenticated user | User to assemble the representation for |
workspace_id | string | no | from session | Request-context workspace |
limit | integer | no | 20 | Max observations to return |
include_profile | boolean | no | true | Attach a deterministic profile |
Response: 200 OK with user_id, observations, profile, derived_beliefs, provenance.
Ingest
POST /v1/ingest/email
Turn an email into a memory. It goes through the same pipeline as chat and documents: decomposition, enrichment, and entity accretion. The sender becomes the observer_id perspective anchor, the timestamp becomes the memory’s event_time, and recipients become sent_to relations.
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sender | string | yes | — | Email sender |
body | string | yes | — | Email body text |
to | string[] | no | [] | Recipients (stored in metadata and mapped to sent_to relations) |
subject | string | no | null | Subject line |
timestamp | datetime | no | null | When the email was sent (becomes event_time) |
thread_id | string | no | null | Conversation/thread ID (preferred source-thread linkage) |
message_id | string | no | null | Message ID (fallback source-thread linkage; stamped in metadata) |
importance | float | no | 0.5 | Memory importance (0.0-1.0) |
workspace_id | string | no | from session | Workspace override |
context_id | string | no | from session | Target memory context |
metadata | object | no | {} | Additional source metadata |
relations | object[] | no | [] | Additional typed relations evidenced by the email |
Response: 201 Created with {"memory": {...}}
curl -X POST http://localhost:61001/v1/ingest/email \ -H "Content-Type: application/json" \ -d '{ "sender": "ada@example.com", "to": ["charles@example.com"], "subject": "Engine notes", "body": "Attached are my notes on the analytical engine.", "timestamp": "2026-01-15T10:30:00Z" }'Context Environment
All context endpoints require an X-Session-ID header to identify the session sandbox. The context environment provides a server-side Python sandbox for programmatic memory analysis.
POST /v1/context/execute
Execute Python code in the session sandbox. State persists across calls within the same session.
Headers: X-Session-ID (required)
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
code | string | yes | — | Python code to execute |
result_var | string | no | null | Store expression result in this variable |
return_result | boolean | no | true | Include result value in response |
max_return_chars | integer | no | 10000 | Maximum chars for result serialization (100-100000) |
Response: 200 OK
{ "output": "", "result": "4.2", "error": null, "variables_changed": ["result", "total_importance"]}curl example:
curl -X POST http://localhost:61001/v1/context/execute \ -H "Content-Type: application/json" \ -H "X-Session-ID: sess_abc123" \ -d '{ "code": "result = sum(x[\"importance\"] for x in memories)", "result_var": "total_importance", "return_result": true }'POST /v1/context/inspect
Inspect sandbox variables. Omit variable for an overview of all variables.
Headers: X-Session-ID (required)
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
variable | string | null | Specific variable to inspect (omit for overview) |
preview_chars | integer | 200 | Characters to include in value previews |
Response (specific variable): 200 OK
{ "variable": "memories", "type": "list", "preview": "[{'id': 'mem_abc', 'content': 'User prefers...'}]", "size_bytes": 4096}Response (all variables): 200 OK
{ "variable_count": 3, "variables": {"memories": "list (50 items)", "summary": "str", "total": "float"}, "total_size_bytes": 8192}curl example:
# Overview of all variablescurl -X POST http://localhost:61001/v1/context/inspect \ -H "X-Session-ID: sess_abc123"
# Inspect specific variablecurl -X POST "http://localhost:61001/v1/context/inspect?variable=memories&preview_chars=500" \ -H "X-Session-ID: sess_abc123"POST /v1/context/load
Load memories into the sandbox via semantic search.
Headers: X-Session-ID (required)
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
var | string | yes | — | Variable name to store results in |
query | string | yes | — | Memory recall query |
limit | integer | no | 50 | Maximum memories to recall (1-500) |
types | string[] | no | null | Filter by memory types |
tags | string[] | no | null | Filter by tags |
min_relevance | float | no | null | Minimum relevance score (0.0-1.0) |
include_embeddings | boolean | no | false | Include embedding vectors |
Response: 200 OK
{ "count": 12, "variable": "auth_memories", "query": "authentication patterns", "total_available": 25}curl example:
curl -X POST http://localhost:61001/v1/context/load \ -H "Content-Type: application/json" \ -H "X-Session-ID: sess_abc123" \ -d '{ "var": "auth_memories", "query": "authentication patterns", "limit": 50, "types": ["semantic", "procedural"] }'POST /v1/context/inject
Inject a value directly into the sandbox.
Headers: X-Session-ID (required)
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
key | string | yes | — | Variable name |
value | any | yes | — | Value to inject (JSON-serializable) |
parse_json | boolean | no | false | Parse value string as JSON |
Response: 200 OK
{ "variable": "config", "type": "dict", "preview": "{'threshold': 0.7, 'max_items': 100}"}curl example:
curl -X POST http://localhost:61001/v1/context/inject \ -H "Content-Type: application/json" \ -H "X-Session-ID: sess_abc123" \ -d '{ "key": "config", "value": "{\"threshold\": 0.7, \"max_items\": 100}", "parse_json": true }'POST /v1/context/query
Query the server-side LLM with sandbox variables as context.
Headers: X-Session-ID (required)
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | yes | — | Prompt for the LLM |
variables | string[] | no | [] | Variable names to include as context |
max_context_chars | integer | no | null | Maximum chars for variable context (100-500000) |
result_var | string | no | null | Store LLM response in this variable |
Response: 200 OK
{ "response": "Based on the error memories, there are three common patterns...", "variables_used": ["error_memories"], "result_var": "analysis"}curl example:
curl -X POST http://localhost:61001/v1/context/query \ -H "Content-Type: application/json" \ -H "X-Session-ID: sess_abc123" \ -d '{ "prompt": "What are the common error patterns in this data?", "variables": ["error_memories"], "result_var": "analysis" }'POST /v1/context/rlm
Run a Recursive Language Model reasoning loop. The server iteratively generates code, executes it, evaluates results, and continues until the goal is achieved or max iterations are reached.
Headers: X-Session-ID (required)
Request Body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
goal | string | yes | — | Natural language description of the goal |
memory_query | string | no | null | Optional memory query to load initial data |
memory_limit | integer | no | 100 | Maximum memories to load (1-500) |
max_iterations | integer | no | 10 | Maximum reasoning iterations (1-50) |
variables | string[] | no | null | Variable names to include in context |
result_var | string | no | null | Store final result in this variable |
detail_level | string | no | standard | Detail level: minimal, standard, verbose |
Response: 200 OK
{ "result": "Analysis found 3 recurring error patterns...", "iterations": 4, "goal_achieved": true, "trace": [ { "iteration": 1, "generated_code": "...", "exec_output": "...", "variables_changed": ["grouped_errors"], "evaluation": "CONTINUE", "action": "continue" } ]}curl example:
curl -X POST http://localhost:61001/v1/context/rlm \ -H "Content-Type: application/json" \ -H "X-Session-ID: sess_abc123" \ -d '{ "goal": "Identify the most common error patterns and their resolutions", "memory_query": "errors and fixes", "memory_limit": 100, "max_iterations": 10, "result_var": "findings" }'GET /v1/context/status
Get sandbox status for the current session.
Headers: X-Session-ID (required)
Response: 200 OK
{ "exists": true, "variable_count": 5, "variables": ["memories", "summary", "config"], "total_size_bytes": 16384, "memory_limit_bytes": 268435456, "metadata": { "created_at": "2026-01-15T10:30:00Z", "exec_count": 12, "total_operations": 20, "last_exec_at": "2026-01-15T10:45:00Z" }}curl example:
curl http://localhost:61001/v1/context/status \ -H "X-Session-ID: sess_abc123"POST /v1/context/checkpoint
Checkpoint sandbox state for persistence. This fires any registered persistence hooks; with no hooks configured it does nothing.
Headers: X-Session-ID (required)
Response: 204 No Content
curl example:
curl -X POST http://localhost:61001/v1/context/checkpoint \ -H "X-Session-ID: sess_abc123"DELETE /v1/context/cleanup
Remove session sandbox and free resources.
Headers: X-Session-ID (required)
Response: 204 No Content
curl example:
curl -X DELETE http://localhost:61001/v1/context/cleanup \ -H "X-Session-ID: sess_abc123"Skills
Skills are named bundles (a SKILL.md manifest plus arbitrary files) that LLM agents can list, fetch, and execute against. Resolution follows the scope precedence (user > workspace > tenant > global) described in Skills & MCP Server Registry. Routes are mounted under /v1/skills, and most accept an optional workspace_id query parameter.
| Endpoint | Purpose |
|---|---|
POST /v1/skills | Create a skill. Body: name, description (required), version (default 0.1.0), license, compatibility, allowed_tools, body (the SKILL.md markdown), metadata, source_mode (server / mirrored / filesystem), user_id, and inline bundle files. |
GET /v1/skills | List skills visible to the caller. Query: name, enabled, include_shadowed (keep precedence losers), include_addenda, include_global (default true, unions tenant-shared _global skills), limit, offset. |
POST /v1/skills/resolve | Resolve by exact name (precedence winner) or by intent query (vector recall). Optional scope_hint (user, workspace, or global) and include_addenda. |
GET /v1/skills/{skill_id} | Get one skill (include_deleted) |
PUT /v1/skills/{skill_id} | Update manifest fields (description, version, body, metadata, hashes, enabled, etc.) |
DELETE /v1/skills/{skill_id} | Legacy unconditional delete, implemented as a durable tombstone |
GET /v1/skills/{skill_id}/manifest | Render the full SKILL.md text (include_addenda) |
PUT /v1/skills/{skill_id}/manifest | Conditionally replace the complete manifest (needs Idempotency-Key + If-Match) |
POST /v1/skills/{skill_id}/delete | Conditionally tombstone the manifest |
POST /v1/skills/{skill_id}/restore | Conditionally restore a tombstoned skill |
GET /v1/skills/{skill_id}/revisions | List immutable manifest revisions, newest first (limit, page_token) |
GET /v1/skills/{skill_id}/files | List all files in the bundle |
GET /v1/skills/{skill_id}/files/{file_path} | Fetch a single file by path |
PUT /v1/skills/{skill_id}/files/{file_path} | Upsert one file. Body: content_b64, mime_type. |
DELETE /v1/skills/{skill_id}/files/{file_path} | Delete one file from the bundle |
GET /v1/skills/{skill_id}/bundle | Stream the full bundle as NDJSON (default) or ?format=tar.gz |
POST /v1/skills/{skill_id}/sync | Reconcile a mirrored skill by comparing client manifest_hash / bundle_hash with server state (used by memorylayer skills sync / watch) |
MCP Server Registry
Workspace-scoped registry of MCP server entries, in the same shape as .mcp.json and Claude Code’s ~/.claude.json. Resolution follows the same scope precedence as skills. Routes are mounted under /v1/mcp-servers. Secret values (env, headers) are masked unless reveal_secrets=true is passed and the caller is authorized.
| Endpoint | Purpose |
|---|---|
POST /v1/mcp-servers | Create an entry. Body: name (1-64 chars, [a-z0-9-]), transport (stdio, http, sse, streamable-http), command/args/env (stdio), url/headers (HTTP transports), description, metadata, source_mode, enabled, workspace_id, user_id. |
GET /v1/mcp-servers | List entries. Query: name, transport, enabled, include_shadowed, reveal_secrets, limit, offset. |
POST /v1/mcp-servers/resolve | Resolve by exact name (precedence winner) or by intent query (vector recall), optionally filtered by transport |
POST /v1/mcp-servers/import | Import a .mcp.json document (mcpServers map). Each entry becomes one record. |
GET /v1/mcp-servers/export | Export visible servers as a .mcp.json-shaped object (reveal_secrets) |
GET /v1/mcp-servers/{server_id} | Get one entry |
PUT /v1/mcp-servers/{server_id} | Update an entry |
DELETE /v1/mcp-servers/{server_id} | Delete an entry |
POST /v1/mcp-servers/{server_id}/sync | Reconcile a mirrored entry by comparing the client’s manifest_hash with the stored one |
The MCP server exposes mcp_servers_list/get/save/delete/import in the full profile.
Documents
Document ingestion: upload, parse, derive memories, and page-level retrieval. All endpoints live under /v1/documents. See Document Ingestion.
| Endpoint | Purpose |
|---|---|
POST /v1/documents | Upload a document via multipart/form-data for background ingestion. Form fields: file (required), document_type, target_context_id, chunk_size, importance, retain_original. Returns 202 Accepted. |
GET /v1/documents | List documents. Query: status, document_type, workspace_id, limit, offset. |
GET /v1/documents/jobs | List ingestion jobs (status, limit, offset) |
GET /v1/documents/jobs/{job_id} | Get a single ingestion job with progress and error info |
POST /v1/documents/jobs/{job_id}/cancel | Cancel a queued or running ingestion job |
POST /v1/documents/search | ColPali MaxSim page search (see Document Ingestion -> Search Document Pages) |
GET /v1/documents/{document_id} | Get a document with status, page count, and derived memory IDs |
GET /v1/documents/{document_id}/memories | Get the memories extracted from a document |
GET /v1/documents/{document_id}/pages | List pages |
GET /v1/documents/{document_id}/pages/{page_id} | Get a single page |
POST /v1/documents/{document_id}/reprocess | Re-queue extraction with optional new extraction_options. Returns 202. |
POST /v1/documents/{document_id}/verify | Re-verify (heal) a single document by enqueuing an on-demand verification that bypasses the reconcile attempt cap. Returns 202. |
DELETE /v1/documents/{document_id} | Delete a document; ?delete_memories=true also deletes its extracted memories |
Page search request body (POST /v1/documents/search):
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
query | string | yes | — | Natural-language search query |
limit | integer | no | 10 | Max results (1-100) |
doc_ids | string[] | no | — | Restrict search to specific document IDs |
Returns PageSearchResponse with pages (each carrying a relevance_score), total_count, and the original query. Page search needs an embed-server peer that produces multi-vector (ColPali) embeddings. It returns 501 if the active storage backend does not support MaxSim page search.
Data Providers
Registry and metadata for external ingestion sources. The core server ships only the local provider type: a _default local provider is auto-created per workspace, and POST /v1/data-providers/{provider_id}/sync is a no-op that returns an empty list. MemoryLayer Enterprise adds real connectors (see Data Connectors). See also Data Providers. Routes live under /v1/data-providers.
| Endpoint | Purpose |
|---|---|
POST /v1/data-providers | Create a provider. Body: name (required), provider_type (default local), description, enabled, connection_args, schedule, metadata, workspace_id. |
GET /v1/data-providers | List providers in the workspace (workspace_id, limit, offset) |
GET /v1/data-providers/{provider_id} | Get one provider |
PUT /v1/data-providers/{provider_id} | Partial update: only the fields you send are changed |
DELETE /v1/data-providers/{provider_id} | Delete the provider. Previously ingested documents are not affected. |
POST /v1/data-providers/{provider_id}/sync | Trigger a one-off sync |
Knowledgebase
Knowledgebase generation, article browsing, and export. Articles are LLM-synthesized, Obsidian-compatible Markdown pages: an index article, community articles for clusters of related memories, and entity articles for highly connected (“god”) nodes. Endpoints are under /v1/knowledgebase and act on the current workspace.
| Endpoint | Purpose |
|---|---|
POST /v1/knowledgebase/generate | Generate the knowledgebase. Body: workspace_id, context_id, include_rpg (include Repository Planning Graph nodes), max_communities (default 50), max_god_nodes (default 20), regenerate, background (run as a background kb_update task and return immediately). |
GET /v1/knowledgebase | Knowledgebase metadata, including corpus-coverage statistics |
GET /v1/knowledgebase/articles | List articles (article_type: index, community, entity; limit, offset) |
GET /v1/knowledgebase/articles/{article_id} | Get one article |
GET /v1/knowledgebase/export | Download the knowledgebase as an Obsidian-compatible vault (application/zip) |
GET /v1/knowledgebase/graph | Graph analysis behind the knowledgebase (include_central_nodes, default true) |
GET /v1/knowledgebase/graph/communities/{community_id} | Details of one community |
Knowledgebase viewer
The server also serves a self-contained HTML viewer (not JSON):
| Endpoint | Purpose |
|---|---|
GET /kb | List accessible workspaces with links to their knowledgebases |
GET /kb/{workspace_id} | HTML viewer for a workspace’s knowledgebase; ?article= opens a specific article |
Graph Analysis
Workspace-wide graph analysis primitives. Endpoints are under /v1/graph, and each accepts workspace_id and context_id filters.
| Endpoint | Purpose |
|---|---|
GET /v1/graph/snapshot | Graph snapshot metadata for the workspace (include_rpg to include RPG code-graph nodes) |
GET /v1/graph/communities | Detected communities (clusters) in the association graph |
GET /v1/graph/centrality | Per-node centrality scores (degree and betweenness) |
GET /v1/graph/bridges | Edges that bridge different communities |
GET /v1/graph/stats | Aggregate graph statistics |
POST /v1/graph/analyze | Full analysis (snapshot, communities, centrality, bridges, and stats) in one call. Body: workspace_id, context_id, include_rpg. |
POST /v1/graph/densify-preview | Experimental tool for tuning knowledgebase graph densification. It previews the edges that cosine, MaxSim, and shared-entity densification would add under the thresholds, k, and weights you pass. |
Repository Planning Graph
The /v1/rpg routes come from the memorylayer-server-rpg plugin. The plugin is included in the server container image and published on PyPI (pip install memorylayer-server-rpg). When it is installed, the server discovers it through an entry point and enables these routes automatically. Without it, /v1/rpg returns 404. See Repository Planning Graph.
| Endpoint | Purpose |
|---|---|
POST /v1/rpg/sync | Upsert an RPG snapshot. Body: nodes, edges, full_sync (delete nodes/edges absent from the payload), source_commit, context_id (default rpg), task_id. |
GET /v1/rpg/status | Encoding status for the current workspace (context_id) |
GET /v1/rpg/nodes | List nodes (node_type, context_id default rpg, limit default 5000) |
DELETE /v1/rpg/nodes | Delete nodes by RPG node ID. Body: node_ids, context_id. |
DELETE /v1/rpg/edges | Bulk-delete edges. Body: association_ids. |
GET /v1/rpg/search | Search nodes by name, description, or path (query, node_types, limit, context_id) |
GET /v1/rpg/subgraph | Subgraph rooted at a path or node_id (depth default 3, node_types, relationship_types, context_id, max_nodes default 2000) |
GET /v1/rpg/merged-subgraph | Canonical base graph merged with an overlay context (base_context, overlay_context, path, depth) |
GET /v1/rpg/overlays | List active overlay contexts (rpg-task-*, rpg-intent-*) |
DELETE /v1/rpg/overlays/{context_id} | Delete all nodes in an overlay context |
GET /v1/rpg/conflicts | File-level conflicts between a task’s intent and other active intents (task_id) |
GET /v1/rpg/conflicts/symbols | Symbol-level conflicts between two task overlays (task_id_a, task_id_b) |
POST /v1/rpg/enrich | Trigger LLM enrichment. Body: context_id, phases (default: features, descriptions, data_flows), async (default true). |
POST /v1/rpg/maintenance/{operation} | Run a maintenance operation: validate, cleanup, cleanup_intents, or recompute_counts |
Agent Specifications, Prompt Notes, and Refinement Records
Versioned, workspace-scoped resources that agent hosts use to store reusable agent definitions, prompt snippets, and an audit trail of refinements. Creates need Idempotency-Key plus If-None-Match: *. Replace, delete, and restore need Idempotency-Key plus If-Match: <etag>. Every endpoint accepts workspace_id.
Agent specifications (/v1/agent-specifications):
| Endpoint | Purpose |
|---|---|
POST /v1/agent-specifications | Create a spec. Body: key, name, description, instructions (required), plus invocation_guidance, model, max_turns, allowed_tools, denied_tools, skills, mcp_servers, permission_mode (inherit, ask, allow, read_only), exec_policy_hint, background, enabled, metadata. |
GET /v1/agent-specifications | List specs (limit, page_token, include_deleted) |
GET /v1/agent-specifications/{specification_id} | Get one spec |
PUT /v1/agent-specifications/{specification_id} | Replace a spec |
DELETE /v1/agent-specifications/{specification_id} | Tombstone a spec |
POST /v1/agent-specifications/{specification_id}/restore | Restore a tombstoned spec |
GET /v1/agent-specifications/{specification_id}/revisions | List revisions |
Prompt notes (/v1/prompt-notes):
| Endpoint | Purpose |
|---|---|
POST /v1/prompt-notes | Create a note. Body: key, title, content (required), enabled, metadata. |
GET /v1/prompt-notes | List notes (limit, page_token, include_deleted) |
GET /v1/prompt-notes/{note_id} | Get one note |
PUT /v1/prompt-notes/{note_id} | Replace a note |
DELETE /v1/prompt-notes/{note_id} | Tombstone a note |
POST /v1/prompt-notes/{note_id}/restore | Restore a tombstoned note |
GET /v1/prompt-notes/{note_id}/revisions | List revisions |
Refinement records (/v1/refinement-records). These are append-only records of proposed, approved, applied, or rolled-back refinements:
| Endpoint | Purpose |
|---|---|
POST /v1/refinement-records | Create a record. Body: key, refinement_id, phase (proposal, decision, application, rollback), trigger, scope (session, workspace, user, tenant, global), summary, rationale, expected_outcome, evidence, outcome (proposed, approved, rejected, applied, partially_applied, failed, rolled_back, no_op), plus optional edits, parent_record_id, rollback_of_record_id, task_ref, approval_ref, metadata. |
GET /v1/refinement-records | List records. Filters: phase, outcome, scope, resource_kind, refinement_id, search; paging with limit and page_token. |
GET /v1/refinement-records/{record_id} | Get one record |
Audit
Audit event queries under /v1/audit. The core server’s default audit service (MEMORYLAYER_AUDIT_SERVICE=noop) records nothing, so these endpoints return empty results unless an audit service that stores events is configured. MemoryLayer Enterprise provides one.
| Endpoint | Purpose |
|---|---|
GET /v1/audit/events | Query audit events for the current tenant. Query: workspace_id, event_type, since (ISO datetime), limit (default 100). |
GET /v1/audit/events/summary | Event counts grouped by event type (workspace_id, since) |
Tokens
API token issuance and revocation under /v1/tokens. The routes are always mounted, but they proxy to the Aether token service over gRPC and do not mint tokens locally. They return 503 Service Unavailable when no Aether connection is configured. See Server -> Aether Transport and Administration -> API Keys.
| Endpoint | Purpose |
|---|---|
GET /v1/tokens | List tokens (include_revoked, default false) |
POST /v1/tokens | Create a token. Body: name (required), principal_type (default User), workspace_patterns (default ["*"]), scopes (default ["*"]), expires_in_days. The secret is returned once, at creation. |
GET /v1/tokens/{token_id} | Get token metadata (never returns the secret) |
DELETE /v1/tokens/{token_id} | Delete a token |
POST /v1/tokens/{token_id}/revoke | Revoke a token without deleting it (keeps the audit trail) |
Health
GET /health
Basic liveness check.
Response: 200 OK
curl example:
curl http://localhost:61001/healthGET /health/ready
Readiness check that verifies database and cache connectivity.
Response: 200 OK
curl example:
curl http://localhost:61001/health/ready