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

# 查詢區塊

> 在知識庫上進行語意搜尋

## 請求

```bash theme={null}
GET https://api.pathors.com/v1/projects/{projectId}/knowledgebases/{knowledgebaseId}/query
```

### 路徑參數

<ParamField path="projectId" type="string" required>專案 ID</ParamField>
<ParamField path="knowledgebaseId" type="string" required>要查詢的知識庫 ID</ParamField>

### 標頭

<ParamField header="Authorization" type="string" required>
  使用您的 Developer Key 進行 Bearer 令牌認證
</ParamField>

### 查詢參數

<ParamField query="q" type="string" required>搜尋查詢字串</ParamField>
<ParamField query="topK" type="number">回傳結果的最大數量。預設為 `5`。</ParamField>
<ParamField query="scoreThreshold" type="number">區塊納入結果所需的最低相關性分數（0–1）。預設為 `0.3`。</ParamField>

## 回應

回傳依相關性排序的區塊陣列。

<ResponseField name="id" type="string">區塊的唯一識別符</ResponseField>
<ResponseField name="content" type="string">區塊的文字內容</ResponseField>
<ResponseField name="contentLength" type="number">區塊內容的字元長度</ResponseField>
<ResponseField name="isEnabled" type="boolean">該區塊是否參與搜尋</ResponseField>

### 範例

```bash theme={null}
curl "https://api.pathors.com/v1/projects/{projectId}/knowledgebases/kb_abc123/query?q=search_term&topK=5&scoreThreshold=0.3" \
  -H "Authorization: Bearer dk_your_key"
```

```json theme={null}
[
  {
    "id": "chunk_abc123",
    "content": "The product features include real-time analytics...",
    "contentLength": 82,
    "isEnabled": true
  }
]
```
