Skip to main content

Overview

Filters allow you to narrow down results and context in the /api/v1/search, /api/v1/chat, and /api/v1/generate endpoints. You can filter by native memo fields or custom metadata fields using various operators. Filters are applied using AND logic - all filters must match for a memo to be included.

Filter Structure

Each filter object has the following structure:
Required Fields:
  • field (string): The field name to filter on
  • operator (string): The comparison operator to use
  • value (string | array): The value to compare against (arrays required for in and not_in)
  • filter_type (string): Either native_field or custom_metadata

Filter Types

Native Fields

Filter on built-in memo properties using filter_type: "native_field":
  • title - Memo title
  • source - Source system name
  • client_reference_id - External reference ID
  • tags - Memo tags (must use in or not_in operator with array value)
Example:

Custom Metadata

Filter on any field from a memo’s metadata JSON object using filter_type: "custom_metadata": Example:
This filters memos where metadata.category contains “tutorial”.

Operators

Equality Operators

  • eq - Equals (exact match)
  • neq - Not equals
Example:

String Operators

  • contains - Contains substring (case-insensitive)
  • startswith - Starts with (case-sensitive)
  • endswith - Ends with (case-sensitive)
Example:

Array Operators

  • in - Value is in array (requires array value)
  • not_in - Value is not in array (requires array value)
Example:
Tags Example (always requires array):

Combining Filters

Multiple filters use AND logic - all filters must match for a memo to be included in results. Example:
This returns only memos where:
  • Title/content matches “python tutorial” AND
  • Source equals “docs.python.org” AND
  • Metadata field “level” equals “beginner” AND
  • Has at least one tag in [“tutorial”]

Common Filter Patterns

Filter by Source

Limit results to specific source systems:

Filter by Tags

Include memos with specific tags:
Exclude memos with specific tags:

Filter by Custom Metadata

Filter by any custom metadata field:

Partial String Match

Find memos with titles containing specific text:

Multiple Conditions

Combine filters for precise results:

Error Responses

Invalid filter structure (400):
Common filter errors:
  • Missing required fields (field, operator, value, filter_type)
  • Invalid operator (must be one of: eq, neq, contains, startswith, endswith, in, not_in)
  • Invalid filter_type (must be native_field or custom_metadata)
  • Invalid native field (must be title, source, client_reference_id, or tags)
  • Tags filter must use in or not_in operator with array value
  • in and not_in operators require array value

Using Filters Across Endpoints

Search Endpoint

Filters narrow down search results:
See Search API for details.

Chat Endpoint

Filters control which memos are used as context for chat responses:
See Chat API for details.

Generate Endpoint

Filters determine which memos provide context for document generation:
See Generate API for details.

Tips and Best Practices

  1. Use specific filters - Narrow your scope to improve relevance and reduce noise
  2. Combine native and custom fields - Mix source/tags filters with metadata filters for precision
  3. Test filters incrementally - Add filters one at a time to understand their impact
  4. Empty filters array - Equivalent to no filters, searches entire project
  5. Case sensitivity - contains is case-insensitive, but startswith and endswith are case-sensitive
  6. Tags always use arrays - Even for single tag, use ["tag"] format with in or not_in