多商家 key,一次設定
建立 key 時選取一個或多個 Profile。同一個 Agent 可以在不同商家之間切換,不必管理多套憑證。
一組 Bearer key,跨多個 Profile 讀取、建立與更新知識文件。商家邊界、scope 與 key 權限在 API 層強制執行。
公開入口只開放 webhooks 與 /api/v1/open/*。管理 API 不在公開入口。
curl -fsS \
-H "Authorization: Bearer $CHATOLINO_API_KEY" \
https://chatolino.example.com/api/v1/open/me
{
"keyName": "Claude - All Businesses",
"scopes": ["knowledge:read", "knowledge:write"],
"profiles": [
{ "id": "uuid-a", "name": "Siam Studio" },
{ "id": "uuid-b", "name": "North Coffee" }
]
}Bearer API key
一把 key 對應多個商家
Read、write、delete 分開授權
建立時只顯示一次
你的 Agent 只需要知道自己要處理哪個商家、哪個分類,以及是否被允許寫入。其他邊界由 Chatolino 處理。
建立 key 時選取一個或多個 Profile。同一個 Agent 可以在不同商家之間切換,不必管理多套憑證。
Read 只能查詢,write 只能建立與更新,delete 需要另外授權。缺少 scope 時回傳403 insufficient_scope。
標題、Markdown 內容、分類與 tags 都是同一份資料。Agent 寫入後,客服回覆會直接使用最新的知識庫。
無效 key、已撤銷 key、scope 不足、商家不存在與 embedding 失敗都有固定 error code 與 HTTP status。
先在管理後台的 API access 頁面建立 key,選取 Profile 與 scope,再從這裡開始。
先呼叫 /me,確認 key 名稱、scope 與 Profile 清單,並把 profiles[].id 設為 PROFILE_ID。
export CHATOLINO_API_KEY='chk_live_xxx'
export PROFILE_ID='uuid'
curl -fsS \
-H "Authorization: Bearer $CHATOLINO_API_KEY" \
"https://chatolino.example.com/api/v1/open/me"分類 response 同時提供 id 與 key。Agent 建議使用 key。
curl -fsS \
-H "Authorization: Bearer $CHATOLINO_API_KEY" \
"https://chatolino.example.com/api/v1/open/profiles/$PROFILE_ID/knowledge/categories"需要 knowledge:write。title 或 body 變更時會重新計算 token 與 embedding。
curl -fsS -X POST \
-H "Authorization: Bearer $CHATOLINO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"退款政策","body":"七日內可申請退貨。","categoryKey":"refund","tags":["policy"]}' \
"https://chatolino.example.com/api/v1/open/profiles/$PROFILE_ID/knowledge/documents"所有路徑都接在 /api/v1/open 之後。文件格式與管理 API 相同。
| Method | Path | Scope | 用途 |
|---|---|---|---|
| GET | /me | key | 驗證 key,取得 scope 與 Profiles |
| GET | /profiles/{profileId}/knowledge/categories | knowledge:read | 列出七個固定分類 |
| GET | /profiles/{profileId}/knowledge/documents | knowledge:read | 列表,支援 category、tag、limit |
| POST | /profiles/{profileId}/knowledge/documents | knowledge:write | 建立文件,回傳 Location |
| GET | /profiles/{profileId}/knowledge/documents/{documentId} | knowledge:read | 讀取單一文件 |
| PATCH | /profiles/{profileId}/knowledge/documents/{documentId} | knowledge:write | 只更新有提交的欄位 |
| DELETE | /profiles/{profileId}/knowledge/documents/{documentId} | knowledge:delete | 刪除文件與向量 |
列表的 limit 範圍為 1 到 200。未提供時回傳全部符合文件。V1 尚未提供 cursor pagination。
Key 只接受 Authorization header,不接受 query string。撤銷後立即失效。
knowledge:readknowledge:writeknowledge:deleteRequest header
Authorization: Bearer chk_live_xxx
Content-Type: application/jsonKey 建立時只回傳一次明碼。之後只保留 prefix 與末四碼,無法再次查看。
所有錯誤都使用同一個 envelope,Agent 可以依 code 決定重試或轉人工。
{
"error": {
"code": "insufficient_scope",
"message": "The API key does not grant this scope.",
"requestId": "req_..."
}
}| HTTP | Code |
|---|---|
| 401 | invalid_api_key, api_key_revoked, api_key_expired |
| 403 | insufficient_scope |
| 404 | not_found |
| 422 | invalid_request, document_too_large |
| 502 | embedding_failed |
| 503 | embedding_not_configured |
API key 在 Chatolino 管理後台的 API access 頁面建立。選取 Profile 與 scope 後,就可以從/me 開始。