阅读约 2 分钟第 9 / 15 篇
POST /api/vendor/invoice-recognize 中转百度智能云 OCR 的「智能财务票据识别」接口,上传票据图片/PDF/OFD,返回结构化票据字段。
⚠️ 该接口为中转接口,不支持匿名请求,调用前需在请求头携带
Authorization: Bearer <API Key>。
POST https://wwcai.cn/api/vendor/invoice-recognize
Content-Type: application/json
Authorization: Bearer <your_api_key>请求体需提供以下字段之一:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image | string | 四选一 | 票据图片 base64(不含 data: 前缀) |
| url | string | 四选一 | 票据图片的公开可访问 URL |
| pdf_file | string | 四选一 | PDF 文件 base64 |
| ofd_file | string | 四选一 | OFD 文件 base64 |
{
"words_result": {
"InvoiceType": "增值税电子普通发票",
"InvoiceNum": "244120000007865317",
"TotalAmount": "307.52"
},
"log_id": 1234567890
}| 字段 | 类型 | 说明 |
|---|---|---|
| words_result | object | 识别出的票据结构化字段(发票代码、号码、金额、购销方信息等) |
| log_id | integer | 百度请求追踪 ID |
curl -X POST "https://wwcai.cn/api/vendor/invoice-recognize" -H "Authorization: Bearer <your_api_key>" -H "Content-Type: application/json" -d '{"url":"https://example.com/invoice.jpg"}'import requests
resp = requests.post(
"https://wwcai.cn/api/vendor/invoice-recognize",
headers={"Authorization": "Bearer <your_api_key>"},
json={"url": "https://example.com/invoice.jpg"},
)
print(resp.json())const resp = await fetch("https://wwcai.cn/api/vendor/invoice-recognize", {
method: "POST",
headers: { Authorization: "Bearer <your_api_key>", "Content-Type": "application/json" },
body: JSON.stringify({ url: "https://example.com/invoice.jpg" }),
});
console.log(await resp.json());| 状态码 | 说明 |
|---|---|
| 400 | 必须提供 image / url / pdf_file / ofd_file 中的一个 |
| 401 | 未携带或无效的 API Key |
| 402 | 该端点额度不足(按次扣减额度) |
| 429 | 超过每日配额 |
登录后发表评论。
暂无评论。来发表第一条吧。