1. 接口描述
接口请求域名: ocr.tencentcloudapi.com 。
用于查询文档处理任务。文档处理领域里常见的通用Agent 如抽取、比对之类的,目前我们提供的抽取,但未来可以根据实际情况和客户需求扩展。
默认接口请求频率限制:20次/秒。
推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。
2. 输入参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
Action | 是 | String | 公共参数,本接口取值:DescribeExtractDocAgentJob。 |
Version | 是 | String | 公共参数,本接口取值:2018-11-19。 |
Region | 否 | String | 公共参数,此参数为可选参数。 |
JobId | 否 | String | 任务唯一ID。由服务端生成。 示例值:1334797167793684480 |
3. 输出参数
参数名称 | 类型 | 描述 |
---|---|---|
Angle | Float | 图片旋转角度(角度制),文本的水平方向为 0;顺时针为正,逆时针为负。 示例值:1.0 |
StructuralList | Array of GroupInfo | 配置结构化文本信息。 |
ErrorCode | String | 任务执行错误码。当任务状态不为 FAIL 时,该值为""。 示例值:FailedOperation.PDFParseFailed |
ErrorMessage | String | 任务执行错误信息。当任务状态不为 FAIL 时,该值为""。 示例值:PDF解析失败。 |
JobStatus | String | 任务状态。WAIT:等待中,RUN:执行中,FAIL:任务失败,DONE:任务成功 示例值:DONE |
ThoughtContent | String | 思考过程 示例值:在本次任务中,首先,我们需要从文档中提取车型字段。接着,我定位到文档中所有类型为kv的段落。最终,找到了文档中最相关的kv信息 |
RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
4. 示例
示例1 调用失败示例
调用失败示例
输入示例
POST / HTTP/1.1
Host: ocr.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeExtractDocAgentJob
<公共请求参数>
{
"JobId": "1334797167793684480"
}
输出示例
{
"Response": {
"Error": {
"Code": "InvalidParameterValue.InvalidParameterValueLimit",
"Message": "JobId不存在。"
},
"RequestId": "b4074f5b-6773-4702-a4b1-bc719f9ce09b"
}
}
示例2 调用成功示例
调用成功示例
输入示例
POST / HTTP/1.1
Host: ocr.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeExtractDocAgentJob
<公共请求参数>
{
"JobId": "1337322230114697216"
}
输出示例
{
"Response": {
"Angle": 359.989990234375,
"ErrorCode": "",
"ErrorMessage": "",
"JobStatus": "DONE",
"RequestId": "a959eecb-1cb5-4f6e-a3c6-cf00a6e27ad9",
"StructuralList": [
{
"Groups": [
{
"Lines": [
{
"Key": {
"AutoName": "开航日",
"ConfigName": ""
},
"Value": {
"AutoContent": "2024-03-25",
"Coord": {
"LeftBottom": {
"X": 581,
"Y": 332
},
"LeftTop": {
"X": 581,
"Y": 310
},
"RightBottom": {
"X": 678,
"Y": 332
},
"RightTop": {
"X": 678,
"Y": 310
}
}
}
}
]
}
]
},
{
"Groups": [
{
"Lines": [
{
"Key": {
"AutoName": "项目",
"ConfigName": ""
},
"Value": {
"AutoContent": "舱单费",
"Coord": {
"LeftBottom": {
"X": 91,
"Y": 451
},
"LeftTop": {
"X": 91,
"Y": 427
},
"RightBottom": {
"X": 147,
"Y": 451
},
"RightTop": {
"X": 147,
"Y": 427
}
}
}
},
{
"Key": {
"AutoName": "费用名称",
"ConfigName": ""
},
"Value": {
"AutoContent": "150.00",
"Coord": {
"LeftBottom": {
"X": 304,
"Y": 450
},
"LeftTop": {
"X": 304,
"Y": 427
},
"RightBottom": {
"X": 364,
"Y": 450
},
"RightTop": {
"X": 364,
"Y": 427
}
}
}
},
{
"Key": {
"AutoName": "美金",
"ConfigName": ""
},
"Value": {
"AutoContent": "0.00",
"Coord": {
"LeftBottom": {
"X": 570,
"Y": 450
},
"LeftTop": {
"X": 570,
"Y": 427
},
"RightBottom": {
"X": 608,
"Y": 450
},
"RightTop": {
"X": 608,
"Y": 427
}
}
}
},
{
"Key": {
"AutoName": "欧元",
"ConfigName": ""
},
"Value": {
"AutoContent": "0.00",
"Coord": {
"LeftBottom": {
"X": 797,
"Y": 450
},
"LeftTop": {
"X": 797,
"Y": 427
},
"RightBottom": {
"X": 835,
"Y": 450
},
"RightTop": {
"X": 835,
"Y": 427
}
}
}
}
]
},
{
"Lines": [
{
"Key": {
"AutoName": "项目",
"ConfigName": ""
},
"Value": {
"AutoContent": "海运费",
"Coord": {
"LeftBottom": {
"X": 91,
"Y": 478
},
"LeftTop": {
"X": 91,
"Y": 456
},
"RightBottom": {
"X": 147,
"Y": 478
},
"RightTop": {
"X": 147,
"Y": 456
}
}
}
},
{
"Key": {
"AutoName": "费用名称",
"ConfigName": ""
},
"Value": {
"AutoContent": "12,300.00",
"Coord": {
"LeftBottom": {
"X": 570,
"Y": 477
},
"LeftTop": {
"X": 570,
"Y": 454
},
"RightBottom": {
"X": 654,
"Y": 477
},
"RightTop": {
"X": 654,
"Y": 454
}
}
}
},
{
"Key": {
"AutoName": "美金",
"ConfigName": ""
},
"Value": {
"AutoContent": "0.00",
"Coord": {
"LeftBottom": {
"X": 797,
"Y": 477
},
"LeftTop": {
"X": 797,
"Y": 453
},
"RightBottom": {
"X": 835,
"Y": 477
},
"RightTop": {
"X": 835,
"Y": 453
}
}
}
},
{
"Key": {
"AutoName": "欧元",
"ConfigName": ""
},
"Value": {
"AutoContent": "0.00",
"Coord": {
"LeftBottom": {
"X": 797,
"Y": 477
},
"LeftTop": {
"X": 797,
"Y": 453
},
"RightBottom": {
"X": 835,
"Y": 477
},
"RightTop": {
"X": 835,
"Y": 453
}
}
}
}
]
}
]
}
]
}
}
5. 开发者资源
腾讯云 API 平台
腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。
API Inspector
用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。
SDK
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
- Tencent Cloud SDK 3.0 for Python: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Java: GitHub, Gitee
- Tencent Cloud SDK 3.0 for PHP: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Go: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Node.js: GitHub, Gitee
- Tencent Cloud SDK 3.0 for .NET: GitHub, Gitee
- Tencent Cloud SDK 3.0 for C++: GitHub, Gitee
- Tencent Cloud SDK 3.0 for Ruby: GitHub, Gitee
命令行工具
6. 错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
错误码 | 描述 |
---|---|
FailedOperation.DownLoadError | 文件下载失败。 |
FailedOperation.ImageDecodeFailed | 图片解码失败。 |
FailedOperation.ImageSizeTooLarge | 图片尺寸过大,请参考输入参数中关于图片大小限制的说明。 |
FailedOperation.OcrFailed | OCR识别失败。 |
FailedOperation.PDFParseFailed | PDF解析失败。 |
FailedOperation.UnKnowError | 未知错误。 |
FailedOperation.UnKnowFileTypeError | 未知的文件类型。 |
FailedOperation.UnOpenError | 服务未开通。 |
InvalidParameterValue.InvalidParameterValueLimit | 参数值错误。 |
LimitExceeded.TooLargeFileError | 文件内容太大。 |
ResourceUnavailable.InArrears | 账号已欠费。 |
ResourceUnavailable.ResourcePackageRunOut | 账号资源包耗尽。 |
ResourcesSoldOut.ChargeStatusException | 计费状态异常。 |