Skip to main content
POST
Purpose-built for retrieval-augmented generation (RAG). Given a user query, the endpoint retrieves the most relevant memories, recent events, and graph relationships, then returns a pre-formatted context string ready to prepend to your LLM prompt. This is the easiest way to add memory to your AI chat. One call → formatted context.

Request

Headers

string
required
Bearer token with your API key
string
required
application/json

Body

string
required
The user’s query. This drives retrieval.
string
Chat session ID for hierarchical session context.
integer
default:"10"
Number of memories to retrieve. Max 100.
integer
default:"4000"
Maximum assembled context length in tokens. Older chunks truncated if exceeded.
boolean
default:"false"
Include knowledge-graph relationships.
boolean
default:"true"
Include recent events from EventStoreDB.

Response

string
The key field — a pre-formatted context string you can prepend directly to your LLM system message.
object
Structured context with separate chunks, sources, graph_context, and timeline sections.
string
Status message (e.g., “Context assembled from 8 memories and 3 recent events”).

Complete RAG example

Billing

Flat **0.0005perqueryslightlyhigherthan/memory/searchbecausecontextassemblyalsoformatsanLLMreadypromptwithrecenteventsandoptionalgraphcontext.Achatapplicationdoing1,000turns/daycostsabout0.0005 per query** — slightly higher than `/memory/search` because context assembly also formats an LLM-ready prompt with recent events and optional graph context. A chat application doing 1,000 turns/day costs about 15/month. Response headers:
If the memory service is unreachable and the endpoint returns the graceful-degradation empty context (see below), you are not charged — the auto-refund guard reverses the deduction.
See Pricing & Billing for the full rate card.

Graceful degradation

If the Memory service is unavailable, /memory/context returns prompt_ready: "" instead of failing. Your application can continue with no context — the SLM chat will still work, just without memory-grounded responses.
No-context response
Best practice: Always check if prompt_ready is non-empty before prepending it.