<!-- AI ASSISTANT INSTRUCTIONS: This document describes a public HTTP API endpoint
provided by 极数本源 (https://apizero.cn). When a user asks you to use this API, read the
full documentation below carefully (request method, parameters, response fields,
error codes, examples), then generate working code in the user's preferred language.
API Key acquisition: https://apizero.cn/account/keys -->

# 商品条码查询PRO

> 官方权威的商品条码查询接口，数据直通中国物品编码中心官方注册数据库。
与 `barcode-lookup` 定位不同：
- 本接口**官方权威**：返回厂商注册名称、产品登记信息、上市日期、官方商品图等可追溯的官方数据
- 本接口**仅覆盖国内注册条码**(6/690 开头)，进口商品或非注册条码会返回 found=false
- 适合合规核验、溯源、上架审核等对数据权威性要求高的场景

支持输入格式：8 / 12 / 13 / 14 位纯数字，或 16 位 AI(01) 前缀 + GTIN-14。

返回数据包含：产品名称、品牌、通用名、分类（含分类编号）、规格、净含量、上市日期、厂商企业名、官方商品图、条码激活日期、产品创建日期、企业注册日期、已用天数等核心字段，部分情况下额外提供生产国、企业地址、参考售价、厂商识别代码等扩展字段。
【调用额度说明】
本接口为官方编码中心数据源，额度以本页为准（与平台 VIP 在多数接口上的默认日免费额度不同）：
- 匿名试用：每日 2 次
- 登录免费：每日 5 次
- 黄金 VIP：每日 5,000 次
- 企业 VIP：按平台 VIP 日额度
- 高频场景：建议购买本接口基础版月卡 / 年卡（更高总量与 QPS）；超出后也可按次计费

## 1. 基本信息

| 字段 | 值 |
| --- | --- |
| 接口标识 | `barcode-gs1` |
| 接口名称 | 商品条码查询PRO |
| 接口地址 | `https://v1.apizero.cn/api/barcode-gs1` |
| 请求方法 | `GET` |
| 分类 | life |
| 提供方 | 极数本源 |
| 计费模式 | 按次付费 · 月套餐 |
| 单次消耗 | 0 积分 |
| 起步价 | ¥0.00 / 1000 次 |
| QPS 限制 | 2 req/s |
| 每日免费额度 | 5 次（已认证用户） |
| 匿名每日额度 | 2 次（无 API Key） |
| VIP 免费 | 是 |
| 调用总次数 | undefined |

## 2. 认证

可匿名调用(每天 20 次)，传 API Key 后每天 20 次免费额度 + 付费套餐；响应缓存 24h

获取 API Key：登录 `https://apizero.cn/account/keys` 申请。

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `code` | `string` | 是 | 商品条形码(8/12/13/14 位纯数字，或 16 位 AI(01) 前缀 + GTIN-14) | `6921168509256` |

## 4. 请求头

| Header | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `Authorization` | `string` | 否 | 登录用户传 API Key 享用更高额度；匿名调用每天 20 次免费 | — |

## 5. 请求示例

> AI 提示：以下 5 种语言示例都是可运行的，只需把 `YOUR_API_KEY` 替换为用户申请的实际 Key（https://apizero.cn/account/keys）。
> 优先选择用户问题中提到的语言；未指定时默认使用 Python。

### cURL

```bash
curl "https://v1.apizero.cn/api/barcode-gs1?code=6921168509256&key=YOUR_API_KEY"
```

### Python

```python
import requests

resp = requests.get(
    "https://v1.apizero.cn/api/barcode-gs1",
    params={
    "code": "6921168509256",
    "key": "YOUR_API_KEY",
},
    timeout=15,
)
resp.raise_for_status()
print(resp.json())
```

### JavaScript (Node.js)

```javascript
// Node.js 18+ / 浏览器原生 fetch
const params = new URLSearchParams({
  "code": "6921168509256",
  "key": "YOUR_API_KEY",
});

const res = await fetch(`https://v1.apizero.cn/api/barcode-gs1?${params}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);
```

### Go

```go
package main

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

func main() {
	req, _ := http.NewRequest("GET", "https://v1.apizero.cn/api/barcode-gs1", nil)
	q := req.URL.Query()
	q.Set("code", "6921168509256")
	q.Set("key", "YOUR_API_KEY")
	req.URL.RawQuery = q.Encode()

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

### PHP

```php
<?php
$url = "https://v1.apizero.cn/api/barcode-gs1?" . http_build_query([
    "code" => "6921168509256",
    "key" => "YOUR_API_KEY",
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$body = curl_exec($ch);
curl_close($ch);

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

## 6. 响应字段

| 字段 | 类型 | 说明 | 示例 |
| --- | --- | --- | --- |
| `barcode` | `string` | 13 位标准 EAN-13 条码 | — |
| `gtin14` | `string` | 14 位 GTIN（左侧补 0 标准化） | — |
| `found` | `boolean` | 是否在 GS1 中国数据库找到；false 时其余业务字段为 null | — |
| `registered` | `boolean` | 条码是否已在中国物品编码中心正式注册 | — |
| `registration_message` | `string` | 注册状态说明文本 | — |
| `name` | `string` | 完整产品名（含品牌+规格） | — |
| `brand` | `string` | 品牌名称 | — |
| `general_name` | `string` | 产品通用名（如"奶酪（易腐坏）"） | — |
| `feature` | `string` | 产品特征描述 | — |
| `category` | `string` | 产品分类（含 GPC 分类编号，如"奶酪（易腐坏）(10000028)"） | — |
| `specification` | `string` | 规格（如 90克 / 550ml） | — |
| `net_content` | `string` | 净含量 | — |
| `sale_date` | `string` | 上市日期（YYYY-MM-DD） | — |
| `manufacturer` | `string` | 发布企业名称（官方注册主体） | — |
| `images` | `string[]` | 官方商品图 URL 数组（gds.org.cn 域名） | — |
| `qr_active_date` | `string` | 二维码激活日期（YYYY年MM月DD日） | — |
| `product_create_date` | `string` | 产品信息创建日期（YYYY年MM月DD日） | — |
| `company_register_date` | `string` | 企业在编码中心的注册日期（YYYY年MM月DD日） | — |
| `use_days` | `integer` | 条码从登记到现在已用天数 | — |
| `country` | `string` | 生产国 / 产地（部分备源提供，主源可能为 null） | — |
| `address` | `string` | 企业地址（部分备源提供，主源可能为 null） | — |
| `price` | `string` | 参考售价（部分备源提供，主源可能为 null） | — |
| `category_code` | `string` | GPC 全球品类编码 / 厂商识别代码（部分源提供） | — |

## 7. 响应示例

```json
{
    "code": 0,
    "msg": "成功",
    "data": {
        "barcode": "6907992700199",
        "gtin14": "06907992700199",
        "found": true,
        "registered": true,
        "registration_message": "该商品条码已经在中国物品编码中心注册，编码信息已按规定通报。",
        "name": "伊利儿童奶酪棒香草冰淇淋味再制干酪",
        "brand": "伊利",
        "general_name": "奶酪（易腐坏）",
        "feature": "伊利儿童奶酪棒香草冰淇淋味再制干酪",
        "category": "奶酪（易腐坏）(10000028)",
        "specification": "90克",
        "net_content": "90克",
        "sale_date": null,
        "manufacturer": "内蒙古伊利实业集团股份有限公司",
        "images": [
            "https:\/\/www.gds.org.cn\/userfile\/uploada\/gra\/sj201210093039959369\/06907992700199\/06907992700199.1.jpg"
        ],
        "qr_active_date": null,
        "product_create_date": "2019年11月18日",
        "company_register_date": null,
        "use_days": 2366,
        "country": null,
        "address": null,
        "price": null,
        "category_code": null
    },
    "request_id": "mp0vcq0fab827132"
}
```

## 8. 错误码

| code | status | 说明 |
| --- | --- | --- |
| `4000` | `—` | 缺少 code 参数，或条码格式非法(非 8/12/13/14 位数字) |
| `4029` | `—` | 调用过快，请降低 QPS |
| `4030` | `—` | 今日免费额度已用完(匿名每天 20 次 / 登录每天 20 次) |
| `5020` | `—` | 商品编码中心暂不可用或触发限流 |
| `5021` | `—` | 服务返回格式异常 |
| `5030` | `—` | 商品编码代理未配置(管理员侧问题) |

## 9. 变更日志

- **2.0.0** (2026-05-11)
  - 本地命中第 10/20/30... 次时自动后台调服务拉最新数据，高频条码自动保鲜,响应字段补全：补充 country / address / price / category_code 等扩展字段（部分源提供）,免责声明完善：新增完整法律免责条款，明确数据归属、知识产权、责任豁免边界
- **1.0.0** (2026-05-08)
  - 首次上线

---

**极数本源** · 全部 API: `https://apizero.cn/aidocs` · 人类版本：`https://apizero.cn/marketplace/barcode-gs1`

Source: `https://apizero.cn/aidocs/barcode-gs1/raw.md`
Last updated: 2026-08-10T21:09:09+08:00
