post/api/v2/knowledge-sources/search

Search Knowledge Base chunks.

Searches locally indexed Knowledge Base chunks for Content Agent retrieval.

Requires bearer API key

Parameters

X-Project-Id

header

Required for organization-wide API keys on project-scoped endpoints. Project-scoped keys infer the project automatically.

Schema: string

Request Body

{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "query": {
      "type": "string"
    },
    "q": {
      "type": "string"
    },
    "limit": {
      "type": "integer"
    },
    "k": {
      "type": "integer"
    }
  }
}

Responses

200

Knowledge chunk search results.

application/json
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "chunks": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "sourceId": {
            "type": "string"
          },
          "sourceTitle": {
            "type": "string"
          },
          "sourceKind": {
            "type": "string",
            "enum": [
              "file",
              "url",
              "note"
            ]
          },
          "text": {
            "type": "string"
          },
          "tokenCount": {
            "type": "integer",
            "nullable": true
          },
          "score": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "sourceId",
          "sourceTitle",
          "sourceKind",
          "text",
          "score"
        ]
      }
    }
  },
  "required": [
    "chunks"
  ]
}
400

Error response.

application/json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  }
}

Try it

Send this request to the local WatchLLM REST handler. Use a key from `/workspace/api`; organization keys can include `X-Project-Id` only when the endpoint documents that header.