正在启动平台

食品经营许可证识别food-license

上传食品经营许可证图片(URL 或 base64),自动识别证件字段,包括许可证编号、经营者名称、法定代表人、经营场所、主体业态、经营项目、有效期等共 13 个字段。适用于企业资质审核、供应链合规验证等场景。

1. 基本信息

接口地址https://v1.apizero.cn/api/food-license
请求方法POST
分类ocrdata
提供方极数本源
计费模式免费试用
单次消耗0 积分
起步价
QPS 限制2 req/s
每日免费额度200 次(已认证用户)
匿名每日额度50 次(无 API Key)
VIP 免费
调用次数

2. 认证

携带 X-Api-Key 请求头可获得更高调用频度和更快速率

获取 API Key:登录 https://apizero.cn/account/keys

3. 请求参数

参数名类型必填说明示例
keystringAPI 密钥(Bearer 令牌或 key 参数)
input_typestring图片传入方式:url(图片链接)或 base64(base64 编码字符串)
input_datastring图片 URL 地址(input_type=url)或 base64 编码字符串(input_type=base64,最大 5 MB)

4. 请求头

Header类型必填说明示例
Content-Typestringapplication/json

5. 请求示例

以下 5 种语言示例都是可直接运行的,只需把 YOUR_API_KEY 替换为实际 Key。

cURL

curl -X POST "https://v1.apizero.cn/api/food-license" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "<key>",
  "input_type": "<input_type>",
  "input_data": "<input_data>"
}'

Python

import requests

resp = requests.request(
    "POST",
    "https://v1.apizero.cn/api/food-license",
    headers={"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
    json={
    "key": "<key>",
    "input_type": "<input_type>",
    "input_data": "<input_data>",
},
    timeout=15,
)
resp.raise_for_status()
print(resp.json())

JavaScript (Node.js)

// Node.js 18+ / 浏览器原生 fetch
const res = await fetch("https://v1.apizero.cn/api/food-license", {
  method: "POST",
  headers: {
    "X-Api-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "key": "<key>",
    "input_type": "<input_type>",
    "input_data": "<input_data>"
  }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);

Go

package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	body := []byte(`{"key":"<key>","input_type":"<input_type>","input_data":"<input_data>"}`)
	req, _ := http.NewRequest("POST", "https://v1.apizero.cn/api/food-license", bytes.NewBuffer(body))
	req.Header.Set("X-Api-Key", "YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	out, _ := io.ReadAll(resp.Body)
	fmt.Println(string(out))
}

PHP

<?php
$payload = json_encode([
    "key" => "<key>",
    "input_type" => "<input_type>",
    "input_data" => "<input_data>",
], JSON_UNESCAPED_UNICODE);

$ch = curl_init("https://v1.apizero.cn/api/food-license");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => "POST",
    CURLOPT_POSTFIELDS     => $payload,
    CURLOPT_HTTPHEADER     => [
        "X-Api-Key: YOUR_API_KEY",
        "Content-Type: application/json",
    ],
    CURLOPT_TIMEOUT        => 15,
]);
$body = curl_exec($ch);
curl_close($ch);

$data = json_decode($body, true);
print_r($data);

6. 响应字段

字段类型说明示例
codeinteger0=成功,非 0=失败
messagestring结果描述
data.license_numberstring|null许可证编号
data.operatorstring|null经营者名称(单位或个人)
data.legal_representativestring|null法定代表人(负责人)姓名
data.premisestring|null经营场所详细地址
data.main_bodystring|null主体业态(如餐饮服务经营者、食品销售经营者)
data.operating_itemstring|null经营项目(如热食类食品制售、预包装食品销售)
data.validity_periodstring|null有效期(如"长期"或"2025年01月01日至2030年12月31日")
data.domicilestring|null住所(法人或负责人注册地址)
data.issuing_authoritystring|null签发机关(如"XX市XX区市场监督管理局")
data.issuerstring|null签发人姓名
data.daily_supervisorstring|null日常监督管理人员姓名
data.daily_supervisory_authoritiesstring|null日常监督管理机构名称
data.complaints_hotlinestring|null投诉举报电话(通常为 12315)

7. 响应示例

{"code":0,"message":"success","data":{"license_number":"JY14012800001234","operator":"某某餐饮有限公司","legal_representative":"张三","premise":"北京市朝阳区某街道1号","main_body":"餐饮服务经营者","operating_item":"热食类食品制售","validity_period":"长期","domicile":"北京市朝阳区某街道1号","issuing_authority":"北京市朝阳区市场监督管理局","issuer":"李四","daily_supervisor":"王五","daily_supervisory_authorities":"北京市朝阳区市场监督管理局","complaints_hotline":"12315"}}

8. 错误码

codestatus说明
4000VALIDATION_ERROR参数缺失或格式错误,如 input_type 不是 url/base64,或 input_data 为空/无效 URL
5001UPSTREAM_ERROROCR 上游服务不可用(网络或 HTTP 非 200)
5002UPSTREAM_INVALID上游返回格式异常或识别失败,常见原因:图片非有效食品经营许可证、图片模糊/倾斜过大
5003UPSTREAM_MISSINGOCR 服务未配置或 API 密钥无效/未订阅,请联系平台管理员

9. 变更日志

  • v1.0(2026-06-01)
    • 上线食品经营许可证识别接口,支持 URL 和 base64 两种图片传入方式,识别并返回 13 个证件字段,结果缓存 7 天