取得文件元資料
取得文件元資料
依文件 ID 批次查詢文件上的元資料值,同時傳回 auto_metadata(系統自動填充,唯讀)與 metadata(自訂欄位值)。一次最多查詢 50 個文件。
請求方式
GET
呼叫位址
https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/detail
呼叫驗證
鑒權方式請參閱 API 總覽。
請求
請求範例
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/detail?doc_ids=doc_001,doc_002' \
-H 'Authorization: Bearer ${API Key}'
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/bot/doc/metadata/detail?doc_ids=doc_001,doc_002' \
-H 'Authorization: Bearer ${API Key}'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 描述 |
|---|---|---|
| Authorization | Bearer ${API Key} | 使用 Authorization: Bearer ${API Key} 進行驗證。請前往 API 金鑰頁面取得 API Key。 |
請求參數
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| doc_ids | String | 是 | 以逗號分隔的文件 ID,一次最多 50 個。所有文件都必須屬於目前 API Key 對應的 Agent;若任一文件不存在或不屬於目前 Agent,整個請求會失敗並傳回 one or more doc_ids do not exist or do not belong to the current bot。 |
回應
回應範例
{
"documents": [
{
"doc_id": "doc_001",
"auto_metadata": {
"document_name": "API 規範.pdf",
"upload_time": "2026-01-15T10:30:00Z"
},
"metadata": {
"category": "技術",
"priority": "P1"
}
}
]
}
{
"documents": [
{
"doc_id": "doc_001",
"auto_metadata": {
"document_name": "API 規範.pdf",
"upload_time": "2026-01-15T10:30:00Z"
},
"metadata": {
"category": "技術",
"priority": "P1"
}
}
]
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| documents | Array<Object> | 各文件的元資料;沒有元資料記錄的文件不會回傳。 |
| doc_id | String | 文件 ID。 |
| auto_metadata | Object | 系統自動填入的元資料(文件名稱/上傳時間/上傳者/來源等),唯讀。 |
| metadata | Object | 自訂元資料值,格式為「欄位名稱 → 值」。 |
失敗回應
| 欄位 | 類型 | 描述 |
|---|---|---|
| code | Integer | 錯誤碼。 |
| message | String | 錯誤詳情。 |
