Skip to main content
POST
/
v2
/
memory
/
knowledge
/
search
Search Knowledge Base
curl --request POST \
  --url https://api.velt.dev/v2/memory/knowledge/search \
  --header 'Content-Type: application/json' \
  --header 'x-velt-api-key: <x-velt-api-key>' \
  --header 'x-velt-auth-token: <x-velt-auth-token>' \
  --data '
{
  "data": {
    "query": "<string>",
    "sourceId": [
      "<string>"
    ],
    "limit": 123
  }
}
'
{
  "result": {
    "results": [
      {
        "sourceId": "src_9a8...",
        "text": "Always cite a peer-reviewed source...",
        "score": 0.18
      }
    ],
    "recordsSearched": 1
  }
}
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

x-velt-api-key
string
required
Your API key.
x-velt-auth-token
string
required

Body

Params

data
object
required

Example Requests

Search a single source

{
  "data": {
    "query": "citation policy",
    "sourceId": "src_9a8...",
    "limit": 10
  }
}

Search across multiple sources

{
  "data": {
    "query": "citation policy",
    "sourceId": ["src_9a8...", "src_2b1..."],
    "limit": 10
  }
}

Search the whole workspace knowledge base

{
  "data": {
    "query": "citation policy",
    "limit": 10
  }
}

Response

Each result includes the matched sourceId, the chunk text, and a score: the cosine distance, where lower is more relevant. recordsSearched reports how many sources were queried.

Success Response

{
  "result": {
    "results": [
      {
        "sourceId": "src_9a8...",
        "text": "Always cite a peer-reviewed source...",
        "score": 0.18
      }
    ],
    "recordsSearched": 1
  }
}

Failure Response

{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
{
  "result": {
    "results": [
      {
        "sourceId": "src_9a8...",
        "text": "Always cite a peer-reviewed source...",
        "score": 0.18
      }
    ],
    "recordsSearched": 1
  }
}