Skip to main content

POST /recall

Retrieve the most semantically similar memories to a query.

Request

POST https://api.lawmem.ai/recall
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Body Parameters

FieldTypeRequiredDescription
querystringYesNatural language query to search by
namespacestringYesNamespace to search within
top_kintegerNoResults to return (default: 5, max: 20)

Example

curl -X POST https://api.lawmem.ai/recall \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "What are this client preferences on dispute resolution?",
"namespace": "client-acme",
"top_k": 5
}'

Response

{
"results": [
{
"id": "mem_a1b2c3d4",
"text": "Client has a strict no-arbitration clause in all vendor contracts.",
"score": 0.91,
"metadata": {"source": "intake", "date": "2026-03-21"},
"created_at": "2026-03-21T12:00:00Z"
}
],
"namespace": "client-acme",
"query_tokens": 14
}
FieldDescription
resultsMemories ranked by cosine similarity
scoreSimilarity score 0-1. Above 0.80 is a strong semantic match
query_tokensTokens used for the query embedding