Skip to content

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:

URLContent
GET /openapi.jsonMachine-readable OpenAPI schema for the exact build you are running
GET /docsInteractive Swagger UI
GET /redocReDoc 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-key

Context headers:

HeaderPurpose
X-Session-IDSession whose workspace and context are used when the request does not name a workspace. Required by the Context Environment endpoints.
X-Workspace-IDWorkspace 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.

Terminal window
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:

FieldTypeRequiredDefaultDescription
contentstringyes—Memory content to store
workspace_idstringnofrom session or _defaultWorkspace override
typestringnoauto-classifiedCognitive type: episodic, semantic, procedural, working
subtypestringnonullDomain-specific classification
importancefloatno0.5Memory importance (0.0-1.0)
tagsstring[]no[]Tags for categorization
metadataobjectno{}Arbitrary metadata
logical_keystringnonullStable workspace/owner-scoped key for conditional refinement. Requires the Idempotency-Key and If-None-Match: * headers.
refinement_metadataobjectno{}Semantic metadata protected by the memory resource ETag
pinnedbooleannofalsePin the memory against retention decay
associationsstring[]no[]Memory IDs to associate with
relationsobject[]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_idstringnofrom sessionTarget memory context
observer_idstringnonullEntity doing the observing (agent ID, user ID)
subject_idstringnonullEntity this memory is about
user_idstringnofrom authUser scope for this memory
scopestringnoworkspaceworkspace (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:

Terminal window
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:

ParameterTypeDefaultDescription
limitinteger50Maximum memories to return
offsetinteger0Number of memories to skip
typestringnullFilter by cognitive type
subtypestringnullFilter by domain subtype
tagstringnullFilter by a single tag
context_idstringnullFilter by memory context
include_embeddingsbooleanfalseInclude each memory’s raw embedding vector. Vectors are omitted by default because they dominate the payload.

Response: 200 OK with {"memories": [...], "total_count": N}

Terminal window
curl "http://localhost:61001/v1/memories?limit=20&type=semantic"

GET /v1/memories/{memory_id}

Retrieve a single memory by ID.

Path Parameters:

ParameterTypeDescription
memory_idstringMemory identifier

Query Parameters:

ParameterTypeDefaultDescription
include_deletedbooleanfalseReturn the memory even if it has been soft-deleted
workspace_idstringfrom contextWorkspace 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:

Terminal window
curl http://localhost:61001/v1/memories/mem_abc123

PUT /v1/memories/{memory_id}

Update an existing memory. Only provided fields are updated.

Path Parameters:

ParameterTypeDescription
memory_idstringMemory identifier

Request Body:

FieldTypeRequiredDescription
contentstringnoUpdated content
typestringnoUpdated cognitive type
subtypestringnoUpdated domain classification
importancefloatnoUpdated importance (0.0-1.0)
tagsstring[]noUpdated tags
metadataobjectnoUpdated metadata
refinement_metadataobjectnoUpdated semantic refinement metadata
pinnedbooleannoPin/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:

Terminal window
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:

ParameterTypeDescription
memory_idstringMemory identifier

Query Parameters:

ParameterTypeDefaultDescription
hardbooleanfalsePermanently delete instead of archiving

Response: 204 No Content

curl example:

Terminal window
# 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:

FieldTypeRequiredDefaultDescription
querystringyes—Natural language query
workspace_idstringnofrom sessionWorkspace override
typesstring[]no[]Filter by cognitive types
subtypesstring[]no[]Filter by domain subtypes
tagsstring[]no[]Filter by tags (AND logic)
context_idstringnofrom sessionFilter by memory context
observer_idstringnonullFilter by observer entity
subject_idstringnonullFilter by subject entity
user_idstringnofrom authFilter by user
include_globalbooleannotrueAlso search the _global workspace
include_global_userbooleannotrueAlso search the user-scoped global workspace (_global_user), filtered by the same user_id
modestringnoragRetrieval strategy (see below)
tolerancestringnomoderateSearch precision: loose, moderate, strict
limitintegerno10Maximum memories to return (1-100)
offsetintegerno0Results to skip, for pagination
include_embeddingsbooleannofalseInclude each memory’s raw embedding vector
min_relevancefloatnoserver defaultMinimum relevance score (0.0-1.0)
recency_weightfloatnoserver defaultWeight for recency boosting (0.0-1.0)
include_associationsbooleannoserver defaultInclude linked memories
traverse_depthintegernoserver defaultMulti-hop graph traversal depth (0-5)
max_expansionintegernoserver defaultMax memories via graph expansion (1-500)
created_afterdatetimenonullFilter memories created after this time
created_beforedatetimenonullFilter memories created before this time
event_afterdatetimenonullKeep memories whose effective event time is on or after this
event_beforedatetimenonullKeep memories whose effective event time is on or before this
time_orderstringnonullOrder by effective event time, asc or desc (null = by relevance)
contextobject[]no[]Recent conversation context
rag_thresholdfloatno0.8In hybrid mode, fall back to LLM retrieval when the top RAG score is below this
detail_levelstringnofullabstract, overview, or full
include_archivedbooleannofalseInclude archived memories
exclude_idsstring[]no[]Memory IDs to exclude from results
budget_tokensintegernonullHard estimated-token budget for returned content
include_confidencebooleannotrueInclude deterministic retrieval confidence (retrieval_confidence, confidence_reasons)
include_relationsbooleannotrueAllow bounded typed-relation retrieval when it is enabled on the server

Retrieval Modes:

ModeDescription
ragDefault. Vector similarity plus the enabled retrieval channels, no LLM calls.
llmQuery rewriting with an LLM, then tiered search. Requires a configured LLM provider and a generation policy that allows query rewriting.
hybridRuns rag first and falls back to llm when the top result scores below rag_threshold and query rewriting is available.
agenticAn 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:

Terminal window
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:

FieldTypeRequiredDefaultDescription
querystringyes—What to reflect on
workspace_idstringnofrom sessionWorkspace override
detail_levelstringnoserver defaultLevel of detail: abstract, overview, full
include_sourcesbooleannotrueInclude source memory references
depthintegerno2Association traversal depth (1-5)
typesstring[]no[]Filter by types
subtypesstring[]no[]Filter by subtypes
tagsstring[]no[]Filter by tags
context_idstringnofrom sessionFilter by memory context
observer_idstringnonullFilter by observer entity
subject_idstringnonullFilter 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:

Terminal window
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:

ParameterTypeDescription
memory_idstringMemory identifier

Request Body:

FieldTypeRequiredDefaultDescription
decay_ratefloatno0.1Decay rate to apply (0.0-1.0)

Response: 200 OK — returns the updated memory with decayed importance.

curl example:

Terminal window
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:

FieldTypeRequiredDescription
operationsobject[]yesList of typed batch operations

Each operation must include an op field set to "create", "update", or "delete".

Create operation fields:

FieldTypeRequiredDefaultDescription
opstringyes—Must be "create"
contentstringyes—Memory content
typestringnoauto-classifiedCognitive type
subtypestringnonullDomain classification
importancefloatno0.5Importance (0.0-1.0)
tagsstring[]no[]Tags
metadataobjectno{}Metadata
observer_idstringnonullObserver entity
subject_idstringnonullSubject entity

Update operation fields:

FieldTypeRequiredDescription
opstringyesMust be "update"
memory_idstringyesMemory ID to update
contentstringnoUpdated content
typestringnoUpdated type
subtypestringnoUpdated subtype
importancefloatnoUpdated importance
tagsstring[]noUpdated tags
metadataobjectnoUpdated metadata
pinnedbooleannoPin/unpin memory

Delete operation fields:

FieldTypeRequiredDefaultDescription
opstringyes—Must be "delete"
memory_idstringyes—Memory ID to delete
hardbooleannofalseHard 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:

Terminal window
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.

EndpointPurpose
PUT /v1/memories/{memory_id}/semanticConditionally replace the full refinement-owned memory document. Body: content (required), type (required), subtype, tags, refinement_metadata, pinned.
POST /v1/memories/{memory_id}/deleteConditionally tombstone a memory. Returns {"memory": ..., "replayed": bool}.
POST /v1/memories/{memory_id}/restoreConditionally restore a tombstoned memory
GET /v1/memories/{memory_id}/revisionsList immutable revisions, newest first. Query: limit (default 100), page_token.
Terminal window
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:

ParameterTypeDescription
memory_idstringSource memory ID

Request Body:

FieldTypeRequiredDefaultDescription
target_idstringyes—Target memory ID
relationshipstringyes—Relationship type (e.g., similar_to, causes, solves)
strengthfloatno0.5Relationship strength (0.0-1.0)
metadataobjectno{}Arbitrary metadata
workspace_idstringnofrom sessionWorkspace 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:

Terminal window
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:

ParameterTypeDescription
memory_idstringMemory identifier

Query Parameters:

ParameterTypeDefaultDescription
relationshipsstringnullComma-separated relationship types to filter by
directionstringbothoutgoing, 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:

Terminal window
# All associations
curl http://localhost:61001/v1/memories/mem_abc123/associations
# Filter by relationship type and direction
curl "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.

FieldTypeRequiredDescription
strengthfloatnoNew relationship strength (0.0-1.0)
metadataobjectnoReplacement metadata

Response: 204 No Content

Terminal window
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:

ParameterTypeDescription
memory_idstringStarting memory for traversal

Request Body:

FieldTypeRequiredDefaultDescription
workspace_idstringnofrom sessionWorkspace override
max_depthintegerno2Maximum traversal depth (1-5)
relationship_typesstring[]no[]Filter by relationship types (empty = all)
directionstringnobothoutgoing, incoming, or both
min_strengthfloatno0.0Minimum 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:

Terminal window
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:

FieldTypeRequiredDefaultDescription
session_idstringnoauto-generatedClient-provided session ID
workspace_idstringno_defaultWorkspace ID (auto-created if absent)
ttl_secondsintegerno3600Session TTL in seconds (60-86400)
metadataobjectno{}Session metadata
context_idstringno_defaultContext to bind session to
working_memoryobjectnonullInitial working memory key-value pairs
briefingbooleannofalseInclude briefing with relevant memories
briefing_optionsobjectnonullBriefing 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:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace to list sessions for
context_idstringnullFilter by context
include_expiredbooleanfalseInclude 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:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace to get briefing for
lookback_minutesinteger60How far back to look for activity
detail_levelstringabstractDetail level for memory content
limitinteger10Maximum items to include
include_memoriesbooleantrueInclude recent memories
include_contradictionsbooleantrueInclude detected contradictions

Response: 200 OK

{
"briefing": {
"workspace_id": "my-workspace",
"summary": "Workspace has 142 memories. 3 sessions active.",
"recent_memories": [],
"contradictions": []
}
}

curl example:

Terminal window
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:

ParameterTypeDescription
session_idstringSession identifier

Response: 200 OK

{
"session": {
"id": "sess_abc123",
"workspace_id": "my-workspace",
"expires_at": "2026-01-15T11:30:00Z",
"metadata": {"task": "debugging"}
}
}

curl example:

Terminal window
curl http://localhost:61001/v1/sessions/sess_abc123

DELETE /v1/sessions/{session_id}

Delete a session and all its context data.

Response: 204 No Content

curl example:

Terminal window
curl -X DELETE http://localhost:61001/v1/sessions/sess_abc123

POST /v1/sessions/{session_id}/memory

Store a key-value pair in session working memory.

Path Parameters:

ParameterTypeDescription
session_idstringSession identifier

Request Body:

FieldTypeRequiredDefaultDescription
keystringyes—Working memory key
valueanyyes—Working memory value (JSON-serializable)
ttl_secondsintegernonullOptional 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:

Terminal window
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:

ParameterTypeDescription
session_idstringSession identifier

Query Parameters:

ParameterTypeDefaultDescription
keystringnullSpecific 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:

Terminal window
# Get all working memory
curl http://localhost:61001/v1/sessions/sess_abc123/memory
# Get specific key
curl "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:

ParameterTypeDescription
session_idstringSession identifier

Request Body (optional):

FieldTypeRequiredDefaultDescription
min_importancefloatno0.5Minimum importance threshold (0.0-1.0)
deduplicatebooleannotrueEnable deduplication of extracted memories
categoriesstring[]nonullCategory names to commit (null for all)
max_memoriesintegerno50Maximum 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:

Terminal window
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:

ParameterTypeDescription
session_idstringSession identifier

Query Parameters:

ParameterTypeDefaultDescription
extend_secondsintegerserver defaultSeconds to extend TTL (60-86400)

Response: 200 OK

{
"expires_at": "2026-01-15T12:30:00Z"
}

curl example:

Terminal window
# Extend with default TTL
curl -X POST http://localhost:61001/v1/sessions/sess_abc123/touch
# Extend by 2 hours
curl -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:

FieldTypeRequiredDefaultDescription
transcript_segmentstringyes—Raw transcript text to capture
content_hashstringyes—Hex SHA-256 of the UTF-8 encoded segment (64 chars); a mismatch returns 400
idempotency_keystringyes—Client key that makes retries safe (1-255 chars)
source_kindstringnotranscriptKind of source being captured
source_sequenceintegernonullMonotonic sequence number from the source
source_boundaryintegernonullBoundary 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.

Terminal window
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:

FieldTypeRequiredDefaultDescription
topicstringnonullOptional topic to focus the pack
entity_idsstring[]no[]Canonical entity IDs to focus on
entity_namesstring[]no[]Entity surface names to focus on
budget_tokensintegerno2048Token budget (32-200000)
section_limitsobjectnosee belowPer-section item caps: directives (8), working_memory (20), recent_activity (20), contradictions (5), checkpoints (8)
include_directivesbooleannotrueInclude directive memories
include_working_memorybooleannotrueInclude session working memory
include_recent_activitybooleannotrueInclude recent activity
include_contradictionsbooleannotrueInclude unresolved contradictions
include_sandbox_summarybooleannotrueInclude a Context Environment summary
include_checkpoint_recoverybooleannotrueInclude 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": []
}
Terminal window
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.

FieldTypeRequiredDefaultDescription
cursorstringyes—Cursor from a previous context pack or delta
budget_tokensintegerno2048Token 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.

Terminal window
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:

FieldTypeRequiredDefaultDescription
idstringnogeneratedOptional workspace ID
namestringyes—Workspace name
settingsobjectno{}Workspace-level settings
tagsstring[]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:

Terminal window
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:

ParameterTypeDefaultDescription
tagsstring[]nullTag filter; repeat the parameter for several tags (?tags=knowledge&tags=topic:finance)
matchstringallall (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:

Terminal window
curl http://localhost:61001/v1/workspaces

GET /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:

Terminal window
curl http://localhost:61001/v1/workspaces/ws_abc123

PUT /v1/workspaces/{workspace_id}

Update workspace name, settings, or tags.

Request Body:

FieldTypeRequiredDescription
namestringnoUpdated workspace name
settingsobjectnoUpdated settings
tagsstring[]noUpdated tags

Response: 200 OK — returns the updated workspace.

curl example:

Terminal window
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:

Terminal window
curl -X DELETE http://localhost:61001/v1/workspaces/ws_abc123

GET /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:

Terminal window
curl http://localhost:61001/v1/workspaces/ws_abc123/schema

GET /v1/workspaces/{workspace_id}/export

Export workspace memories and associations as streaming NDJSON.

Query Parameters:

ParameterTypeDefaultDescription
offsetinteger0Skip first N memories
limitinteger0Max memories to export (0 = unlimited)
include_associationsbooleantrueInclude memory associations

Response: 200 OK with Content-Type: application/x-ndjson

The stream contains lines of JSON objects with these types:

Line typeDescription
headerExport metadata (version, workspace, counts)
memoryIndividual memory with index
associationIndividual association
footerSummary counts

curl example:

Terminal window
# Export all memories to file
curl http://localhost:61001/v1/workspaces/ws_abc123/export -o export.ndjson
# Export first 100 memories without associations
curl "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:

Terminal window
# Import from NDJSON file
curl -X POST http://localhost:61001/v1/workspaces/ws_abc123/import \
-H "Content-Type: application/x-ndjson" \
--data-binary @export.ndjson
# Import from JSON
curl -X POST http://localhost:61001/v1/workspaces/ws_abc123/import \
-H "Content-Type: application/json" \
-d @import.json

Workspace contexts

Contexts are logical groupings inside a workspace (sessions, threads, and memories can target a context_id).

EndpointPurpose
POST /v1/workspaces/{workspace_id}/contextsCreate a context. Body: name (required, unique within the workspace), optional id, description, settings. Returns 201.
GET /v1/workspaces/{workspace_id}/contextsList all contexts in the workspace
DELETE /v1/workspaces/{workspace_id}/contexts/{context_id}Delete a context. Its memories are not deleted. Returns 204.
Terminal window
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.

EndpointPurpose
POST /v1/workspaces/{workspace_id}/viewsCreate 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}/viewsList 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}/restoreRestore a tombstoned view
GET /v1/workspaces/{workspace_id}/views/{view_id}/revisionsList view revisions
GET /v1/workspaces/{workspace_id}/views/{view_id}/observationsList 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}/restoreRestore an observation
GET /v1/workspaces/{workspace_id}/views/{view_id}/observations/{observer_id}/revisionsList observation revisions

Contradictions

GET /v1/workspaces/{workspace_id}/contradictions

List unresolved contradictions in a workspace.

Path Parameters:

ParameterTypeDescription
workspace_idstringWorkspace identifier

Query Parameters:

ParameterTypeDefaultDescription
limitinteger10Maximum 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:

Terminal window
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:

ParameterTypeDescription
contradiction_idstringContradiction identifier

Query Parameters:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace override

Request Body:

FieldTypeRequiredDescription
resolutionstringyesStrategy: keep_a, keep_b, keep_both, or merge
merged_contentstringwhen mergeMerged content (required when resolution is merge)

Response: 200 OK — returns the resolved contradiction.

curl example:

Terminal window
# Keep one memory
curl -X POST http://localhost:61001/v1/contradictions/ctr_abc123/resolve \
-H "Content-Type: application/json" \
-d '{"resolution": "keep_a"}'
# Merge conflicting memories
curl -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:

ParameterTypeDescription
workspace_idstringWorkspace identifier

Request Body (optional):

FieldTypeRequiredDefaultDescription
batch_sizeintegernoserver defaultMemories 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:

Terminal window
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.

ParameterTypeDefaultDescription
workspace_idstringfrom contextWorkspace override
statusstringactiveactive or merged
limitinteger100Maximum 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.

ParameterTypeRequiredDefaultDescription
namestringyes—Surface name to resolve
entity_typestringnopersonperson, org, project, place, concept, or event
workspace_idstringnofrom contextWorkspace override

Response: 200 OK returns {"resolution": {"entity": {...}, "matched_via": "exact" | "alias" | "embedding", "score": 1.0}}.

Terminal window
curl "http://localhost:61001/v1/entities/resolve?name=Ada&entity_type=person"

Other entity endpoints

EndpointPurpose
GET /v1/entities/{entity_id}Get one canonical entity (workspace_id)
GET /v1/entities/{entity_id}/provenanceNormalized lineage: how the entity originated, which memories first surfaced it, and its external-KB links
GET /v1/entities/{entity_id}/relatedCo-occurrence neighborhood, meaning entities mentioned together in shared memories. Query: limit (default 10), min_shared (default 1).
POST /v1/entities/mergeMerge 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/dedupeBatch 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/seedCreate 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/backfillReplay 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/enrichLink 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:

ParameterTypeDescription
entity_idstringEntity identifier (agent ID, user ID, etc.)

Request Body:

FieldTypeRequiredDefaultDescription
workspace_idstringnofrom sessionWorkspace override
observer_idstringnonullOptional observer perspective filter
forcebooleannofalseForce 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:

Terminal window
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:

ParameterTypeDescription
entity_idstringEntity identifier

Query Parameters:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace override
force_refreshbooleanfalseTrigger 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:

Terminal window
# Get cached card
curl "http://localhost:61001/v1/entities/user_123/card?workspace_id=my-workspace"
# Force refresh
curl "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:

ParameterTypeDescription
entity_idstringEntity identifier

Query Parameters:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace override
observer_idstringnullFilter by observer perspective
limitinteger20Maximum insights to return

Response: 200 OK

{
"entity_id": "user_123",
"workspace_id": "my-workspace",
"insights": [],
"total_count": 0
}

curl example:

Terminal window
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:

FieldTypeRequiredDefaultDescription
workspace_idstringnofrom sessionWorkspace override
user_idstringnonullUser scope for this thread
context_idstringno_defaultContext within workspace
observer_idstringnonullObserver entity ID (typically the AI agent)
subject_idstringnonullSubject entity ID (typically the human user)
titlestringnonullOptional display title
metadataobjectno{}Arbitrary metadata
expires_atdatetimenonullOptional expiration (null = permanent)
idle_actionstringnonullIdle policy: null (never idles out), hide, or delete
scopestringnonullSurface scope: web or office (null is treated as web)
ownershipstringnouseruser (private to the owning user, listable across workspaces) or workspace (shared in the workspace)
parent_threadstringnonullParent 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:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter
user_idstringnullUser filter
limitinteger50Max threads to return (1-200)
offsetinteger0Pagination offset
scope_filterstringnullweb or office (null returns all)
ownership_filterstringnulluser or workspace (null returns all)
include_hiddenbooleanfalseInclude archived/hidden threads
parent_threadstringnullList 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:

Terminal window
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.

Terminal window
curl "http://localhost:61001/v1/threads/user/user_123?limit=20"

GET /v1/threads/{thread_id}

Get thread metadata by ID.

Query Parameters:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter

Response: 200 OK — returns the thread object.

curl example:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter

Request Body:

FieldTypeRequiredDescription
titlestringnoUpdated display title
metadataobjectnoUpdated metadata
idle_actionstringnoIdle policy: null, hide, or delete

Response: 200 OK — returns the updated thread.

curl example:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter
limitinteger100Max messages to return (1-1000)
offsetinteger0Message pagination offset
orderstringascMessage 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:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter

Response: 204 No Content

curl example:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter

Request Body:

FieldTypeRequiredDescription
messagesobject[]yesMessages to append (minimum 1)

Each message object:

FieldTypeRequiredDefaultDescription
idstringnogeneratedOptional client-supplied message ID
rolestringyes—Message role: user, assistant, system, tool
contentanyyes—Message content (string or structured content blocks)
metadataobjectno{}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:

Terminal window
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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace filter
limitinteger100Max messages to return (1-1000)
offsetinteger0Pagination offset
after_indexintegernullGet messages after this index
orderstringascMessage order: asc or desc

Response: 200 OK

{
"messages": [],
"thread_id": "thread_abc123",
"total_count": 12
}

curl example:

Terminal window
# Get latest messages
curl "http://localhost:61001/v1/threads/thread_abc123/messages?order=desc&limit=10"
# Get messages after index 5
curl "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:

ParameterTypeDescription
thread_idstringThread to delete from
message_idstringMessage 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:

ParameterTypeDefaultDescription
workspace_idstringfrom auth contextWorkspace 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:

Terminal window
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:

FieldTypeRequiredDefaultDescription
observerstringyes—Observing entity (surface name)
subjectstringyes—Entity the representation is about (surface name)
workspace_idstringnofrom sessionWorkspace override
observer_typestringnonullEntity type hint for resolving the observer
subject_typestringnonullEntity type hint for resolving the subject
limitintegerno20Max observations to return (1-200)
include_profilebooleannotrueAttach 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": {}
}
Terminal window
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.

FieldTypeRequiredDefaultDescription
user_idstringnoauthenticated userUser to assemble the representation for
workspace_idstringnofrom sessionRequest-context workspace
limitintegerno20Max observations to return
include_profilebooleannotrueAttach 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:

FieldTypeRequiredDefaultDescription
senderstringyes—Email sender
bodystringyes—Email body text
tostring[]no[]Recipients (stored in metadata and mapped to sent_to relations)
subjectstringnonullSubject line
timestampdatetimenonullWhen the email was sent (becomes event_time)
thread_idstringnonullConversation/thread ID (preferred source-thread linkage)
message_idstringnonullMessage ID (fallback source-thread linkage; stamped in metadata)
importancefloatno0.5Memory importance (0.0-1.0)
workspace_idstringnofrom sessionWorkspace override
context_idstringnofrom sessionTarget memory context
metadataobjectno{}Additional source metadata
relationsobject[]no[]Additional typed relations evidenced by the email

Response: 201 Created with {"memory": {...}}

Terminal window
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:

FieldTypeRequiredDefaultDescription
codestringyes—Python code to execute
result_varstringnonullStore expression result in this variable
return_resultbooleannotrueInclude result value in response
max_return_charsintegerno10000Maximum chars for result serialization (100-100000)

Response: 200 OK

{
"output": "",
"result": "4.2",
"error": null,
"variables_changed": ["result", "total_importance"]
}

curl example:

Terminal window
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:

ParameterTypeDefaultDescription
variablestringnullSpecific variable to inspect (omit for overview)
preview_charsinteger200Characters 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:

Terminal window
# Overview of all variables
curl -X POST http://localhost:61001/v1/context/inspect \
-H "X-Session-ID: sess_abc123"
# Inspect specific variable
curl -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:

FieldTypeRequiredDefaultDescription
varstringyes—Variable name to store results in
querystringyes—Memory recall query
limitintegerno50Maximum memories to recall (1-500)
typesstring[]nonullFilter by memory types
tagsstring[]nonullFilter by tags
min_relevancefloatnonullMinimum relevance score (0.0-1.0)
include_embeddingsbooleannofalseInclude embedding vectors

Response: 200 OK

{
"count": 12,
"variable": "auth_memories",
"query": "authentication patterns",
"total_available": 25
}

curl example:

Terminal window
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:

FieldTypeRequiredDefaultDescription
keystringyes—Variable name
valueanyyes—Value to inject (JSON-serializable)
parse_jsonbooleannofalseParse value string as JSON

Response: 200 OK

{
"variable": "config",
"type": "dict",
"preview": "{'threshold': 0.7, 'max_items': 100}"
}

curl example:

Terminal window
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:

FieldTypeRequiredDefaultDescription
promptstringyes—Prompt for the LLM
variablesstring[]no[]Variable names to include as context
max_context_charsintegernonullMaximum chars for variable context (100-500000)
result_varstringnonullStore 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:

Terminal window
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:

FieldTypeRequiredDefaultDescription
goalstringyes—Natural language description of the goal
memory_querystringnonullOptional memory query to load initial data
memory_limitintegerno100Maximum memories to load (1-500)
max_iterationsintegerno10Maximum reasoning iterations (1-50)
variablesstring[]nonullVariable names to include in context
result_varstringnonullStore final result in this variable
detail_levelstringnostandardDetail 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:

Terminal window
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:

Terminal window
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:

Terminal window
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:

Terminal window
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.

EndpointPurpose
POST /v1/skillsCreate 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/skillsList 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/resolveResolve 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}/manifestRender the full SKILL.md text (include_addenda)
PUT /v1/skills/{skill_id}/manifestConditionally replace the complete manifest (needs Idempotency-Key + If-Match)
POST /v1/skills/{skill_id}/deleteConditionally tombstone the manifest
POST /v1/skills/{skill_id}/restoreConditionally restore a tombstoned skill
GET /v1/skills/{skill_id}/revisionsList immutable manifest revisions, newest first (limit, page_token)
GET /v1/skills/{skill_id}/filesList 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}/bundleStream the full bundle as NDJSON (default) or ?format=tar.gz
POST /v1/skills/{skill_id}/syncReconcile 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.

EndpointPurpose
POST /v1/mcp-serversCreate 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-serversList entries. Query: name, transport, enabled, include_shadowed, reveal_secrets, limit, offset.
POST /v1/mcp-servers/resolveResolve by exact name (precedence winner) or by intent query (vector recall), optionally filtered by transport
POST /v1/mcp-servers/importImport a .mcp.json document (mcpServers map). Each entry becomes one record.
GET /v1/mcp-servers/exportExport 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}/syncReconcile 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.

EndpointPurpose
POST /v1/documentsUpload 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/documentsList documents. Query: status, document_type, workspace_id, limit, offset.
GET /v1/documents/jobsList 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}/cancelCancel a queued or running ingestion job
POST /v1/documents/searchColPali 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}/memoriesGet the memories extracted from a document
GET /v1/documents/{document_id}/pagesList pages
GET /v1/documents/{document_id}/pages/{page_id}Get a single page
POST /v1/documents/{document_id}/reprocessRe-queue extraction with optional new extraction_options. Returns 202.
POST /v1/documents/{document_id}/verifyRe-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):

FieldTypeRequiredDefaultDescription
querystringyes—Natural-language search query
limitintegerno10Max results (1-100)
doc_idsstring[]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.

EndpointPurpose
POST /v1/data-providersCreate a provider. Body: name (required), provider_type (default local), description, enabled, connection_args, schedule, metadata, workspace_id.
GET /v1/data-providersList 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}/syncTrigger 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.

EndpointPurpose
POST /v1/knowledgebase/generateGenerate 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/knowledgebaseKnowledgebase metadata, including corpus-coverage statistics
GET /v1/knowledgebase/articlesList articles (article_type: index, community, entity; limit, offset)
GET /v1/knowledgebase/articles/{article_id}Get one article
GET /v1/knowledgebase/exportDownload the knowledgebase as an Obsidian-compatible vault (application/zip)
GET /v1/knowledgebase/graphGraph 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):

EndpointPurpose
GET /kbList 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.

EndpointPurpose
GET /v1/graph/snapshotGraph snapshot metadata for the workspace (include_rpg to include RPG code-graph nodes)
GET /v1/graph/communitiesDetected communities (clusters) in the association graph
GET /v1/graph/centralityPer-node centrality scores (degree and betweenness)
GET /v1/graph/bridgesEdges that bridge different communities
GET /v1/graph/statsAggregate graph statistics
POST /v1/graph/analyzeFull analysis (snapshot, communities, centrality, bridges, and stats) in one call. Body: workspace_id, context_id, include_rpg.
POST /v1/graph/densify-previewExperimental 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.

EndpointPurpose
POST /v1/rpg/syncUpsert 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/statusEncoding status for the current workspace (context_id)
GET /v1/rpg/nodesList nodes (node_type, context_id default rpg, limit default 5000)
DELETE /v1/rpg/nodesDelete nodes by RPG node ID. Body: node_ids, context_id.
DELETE /v1/rpg/edgesBulk-delete edges. Body: association_ids.
GET /v1/rpg/searchSearch nodes by name, description, or path (query, node_types, limit, context_id)
GET /v1/rpg/subgraphSubgraph rooted at a path or node_id (depth default 3, node_types, relationship_types, context_id, max_nodes default 2000)
GET /v1/rpg/merged-subgraphCanonical base graph merged with an overlay context (base_context, overlay_context, path, depth)
GET /v1/rpg/overlaysList active overlay contexts (rpg-task-*, rpg-intent-*)
DELETE /v1/rpg/overlays/{context_id}Delete all nodes in an overlay context
GET /v1/rpg/conflictsFile-level conflicts between a task’s intent and other active intents (task_id)
GET /v1/rpg/conflicts/symbolsSymbol-level conflicts between two task overlays (task_id_a, task_id_b)
POST /v1/rpg/enrichTrigger 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):

EndpointPurpose
POST /v1/agent-specificationsCreate 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-specificationsList 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}/restoreRestore a tombstoned spec
GET /v1/agent-specifications/{specification_id}/revisionsList revisions

Prompt notes (/v1/prompt-notes):

EndpointPurpose
POST /v1/prompt-notesCreate a note. Body: key, title, content (required), enabled, metadata.
GET /v1/prompt-notesList 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}/restoreRestore a tombstoned note
GET /v1/prompt-notes/{note_id}/revisionsList revisions

Refinement records (/v1/refinement-records). These are append-only records of proposed, approved, applied, or rolled-back refinements:

EndpointPurpose
POST /v1/refinement-recordsCreate 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-recordsList 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.

EndpointPurpose
GET /v1/audit/eventsQuery audit events for the current tenant. Query: workspace_id, event_type, since (ISO datetime), limit (default 100).
GET /v1/audit/events/summaryEvent 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.

EndpointPurpose
GET /v1/tokensList tokens (include_revoked, default false)
POST /v1/tokensCreate 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}/revokeRevoke a token without deleting it (keeps the audit trail)

Health

GET /health

Basic liveness check.

Response: 200 OK

curl example:

Terminal window
curl http://localhost:61001/health

GET /health/ready

Readiness check that verifies database and cache connectivity.

Response: 200 OK

curl example:

Terminal window
curl http://localhost:61001/health/ready