Levain LabsLevain Labs
ApiWikis

Search Wiki

Search knowledge-base pages.

Search knowledge-base pages.

Semantic mode needs the knowledge base's semantic index, which is rebuilt on every maintainer run; pages saved or deleted through this API update it as they land, so they are searchable right away. Until an index exists the response falls back to keyword results and says so in warning. Filters apply in both modes, and every hit carries the page's front matter.

GET
/api/v1/wikis/{wiki_id}/search

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

wiki_id*Wiki Id
Formatuuid

Query Parameters

q*Q

Search query, up to 2000 characters; longer queries go through POST /api/v1/wikis/{wiki_id}/search.

Length1 <= length <= 2000
mode?Mode

lexical scores keyword matches (titles weighted); semantic ranks pages by meaning — better for topic-shaped queries.

Default"lexical"
Value in"lexical" | "semantic"
k?K

Maximum number of results.

Default20
Range1 <= value <= 100
filter?array<string>|

Frontmatter filter, repeatable. key=value matches a field exactly (or as a member of a list field); key>=value and key<=value are inclusive bounds, compared as numbers when both sides are numeric and as strings otherwise, which orders ISO dates — e.g. platform=linkedin and date>=2026-01-01. String bounds are exact, so date<=2026-08-01 excludes 2026-08-01T10:00:00Z; bound at the field's precision. A key takes one equality, or one bound per operator.

Header Parameters

X-API-Key?string|null

Response Body

application/json

application/json

curl -X GET "https://api.levainlabs.com/api/v1/wikis/497f6eca-6276-4993-bfeb-53cbbbba6f08/search?q=string"
{
  "mode": "lexical",
  "hits": [
    {
      "path": "string",
      "title": "string",
      "snippet": "string",
      "score": 0,
      "frontmatter": {
        "property1": "string",
        "property2": "string"
      }
    }
  ],
  "warning": "string"
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}