---
title: "Search context documents"
method: GET
path: "/api/v1/context/search"
tags: ["Context"]
---

# Search context documents

`GET /api/v1/context/search`

## Request

- Base URL: `https://app.khotan.com`
- URL: `https://app.khotan.com/api/v1/context/search`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Hybrid semantic + full-text search over the organization's active context documents, reranked for relevance. Returns the best passage from each matching document, with its slug, title, kind, and a relevance score. Use the slug to fetch the full markdown when a passage is insufficient.

## Query parameters

- `q` string, required: Natural-language search query. Retrieval is hybrid: semantic vector similarity over document passages combined with weighted full-text search, then reranked.
- `k` integer: Maximum number of snippets to return (1-50; default 10).
- `kind` 'instructions' | 'knowledge' | 'record': "instructions" = procedures to follow (SOPs, runbooks); "knowledge" = reference material (specs, policies); "record" = accounts of events (meeting notes, transcripts, interviews).

## Response `200`

Ranked snippets, most relevant first.

- object
  - `results` object[], required
    - `slug` string, required: Source document slug; fetch its full markdown by slug.
    - `title` string, required
    - `kind` 'instructions' | 'knowledge' | 'record', required
    - `chunkIndex` integer, required: Position of the passage within the document.
    - `content` string, required: The matching passage text.
    - `score` number, required: Relevance score; higher is more relevant. The reranker's score from 0 to 1, or the Reciprocal Rank Fusion score when reranking is unavailable.

## Other responses

- `400`: The request was malformed or failed validation.
- `401`: Authentication is missing or invalid.
- `429`: Too many requests; retry after the indicated delay.

---

[API](https://skmtc.dev/khotan/apis/khotan-api.md) - [All operations](https://skmtc.dev/khotan/apis/khotan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/khotan/apis/khotan-api/revisions/90b512a53e42?raw)
