> ## Documentation Index
> Fetch the complete documentation index at: https://studio.chat-atp.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search a knowledge base

> Retrieve relevant chunks for a query

<ParamField path="knowledge_base_id" type="string" required>
  Knowledge base ID.
</ParamField>

<ParamField body="query" type="string" required>
  Search query.
</ParamField>

<ParamField body="top_k" type="integer">
  Number of chunks to return. Defaults to `5`.
</ParamField>

## SDK

<CodeGroup>
  ```typescript TypeScript theme={null}
  const result = await client.knowledgeBases.search(id, "How do I reset my password?", 5);
  ```

  ```python Python theme={null}
  result = await client.knowledge_bases.search(knowledge_base_id, "How do I reset my password?", top_k=5)
  ```
</CodeGroup>
