Search

The unified Search API queries across all content sources in a single request. Results are ranked by relevance using semantic embeddings via pgVector with automatic fallback to full-text search. Searches run in parallel across notes (Neo4j), channels (Supabase ilike), messages (Supabase full-text), and knowledge graph (Neo4j semantic).

Base path: /api/v2/search|Auth: JWT|Rate limit: 100 req/min

Unified Search

POST/api/v2/searchAuthenticated

Search across multiple content sources in parallel. Sources are searched concurrently and results are deduplicated, ranked by score, and returned as a unified list. Generates embeddings via pgVector for semantic search; falls back to full-text search if embedding generation fails.

Body Parameters

querystringrequired

The search query string. Must be less than 500 characters.

sourcesstring[]
Default: ["notes","channels","messages","knowledge"]

Content sources to search. Valid values: notes, channels, messages, knowledge.

filtersobject

Optional filters to narrow results. Supports dateRange, workspace, tags, and channelIds.

filters.dateRangestring

Time range filter. Presets: 1h, 24h, 7d, 30d. Also accepts ISO 8601 date strings.

filters.workspacestring (UUID)

Filter results to a specific workspace.

filters.tagsstring[]

Filter notes by tags.

filters.channelIdsstring[] (UUIDs)

Filter messages to specific channels.

useSemanticSearchboolean
Default: true

Enable semantic search via embeddings. Falls back to full-text if embedding generation fails.

limitnumber
Default: 20

Maximum total results to return across all sources.

Request

cURL
curl -X POST https://api.lvng.ai/api/v2/search \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "meeting notes from last week",
    "sources": ["notes", "channels", "messages", "knowledge"],
    "filters": {
      "dateRange": "7d",
      "workspace": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90"
    },
    "useSemanticSearch": true,
    "limit": 20
  }'

Response 200

{
  "query": "meeting notes from last week",
  "results": [
    {
      "id": "7b8c9d0e-1f2a-3b4c-5d6e-7f8a9b0c1d2e",
      "source": "notes",
      "type": "note",
      "title": "Weekly Team Meeting",
      "content": "Meeting content covering sprint progress, blockers, and action items for the engineering team...",
      "url": "/notes/7b8c9d0e-1f2a-3b4c-5d6e-7f8a9b0c1d2e",
      "score": 0.95,
      "metadata": {
        "created_at": "2026-03-14T10:00:00.000Z",
        "updated_at": "2026-03-14T10:45:00.000Z",
        "tags": ["meeting", "engineering"],
        "workspace": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90"
      }
    },
    {
      "id": "a2b3c4d5-e6f7-8901-abcd-ef2345678901",
      "source": "messages",
      "type": "message",
      "title": "Let's review the notes from Monday's meeting...",
      "content": "Let's review the notes from Monday's meeting before the standup. The main takeaway was shifting priority to the calendar integration...",
      "url": "/channels/c1d2e3f4-a5b6-7890-cdef-012345678901/messages/a2b3c4d5-e6f7-8901-abcd-ef2345678901",
      "score": 0.82,
      "metadata": {
        "created_at": "2026-03-15T09:30:00.000Z",
        "author": "8f3a2b1c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
        "channel_id": "c1d2e3f4-a5b6-7890-cdef-012345678901"
      }
    },
    {
      "id": "b3c4d5e6-f7a8-9012-bcde-f34567890123",
      "source": "channels",
      "type": "channel",
      "title": "weekly-meetings",
      "content": "Channel for weekly team meeting notes and follow-ups",
      "url": "/channels/b3c4d5e6-f7a8-9012-bcde-f34567890123",
      "score": 0.72,
      "metadata": {
        "created_at": "2026-01-10T08:00:00.000Z",
        "updated_at": "2026-03-18T14:00:00.000Z",
        "workspace": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
        "is_private": false
      }
    },
    {
      "id": "c4d5e6f7-a8b9-0123-cdef-456789012345",
      "source": "knowledge",
      "type": "concept",
      "title": "Meeting Best Practices",
      "content": "Guidelines for effective meetings including agenda preparation, note-taking standards, and action item tracking...",
      "url": "/knowledge/c4d5e6f7-a8b9-0123-cdef-456789012345",
      "score": 0.65,
      "metadata": {
        "created_at": "2026-02-20T11:00:00.000Z",
        "concepts": ["meetings", "productivity"],
        "document_type": "guideline"
      }
    }
  ],
  "total": 4,
  "sources": {
    "notes": 1,
    "messages": 1,
    "channels": 1,
    "knowledge": 1
  },
  "searchMethod": "semantic",
  "responseTime": 187
}