Skip to main content
POST /openapi/memorylake/api/v1/projects/{id}/search
Searches across everything the project knows — both the ingested document content and the accumulated conversation memories — and returns the matches grouped by source. A single query surfaces the full picture, which is what you typically want in a chat assistant that grounds answers on documents and personalizes them with memories.
Items in documents and memories have the same shapes as Search Documents and Search Memories respectively — the relevant request knobs (top_n, threshold) carry the same meaning here.
Permission required: project:search · instance

Path Parameters

id
string
required
Project ID

Request Body

query
string
required
Natural-language search query. Used by both sub-searches.
user_id
string
required
User ID filter for the memory sub-search. Document search ignores this field.
top_n
integer
default:"10"
Maximum number of results to return, 1–1000. Applied to both document and memory matches — e.g. top_n=10 yields up to 10 documents and up to 10 memories.
threshold
number
default:"0.3"
Minimum similarity score for memory results. Scores below this are filtered out. Does not apply to documents.
with_conflicts
boolean
default:"false"
Include conflict info on memory results.
curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v1/projects/proj-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6/search' \
  -H 'Authorization: Bearer sk_xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "What were the quarterly sales figures in 2024?",
    "user_id": "user-abc123",
    "top_n": 10,
    "threshold": 0.3
  }'

Response

data
object
{
  "success": true,
  "message": "Operation completed successfully",
  "data": {
    "documents": [
      {
        "type": "paragraph",
        "document_id": "doc-123",
        "document_name": "report_2024.pdf",
        "paragraph_block_id": "blk-456",
        "highlight": {
          "chunks": [
            { "text": "Q1 2024 sales reached $2.5M...", "range": "p12" }
          ]
        },
        "source_document": { "file_name": "report_2024.pdf" }
      },
      {
        "type": "table",
        "document_id": "doc-789",
        "document_name": "sales_data.xlsx",
        "table_id": "tbl-001",
        "title": "Quarterly Sales Summary",
        "sheet_name": "Sheet1",
        "semantic_sheet_name": "2024 Quarterly Sales",
        "table_region_info": "A1:D50",
        "highlight": {
          "inner_tables": [
            {
              "id": "itbl-001",
              "data_range": "A1:D50",
              "num_rows": 49,
              "persist_path": "tables/doc-789/itbl-001",
              "columns": [
                {
                  "id": "col-1",
                  "name": "Quarter",
                  "data_type": "string",
                  "range": "A2:A50",
                  "count": 49,
                  "null_count": 0,
                  "approx_ndv": 4,
                  "examples": [{ "v": "Q1" }, { "v": "Q2" }],
                  "display_examples": [{ "v": "Q1" }, { "v": "Q2" }]
                },
                {
                  "id": "col-2",
                  "name": "Revenue",
                  "data_type": "number",
                  "range": "B2:B50",
                  "min_value": "1200000",
                  "max_value": "3100000"
                }
              ]
            }
          ]
        },
        "source_document": { "file_name": "sales_data.xlsx" }
      },
      {
        "type": "figure",
        "document_id": "doc-456",
        "document_name": "report_2024.pdf",
        "figure_id": 7,
        "highlight": {
          "figure": {
            "caption": "Figure 7. Quarterly revenue trend, 2024",
            "text": "Q1 $2.5M  Q2 $2.8M  Q3 $3.0M  Q4 $3.1M",
            "summary_text": "Bar chart showing steady quarterly revenue growth across 2024.",
            "prequestion_list": [
              "Which quarter had the highest revenue in 2024?",
              "What was the revenue trend across 2024?"
            ],
            "persist_path": "figures/doc-456/fig-7.png"
          }
        },
        "source_document": { "file_name": "report_2024.pdf" }
      }
    ],
    "memories": [
      {
        "id": "mem-123",
        "content": "User prefers Hangzhou cuisine restaurants",
        "user_id": "user-abc123",
        "expired": false,
        "has_unresolved_conflict": false,
        "created_at": "2024-01-15T10:00:00Z",
        "updated_at": "2024-01-15T10:00:00Z"
      }
    ]
  }
}
Either list can be empty if no matches cross the threshold. Treat documents and memories independently — they’re just two lookups returned together for convenience.