https://api.qingyangzhichuang.comAPI-KEY 进行认证。POST/ocrX-Auth-Key 请求头multipart/form-dataapplication/json 或 application/x-www-form-urlencoded| 参数名 | 类型 | 必需 | 示例值 | 位置 | 说明 |
|---|---|---|---|---|---|
| X-Auth-Key | string | 是 | your-auth-key | Header | 接口认证密钥 |
| file | file | 否 | @/path/to/idcard.jpg | multipart/form-data | 上传的图片(jpg/png)或 PDF 文件,最大 10MB。与 file_url 二选一 |
| file_url | string | 否 | https://example.com/idcard.jpg | Body | 要识别的文件 URL。支持远程 HTTP URL 及本地文件路径。与 file 二选一 |
| category | string | 否 | 身份证 | Body | 证件类型筛选。支持精确匹配和泛分类。不传则自动检测分类 |
| 参数名 | 类型 | 说明 |
|---|---|---|
| success | boolean | 请求是否成功 |
| cardType | string | 识别出的证件类型中文名,多个以逗号分隔;未识别时返回"未知" |
| tokensIn | integer | 模型输入 token 消耗量 |
| tokensOut | integer | 模型输出 token 消耗量 |
| result | array | 识别结果数组,每个元素为一个识别到的文档对象 |
| result[].type | string | 文档类型中文名 |
| rawResult | string | 原始识别结果(预留字段) |
| filePath | string | 请求中的文件路径或 URL |
| fileName | string | 文件名 |
{
"success": true,
"cardType": "身份证正面",
"tokensIn": 1523,
"tokensOut": 89,
"result": [
{
"type": "身份证正面",
"name": "张三",
"gender": "男",
"ethnicity": "汉",
"birth_date": "1990-01-01",
"address": "北京市朝阳区XX路XX号",
"id_number": "110101199001011234"
}
],
"rawResult": "",
"filePath": "/path/to/idcard.jpg",
"fileName": "idcard.jpg"
}注意: result[]中的具体字段根据识别出的证件类型动态变化,各证件类型返回的实体字段详见下方 各证件类型返回字段。
error 字段说明错误原因。| 参数名 | 类型 | 说明 |
|---|---|---|
| error | string | 错误描述信息,仅错误时返回 |
| 状态码 | 说明 |
|---|---|
| 200 | 请求成功 |
| 400 | 缺少必要参数 file 或 file_url |
| 401 | 缺少 X-Auth-Key 请求头 |
| 403 | X-Auth-Key 认证密钥无效 |
| 413 | 上传文件大小超过 10MB 限制 |
| 500 | 服务内部处理错误 |
{
"error": "Missing X-Auth-Key header"
}{
"error": "Invalid auth key"
}{
"success": false,
"cardType": "",
"tokensIn": 0,
"tokensOut": 0,
"result": [],
"rawResult": "",
"filePath": "",
"fileName": "",
"error": "Missing required parameter: file or file_url"
}{
"success": false,
"cardType": "",
"tokensIn": 0,
"tokensOut": 0,
"result": [],
"rawResult": "",
"filePath": "",
"fileName": "",
"error": "File size exceeds maximum limit of 10MB"
}{
"success": false,
"cardType": "",
"tokensIn": 0,
"tokensOut": 0,
"result": [],
"rawResult": "",
"filePath": "https://example.com/idcard.jpg",
"fileName": "idcard.jpg",
"error": "具体错误信息"
}| 一级分类 | 证件类型 | card_type_en |
|---|---|---|
| 身份证 | 身份证正面 | idcard_front |
| 身份证 | 身份证背面 | idcard_back |
| 行驶证 | 行驶证正面 | driver_license_front |
| 行驶证 | 行驶证背面 | driver_license_back |
| 驾驶证 | 驾驶证正面 | vehicle_license_front |
| 驾驶证 | 驾驶证背面 | vehicle_license_back |
| 驾驶证 | 电子驾驶证 | vehicle_license_electronic |
| 护照 | 护照 | passport |
| 户口本 | 户口本 | household |
| 银行卡 | 银行卡 | bank_card |
| 营业执照 | 营业执照 | business_license |
| 结婚证 | 结婚证 | marriage_cert |
| 离婚证 | 离婚证 | divorce_cert |
| 军官证 | 军官证 | army_cert |
| 社保卡 | 社保卡 | social_card |
| 出生医学证明 | 出生医学证明 | bornmedical_cert |
| 车辆登记证 | 车辆登记证 | vehicle_registration |
| 车辆合格证 | 车辆合格证 | vehicle_conformity_cert |
| 车辆货物进口证明书 |