Filter by Container Tags
Container tags use exact array matching - memories must have the exact same tags in the same order.- TypeScript
- Python
- cURL
Metadata Filtering with SQL Logic
Thefilters
parameter allows filtering by metadata fields using SQL-like query structures. Since we use SQL query construction in the backend, you need to structure your filters like database queries with explicit AND/OR logic.
Why This Structure?
In SQL databases,AND
has higher precedence than OR
. Without explicit grouping, a query like:
Filter Structure Rules:
- Always wrap conditions in
AND
orOR
arrays (even single conditions) - Use
JSON.stringify()
to convert the filter object to a string - Each condition needs
key
,value
, andnegate
properties negate: false
for normal matching,negate: true
for exclusion
Simple Metadata Filter
- TypeScript
- Python
- cURL
Multiple Conditions (AND Logic)
- TypeScript
- Python
- cURL
Alternative Conditions (OR Logic)
- TypeScript
- Python
- cURL
Complex Nested Logic
- TypeScript
- Python
- cURL
Array Contains Filtering
Filter memories that contain specific values in array fields like participants, tags, or team members.Basic Array Contains
- TypeScript
- Python
- cURL
Array Contains with Exclusion
- TypeScript
- Python
- cURL
Multiple Array Contains (OR Logic)
- TypeScript
- Python
- cURL
Combined Container Tags + Metadata Filtering
- TypeScript
- Python
- cURL
Common Mistakes:
- Using bare condition objects:
{"key": "category", "value": "programming"}
- Forgetting JSON.stringify: passing objects instead of strings
- Missing negate property: always include
"negate": false
or"negate": true
Container Tags vs Metadata Filtering:
- Container tags: Exact array matching for organizational grouping
- Metadata filters: SQL-like queries on custom metadata fields with complex logic
- Both can be combined for powerful filtering capabilities