获取文档元数据
获取文档元数据
按文档 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 | 错误详情。 |
