Skip to main content
POST /openapi/memorylake/api/v1/projects/{id}/documents/search
Performs semantic search over all documents in the project. Returns matched content ranked by relevance. Results are categorized into three types — table, paragraph, and figure — each identified by the type field.

Path Parameters

id
string
required
Project ID

Request Body

query
string
required
Search query text
top_n
integer
default:"10"
Maximum number of results to return (minimum 1)
curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v1/projects/proj-a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6/documents/search' \
  -H 'Authorization: Bearer sk_xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "What were the quarterly sales figures in 2024?",
    "top_n": 10
  }'

Response

data
object
{
  "success": true,
  "data": {
    "count": 3,
    "results": [
      {
        "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",
        "table_region_info": "A1:D50",
        "highlight": {
          "inner_tables": [...]
        },
        "source_document": {
          "file_name": "sales_data.xlsx"
        }
      }
    ]
  }
}