MemorySync
API Reference

Recall Context

Get a prompt-ready context block for an LLM call, rather than a list of records.

Endpoint and request fields

POST/v1/memory/recall
200 OK
FieldTypeContract
tenant_idstringRequired tenant identifier.
user_idstringRequired end-user identifier.
promptstringRequired prompt the context is being assembled for.
kintegerOptional ceiling on memories considered.
typesstring[]Optional content-type filter.

Build context

import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="usr_7f3a9c2e",
)
result = client.recall(
tenant_id="acme",
user_id="usr_7f3a9c2e",
prompt="Book me a flight to Berlin",
types=["preference", "fact"],
)
prompt = f"{result['context']}\n\nUser: Book me a flight to Berlin"

Result handling

Returns a context string ready to place in a prompt, plus the sub-queries, intents, entities and cluster hits that produced it. An empty context is a valid result for a user with nothing relevant stored.

How the types filter behaves

Errors and next action

A 422 means a missing required field. For 429 or 5xx, call the model without memory context rather than failing the user's request.

Safety notes