Search a knowledge base and get the best-matching passages, each with its page. No answer is written. Use chat when you want one.
POST https://app.kelu.dev/api/v1/public/knowledge-bases/:knowledgeBaseId/search
Auth: client key. Public keys also need a CAPTCHA token when CAPTCHA is on.

Request body

FieldTypeRequiredDescription
querystringYesWhat to search for. Max 4,000 characters
limitnumberNoMost results to return. Default 10, capped at 100
group_idsstring[]NoSearch only these source groups
widget_idstringNoA saved widget’s id. The request must pass that widget’s Enabled switch and Allowed origins, as a chat with widget_id does
curl https://app.kelu.dev/api/v1/public/knowledge-bases/KB_ID/search \
  -H "X-Client-Id: kl_ci_..." \
  -H "X-Client-Secret: kl_cs_..." \
  -H "Content-Type: application/json" \
  -d '{"query": "configure oauth", "limit": 5}'

Response

Abbreviated. chunk and document carry a few more fields than shown.
{
  "results": [
    {
      "chunk": {
        "id": "7c1e...",
        "document_id": "a4d2...",
        "content": "To configure OAuth, first register your application ...",
        "heading_path": ["Authentication", "OAuth"],
        "chunk_index": 3
      },
      "document": {
        "id": "a4d2...",
        "url": "https://docs.example.com/auth/oauth",
        "title": "OAuth Configuration",
        "visibility": "public",
        "source_type": "website"
      },
      "rrf_score": 0.031,
      "vector_score": 0.87,
      "text_score": 0.42,
      "rerank_score": 0.79
    }
  ],
  "count": 1,
  "powered_by": "Powered by Kelu",
  "powered_by_url": "https://kelu.dev"
}
  • chunk.content is the matching passage. chunk.heading_path is its section breadcrumb.
  • document is the page it belongs to. One page can appear more than once.
  • Results come in ranked order, most relevant first.
ScoreMeaning
rrf_scoreCombined rank of semantic and keyword search. Only compare it within one response
vector_scoreSemantic similarity, 0 to 1. Comparable across queries
text_scoreKeyword match strength, 0 to 1
rerank_scoreRelevance from the reranking model. Higher is more relevant. 0 when no reranker ran

Good to know

  • You can get fewer results than limit, or none, when nothing is relevant enough.
  • Restricted documents are never returned.
  • For a short “read next” list with one entry per page, use related articles.