SmartMemory
GET
/memory/by-metadata

Find memory items by exact metadata match.

Returns a list of items whose metadata.<metadata_key> equals metadata_value. Empty result is HTTP 200 with {items: [], count: 0} — "no match" is not an error.

Storage flattens metadata into top-level node properties (separator __), so metadata_key="bot_topic" matches the flat prop n.bot_topic. Nested keys can be passed as nested.key and are translated to nested__key.

Previously this route hardcoded top_k=1 and 404'd on empty; both have been corrected here. The core search_by_metadata was also rewritten (was returning [] for every call due to a missing method on SmartGraph).

Query Parameters

metadata_key*Metadata Key

Metadata key to search

metadata_value*Metadata Value

Metadata value to match

memory_type?|

Type of memory to filter

limit?Limit

Max results to return

Response Body

application/json

application/json

curl -X GET "https://example.com/memory/by-metadata?metadata_key=string&metadata_value=string"
null
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}