Skip to main content
POST
Search Knowledge Base
Use this API to run a semantic vector search over the content of your ingested knowledge base: the chunked, embedded text extracted from the files you’ve ingested. This is distinct from searching learned judgments (which search and ask read over). The endpoint is workspace-scoped.

Endpoint

POST https://api.velt.dev/v2/memory/knowledge/search

Headers

string
required
Your API key.
string
required

Body

Params

object
required

Example Requests

Search a single source

Search across multiple sources

Search the whole workspace knowledge base

Search chunks and extracted rules together

cURL

Response

Each result includes the matched sourceId, the result text, and, when vector search succeeds, a score: the cosine distance, where lower is more relevant. For the default chunk-only response, recordsSearched remains unchanged from the prior contract; when includeRules is true, it equals the number of returned items after merging and truncating to limit. When includeRules is omitted or false, the response is byte-identical to the prior contract: items have the shape { sourceId?, text, score? } with no kind, ruleId, or category keys.

Success Response

When includeRules is true, every item gains a kind field ("chunk" or "rule"). kind: "rule" items also include a ruleId and an optional category; kind: "chunk" items carry no extra fields. Items are sorted ascending by score (cosine distance, lower is more relevant); recency-fallback items (returned when embedding fails) have no score and sort last. The endpoint embeds the query once, reuses that vector for both corpora, concatenates both result sets, deduplicates by the (kind, id) tuple, and truncates the merged list to limit. Here, recordsSearched equals the number of items returned after truncation. A rule hit’s ruleId corresponds to the id field on List Extracted Rules.

Success Response (includeRules: true)

Failure Response