API 總覽
API Overview

API 共有 10 個路由器、42 個端點。/api/v1/* 下的所有端點均需 X-API-Key 認證。

The API has 10 routers and 42 endpoints. All endpoints under /api/v1/* require X-API-Key authentication.

端點總覽
Endpoints Summary

健康檢查
Health Check

Method Path Auth 說明 / Description
GET /health No 伺服器健康檢查
Server health check

QA 知識庫 — 4 個端點
QA Knowledge Base — 4 endpoints

Method Path 說明 / Description
GET /api/v1/qa 列出 Q&A 項目(分頁、可篩選)
List Q&A items (paginated, filterable)
GET /api/v1/qa/{id} 取得單筆 Q&A 詳細資料
Get single Q&A detail
GET /api/v1/qa/categories 列出所有分類
List all categories
GET /api/v1/qa/collections 列出所有來源 Collection
List all source collections

QA 篩選參數 / QA Filters:

搜尋 — 1 個端點
Search — 1 endpoint

Method Path 說明 / Description
POST /api/v1/search 混合語意 + 關鍵字搜尋
Hybrid semantic + keyword search

請求 Body / Request body:

{
  "query": "How to optimize Core Web Vitals?",
  "top_k": 5,
  "category": "Technical SEO"
}

對話 — 1 個端點
Chat — 1 endpoint

Method Path 說明 / Description
POST /api/v1/chat 單輪 RAG 對話(支援 Agent 模式)
Single-turn RAG chat (supports agent mode)

請求 Body / Request body:

{
  "message": "What is canonical URL?",
  "history": [],
  "mode": "rag"
}

對話管理 — 5 個端點
Sessions — 5 endpoints

Method Path 說明 / Description
GET /api/v1/sessions 列出所有對話
List all sessions
GET /api/v1/sessions/{id} 取得 Session 及訊息歷史
Get session with message history
POST /api/v1/sessions 建立新對話 Session
Create new chat session
POST /api/v1/sessions/{id}/messages 在 Session 中發送訊息
Send message in session
DELETE /api/v1/sessions/{id} 刪除 Session
Delete session

週報 — 3 個端點
Reports — 3 endpoints

Method Path 說明 / Description
GET /api/v1/reports 列出所有週報
List all weekly reports
GET /api/v1/reports/{date} 依日期取得週報(YYYYMMDD)
Get report by date (YYYYMMDD)
POST /api/v1/reports/generate 生成新週報
Generate new report

回饋 — 1 個端點
Feedback — 1 endpoint

Method Path 說明 / Description
POST /api/v1/feedback 提交搜尋/對話回饋
Submit feedback on search/chat responses

同義詞 — 4 個端點
Synonyms — 4 endpoints

Method Path 說明 / Description
GET /api/v1/synonyms 列出所有同義詞(靜態 + 自訂)
List all synonyms (static + custom)
POST /api/v1/synonyms 新增自訂同義詞
Add custom synonym
PUT /api/v1/synonyms/{term} 更新自訂同義詞
Update custom synonym
DELETE /api/v1/synonyms/{term} 刪除自訂同義詞
Delete custom synonym

Pipeline 管理 — 18 個端點
Pipeline — 18 endpoints

Method Path 說明 / Description
GET /api/v1/pipeline/status Pipeline 步驟完成狀態
Pipeline step completion status
GET /api/v1/pipeline/meetings 列出會議(含 Metadata)
List meetings with metadata
GET /api/v1/pipeline/meetings/{id}/preview 會議 Markdown 預覽
Meeting markdown preview
GET /api/v1/pipeline/source-docs 列出所有來源文件
List all source documents
GET /api/v1/pipeline/source-docs/{collection}/{file}/preview 文件預覽
Document preview
GET /api/v1/pipeline/unprocessed 列出待處理文件
List unprocessed documents
GET /api/v1/pipeline/logs 擷取歷史日誌
Fetch history logs
POST /api/v1/pipeline/fetch 觸發 Notion 增量擷取
Trigger Notion incremental fetch
POST /api/v1/pipeline/fetch-articles 觸發文章擷取
Trigger article fetch
POST /api/v1/pipeline/extract-qa 觸發 Q&A 萃取
Trigger Q&A extraction
POST /api/v1/pipeline/dedupe-classify 觸發去重 + 分類
Trigger dedup + classification
POST /api/v1/pipeline/metrics 從 Google Sheets 解析 SEO 指標
Parse SEO metrics from Google Sheets
POST /api/v1/pipeline/metrics/save 儲存指標快照
Save metrics snapshot
GET /api/v1/pipeline/metrics/snapshots 列出指標快照清單
List metrics snapshots
DELETE /api/v1/pipeline/metrics/snapshots/{id} 刪除指定快照
Delete snapshot
GET /api/v1/pipeline/metrics/trends 時間序列異常偵測
Timeseries anomaly detection
GET /api/v1/pipeline/llm-usage LLM 成本與延遲監控
LLM cost/latency monitoring
POST /api/v1/pipeline/crawled-not-indexed 已檢索未索引路徑分析
Crawled-not-indexed analysis

會議準備 — 3 個端點
Meeting Prep — 3 endpoints

Method Path 說明 / Description
GET /api/v1/meeting-prep 列出所有會議準備報告
List all meeting prep reports
GET /api/v1/meeting-prep/maturity-trend SEO 成熟度趨勢時間序列
SEO maturity trend timeseries
GET /api/v1/meeting-prep/{date} 依日期取得會議準備報告
Get meeting prep report by date

回應格式
Response Format

所有 API 回應均遵循一致的 JSON 結構:

All API responses follow a consistent JSON structure:

{
  "data": { ... },
  "error": null,
  "meta": {
    "request_id": "uuid",
    "version": "3.4.0"
  }
}

錯誤回應
Error Responses

狀態碼 / Status 意義 / Meaning
400 無效請求(Zod 驗證失敗)
Invalid request (Zod validation failed)
401 缺少或無效的 API Key
Missing or invalid API key
404 資源不存在
Resource not found
429 超過速率限制
Rate limit exceeded
500 伺服器內部錯誤
Internal server error
{
  "error": "Validation failed",
  "details": "message: String must contain at least 1 character(s)"
}