Receipt OCR
收藏RapidAPI2026-04-01 更新2026-04-02 收录
下载链接:
https://rapidapi.com/colinjamesmcgraw/api/receipt-ocr1
下载链接
链接失效反馈官方服务:
资源简介:
Media Receipt OCR Extract structured JSON from receipt and invoice images via Tesseract OCR. Parse merchant, date, line items, totals, tax, payment method, and currency.
创建时间:
2026-04-01
原始信息汇总
Receipt OCR API 数据集概述
基本信息
- API名称: Receipt OCR
- 类别: Visual Recognition
- 提供商: Colin McGraw
- API地址: https://rapidapi.com/colinjamesmcgraw/api/receipt-ocr1
- 当前版本: v1
- 端点:
POST /api/receipt-ocr
功能描述
该API使用Tesseract OCR从收据和发票图像中提取文本,并通过智能解析识别和构建关键的财务信息。API处理Base64编码的图像,并返回包含所有提取数据的综合JSON对象。
核心特性
- 多格式日期解析: 自动检测6种常见日期格式并转换为ISO 8601。
- 行项目提取: 解析包含描述、数量和价格的单个项目。
- 财务摘要: 提取小计、税额和总金额。
- 支付方式检测: 识别支付方式(现金、信用卡、借记卡等)。
- 货币识别: 检测货币符号和代码。
- 置信度评分: 返回提取数据的置信度级别。
技术规格
请求
- 认证: 所有请求都需要
X-RapidAPI-Proxy-Secret请求头。 - 请求体格式: JSON
请求字段
| 字段 | 类型 | 必需 | 描述 |
|---|---|---|---|
image |
string | 是 | Base64编码的图像数据。接受数据URI前缀(例如 data:image/png;base64,),并会自动去除。最大10MB。 |
language |
string | 否 | Tesseract语言代码。默认值: eng。示例: spa, fra, deu |
includeRawText |
boolean | 否 | 如果为 true,则在响应中包含原始OCR文本。默认值: false |
响应
响应格式为JSON。
响应字段
| 字段 | 类型 | 描述 |
|---|---|---|
receipt |
object | 解析后的收据数据 |
confidence |
number | OCR置信度分数(0–100) |
rawText |
string | null |
processingTimeMs |
number | 总处理时间(毫秒) |
Receipt 对象字段
| 字段 | 类型 | 描述 |
|---|---|---|
merchantName |
string | null |
merchantAddress |
string | null |
date |
string | null |
time |
string | null |
items |
array | 收据上的行项目列表 |
subtotal |
number | null |
tax |
number | null |
total |
number | null |
paymentMethod |
string | null |
cardLastFour |
string | null |
Line Item 对象字段
| 字段 | 类型 | 描述 |
|---|---|---|
description |
string | 项目描述 |
quantity |
integer | 购买数量 |
unitPrice |
number | null |
totalPrice |
number | 该行项目的总价 |
支持的图像格式
| 格式 | MIME 类型 |
|---|---|
| JPEG | image/jpeg |
| PNG | image/png |
| TIFF | image/tiff |
| BMP | image/bmp |
| WebP | image/webp |
支持的语言
| 代码 | 语言 |
|---|---|
eng |
English (默认) |
spa |
Spanish |
fra |
French |
deu |
German |
ita |
Italian |
por |
Portuguese |
约束
| 约束 | 值 |
|---|---|
| 最大图像大小 | 10 MB |
| OCR引擎 | Tesseract 5 (OEM 3, PSM 6) |
| 处理方式 | 服务器端,内存中进行 |
| 数据保留 | 无 — 处理完成后图像即被丢弃 |
使用建议
- 图像质量: 更高分辨率的图像能产生更好的OCR结果。建议300 DPI或更高。
- 方向: 确保收据是正向的,没有旋转。倾斜的图像会降低准确性。
- 光照: 均匀的光照,无阴影或眩光,可提高文本识别率。
- 裁剪: 裁剪到收据边界,以减少背景噪音。
错误响应
| 状态码 | 条件 | 消息 |
|---|---|---|
| 400 | 缺少图像 | The image field is required and cannot be empty. |
| 400 | Base64无效 | Invalid base64-encoded image data. |
| 400 | 图像过大 | Image exceeds maximum allowed size of 10MB. |
| 400 | OCR失败 | Failed to process the receipt image. |
| 401 | 认证缺失或无效 | Unauthorized: Invalid or missing X-RapidAPI-Proxy-Secret header. |
应用场景
- 费用管理: 自动提取收据数据用于费用报告和报销。
- 簿记: 将收据解析为结构化行项目,用于会计软件。
- 税务准备: 将纸质收据数字化以跟踪税务抵扣。
- 零售分析: 大规模从收据图像中提取购买数据。



