Korely

Core memory operations

Search memories

Semantic search over your memory store. Scope it to one end user and agent, or search across everyone you've stored.

POST /v1/memories/search

SDK: korely.search(query, ...). Semantic recall runs server-side over the same store the write path populates, embeddings, entities and typed facts. You send a query and an optional scope; you get ranked, snippeted hits back. This is a read, so it counts against your monthly query quota.

Authentication

HTTP header, required: Authorization: Bearer kor_live_....

Request body

FieldTypeRequiredDescription
querystringRequiredThe search query. 1-2,000 characters.
user_idstringOptionalEnd-user namespace filter. Max 255 chars. When omitted, searches across all end users in your account.
agent_idstringOptionalAgent sub-namespace filter. Max 255 chars.
limitintegerOptionalMaximum number of results. Default 15, minimum 1, maximum 50.

Example request

Terminal window
curl -X POST https://api.korely.ai/v1/memories/search \
-H "Authorization: Bearer kor_live_..." \
-H "Content-Type: application/json" \
-d '{
"query": "communication preferences",
"user_id": "customer-giulia-4812",
"agent_id": "onboarding-bot",
"limit": 15
}'

Response

200 OK. A ranked list of matching memories, each with a relevance score and a truncated snippet.

{
"results": [
{
"id": "mem_8f2c1a",
"score": 0.873,
"snippet": "Giulia prefers async standups and works in CET.",
"user_id": "customer-giulia-4812",
"agent_id": "onboarding-bot",
"metadata": {"source": "slack"}
}
]
}
FieldTypeDescription
resultsarray<SearchResult>Ranked list of matches. Each SearchResult has the fields below.
results[].idstringThe memory id, e.g. mem_8f2c1a.
results[].scorefloatRelevance score for this hit. Higher is more relevant.
results[].snippetstringThe memory content, truncated to 280 characters.
results[].user_idstring · nullThe end user this memory belongs to (null if none).
results[].agent_idstring · nullThe agent sub-namespace (null if none).
results[].metadataobjectThe metadata stored with the memory ({} if none).

Errors

StatusCodeCause
401invalid_keyMissing or invalid Authorization header, no valid kor_live_ key.
403forbiddenThe key lacks the memories:read scope.
422invalid_requestValidation failed, empty or over-long query, or limit outside the 1-50 range.
429quota_exceededMonthly query quota reached. No Retry-After; resets at the next billing cycle, or upgrade.
429rate_limit_exceededPer-tier minute/hour/day rate limit exceeded. Includes Retry-After and X-RateLimit-* headers, retry shortly.
503search_unavailableMemory search is temporarily unavailable. Retry.

Notes

  • Counts as one query. Each search counts against your monthly query quota. Crossing 80% of that quota fires the quota.warning webhook once.
  • Snippets are truncated. The snippet is the memory content cut to 280 characters. Read the full text with Get a memory.
  • Omit user_id to search everyone. Leaving user_id out searches across all end users in your account. Pass it to scope recall to a single end user.

Related