Skip to main content

Query Memory

POST/agent/memory/query

Search a volume's memories using semantic similarity. Returns matching memories from vector search plus related knowledge graph facts and document sources.

Request​

Headers​

HeaderValue
AuthorizationBearer sm_live_...
Content-Typeapplication/json

Body Parameters​

querystringrequired
Search query (1–10,000 characters). Natural language works best.
volume_idstring (UUID)required
Volume to search within.
limitinteger
Max results to return (1–50, default: 10).

Response​

200 Search results with graph enrichment

{
"query": "What does John do?",
"volume_id": "...",
"memories": [
{
"id": "point-id",
"content": "John Smith is the CTO of Acme Corp",
"score": 0.95,
"agent": "onboarding-agent",
"memory_type": "factual",
"document_id": null,
"filename": null,
"chunk_index": null,
"created_at": "2024-01-15T10:30:00Z"
}
],
"graph_facts": [
{
"source": "John Smith",
"type": "WORKS_AT",
"description": "Chief Technology Officer since 2022",
"target": "Acme Corp"
}
],
"document_sources": [
{
"document_id": "doc-uuid",
"filename": "team-roster.pdf",
"best_score": 0.88,
"chunk_count": 3,
"snippets": ["John Smith, CTO..."]
}
],
"total_results": 5
}

Response Fields​

FieldDescription
memoriesVector search results — only those scored above 0.3 threshold
graph_factsRelated knowledge graph relationships found via entity traversal
document_sourcesDocuments containing relevant chunks, grouped by file
total_resultsTotal count of memories + graph facts

Example​

curl -X POST https://api.sharedmemory.ai/agent/memory/query \
-H "Authorization: Bearer sm_live_..." \
-H "Content-Type: application/json" \
-d '{
"query": "What technologies does the team use?",
"volume_id": "a1b2c3d4-...",
"limit": 20
}'

Errors​

StatusErrorDescription
400validation_failedInvalid input — check details
403agent_not_authorized_for_volumeAgent doesn't have read access
429Too Many RequestsRate limit exceeded (60/min)
500query_failedInternal error — retry with backoff