<!-- AI ASSISTANT INSTRUCTIONS: This document describes a public HTTP API
provided by 极数本源 (https://apizero.cn). Prefer Authorization: Bearer.
Success is business code === 0 (do not treat HTTP 200 as success).
Generate working backend code; never put the API Key in a frontend or app.
API Key: https://apizero.cn/account/keys
Human docs: https://apizero.cn/aidocs/company-search -->

# 企业工商信息查询

按企业名称检索工商登记信息。默认每页 20 条，可通过 page、size 翻页，size 取值 1–20。同一检索条件在 24 小时内可能返回已留存结果。无法获取最新结果时，可能返回 30 日内留存结果，并在 data.notice 中注明；该结果不代表登记机关的当前登记状态。本接口现用于调用量统计，正式数据合作将随调用量增长另行安排。查询结果仅供参考，不得作为开户、授信或诉讼的唯一依据。

## 平台约定

- 网关：`https://v1.apizero.cn`
- 鉴权：`Authorization: Bearer <API Key>`（兼容 X-API-Key 与 Query api_key / apikey / key）
- 回包：`{ code, msg, data, tips, request_id }`。成功看 `code === 0`

## 1. 基本信息

| 字段 | 值 |
| --- | --- |
| 接口标识 | `company-search` |
| 接口名称 | 企业工商信息查询 |
| 接口地址 | `https://v1.apizero.cn/api/company-search` |
| 请求方法 | `GET` |
| 分类 | 身份核验 |
| 提供方 | 极数本源 |
| 计费模式 | 按次付费 · 点数包 · 月套餐 |
| QPS 限制 | QPS 2 |
| 登录免费额度 | 10 次 |
| 匿名每日额度 | 5 次 |

### 会员每日额度

| 会员档位 | 每日免费 | QPS |
| --- | --- | --- |
| 黄金会员 | 5,000 次/日 | QPS 10 |
| 钻石会员 | 10,000 次/日 | QPS 30 |
| 企业会员 | 企业接口额度 | QPS 120 |

## 2. 认证

匿名可调用：QPS 1、日 5 次（仅供试用）；登录后：QPS 2、日 10 次；黄金会员：QPS 10、日 5000 次；钻石会员：QPS 30、日 10000 次；企业会员：QPS 120、日 100000 次。批量查询请控制在QPS 120以内。

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

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `name` | `string` | 是 | 企业名称关键词，2~50 个字符（如「腾讯科技」「阿里巴巴」） | `` |
| `page` | `number` | 否 | 页码，从 1 起，默认 1 | `1` |
| `size` | `number` | 否 | 每页条数，1–20，默认 20 | `20` |

## 6. 响应字段

顶层固定 code / msg / data。下表一般是 data 内字段。

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `keyword` | `string` | 查询关键词回显 |
| `total` | `number` | 匹配总数。本页默认最多 20 条，用 page 翻页 |
| `list` | `array` | 本页企业列表，默认最多 20 条 |
| `list[].id` | `number` | 本页结果编号，只用于区分列表项，不是统一社会信用代码 |
| `list[].name` | `string` | 企业全称 |
| `list[].logo` | `string` | 企业 LOGO 图片 URL（可能为空） |
| `list[].english_name` | `string` | 英文名（可能为空） |
| `list[].history_names` | `string` | 曾用名（可能为空） |
| `list[].legal_person` | `string` | 法定代表人 |
| `list[].establish_time` | `string` | 成立日期 YYYY-MM-DD |
| `list[].reg_capital` | `string` | 注册资本（含币种，如「7000万人民币」） |
| `list[].reg_status` | `string` | 登记状态（存续 / 注销 / 吊销 等） |
| `list[].credit_code` | `string` | 统一社会信用代码（18 位） |
| `list[].business_scope` | `string` | 经营范围 |
| `list[].reg_location` | `string` | 注册地址 |
| `list[].phone` | `string` | 联系电话（取首项） |
| `list[].email` | `string` | 联系邮箱（取首项） |
| `list[].category` | `string` | 行业分类 |
| `list[].city` | `string` | 所在城市 |
| `list[].district` | `string` | 所在区/县 |
| `list[].company_org_type` | `string` | 企业类型（取首项，如「有限责任公司」） |
| `list[].match_field` | `string` | 匹配命中的字段（如「公司名称匹配」「股东信息」「历史名称」） |
| `notice` | `string` | 仅在返回已留存结果时出现，表示当前无法获取最新结果，不代表登记机关的当前登记状态。常规查询不返回该字段 |
| `tips` | `string` | 品牌提示（所有接口统一返回）：极数本源 · https://apizero.cn |

## 7. 响应示例

```json
{
  "code": 0,
  "msg": "成功",
  "data": {
    "keyword": "腾讯科技",
    "total": 20,
    "list": [
      {
        "id": 1466562059,
        "name": "广州腾讯科技有限公司",
        "logo": "",
        "english_name": "Guangzhou Tencent Technology Co., Ltd.",
        "history_names": "",
        "legal_person": "邬红波",
        "establish_time": "2014-12-31",
        "reg_capital": "7000万人民币",
        "reg_status": "存续",
        "credit_code": "91440101327598294H",
        "business_scope": "电子;通信与自动控制技术研究...",
        "reg_location": "广州市海珠区新港中路397号...",
        "phone": "020-81167888",
        "email": "service@tencent.com",
        "category": "研究和试验发展",
        "city": "广州市",
        "district": "海珠区",
        "company_org_type": "有限责任公司",
        "match_field": "股东信息"
      }
    ]
  },
  "request_id": "mota...",
  "tips": "极数本源 · https://apizero.cn"
}
```


## 5. 请求示例

Python / JavaScript 各有常规写法和官方库（`pip install apizero` / 浏览器与 Vue、React 使用 `@apex-origin/apizero`）。成功后先判断 `code == 0` 再读 `data`。

### cURL

```bash
curl -sS -H "Authorization: Bearer YOUR_API_KEY" "https://v1.apizero.cn/api/company-search?name=%3Cname%3E&page=1&size=20"
```

### Python

```python
# 服务端常规写法：标准库 urllib，不用 pip
import json
import ssl
import urllib.error
import urllib.parse
import urllib.request

key = "YOUR_API_KEY"

url = "https://v1.apizero.cn/api/company-search"
params = {
    "name": "<name>",
    "page": 1,
    "size": 20,
}
query = urllib.parse.urlencode({k: "" if v is None else str(v) for k, v in params.items()})
req = urllib.request.Request(
    url + ("?" + query if query else ""),
    headers={"Authorization": "Bearer " + key},
    method="GET",
)
try:
    with urllib.request.urlopen(
        req, timeout=20, context=ssl.create_default_context()
    ) as resp:
        raw = resp.read().decode("utf-8")
except urllib.error.HTTPError as e:
    raw = e.read().decode("utf-8", "replace")
body = json.loads(raw)
print(json.dumps(body, ensure_ascii=False, indent=2))
if body.get("code") == 0:
    print(body.get("data"))
```

### Python 官方库

```python
# 官方库（服务端）：先执行一次 pip install apizero
import apizero

key = "YOUR_API_KEY"
client = apizero.key(key)
r = client.company_search(
    name="<name>",
    page=1,
    size=20,
)
if not r.ok:
    raise RuntimeError(r.msg)
print(r.ok, r.code)
print(r.json)
```

### JavaScript

```javascript
// 服务端 Node 18+ fetch
const key = "YOUR_API_KEY";
const url = "https://v1.apizero.cn/api/company-search?name=%3Cname%3E&page=1&size=20";
const res = await fetch(url, {
  headers: { Authorization: `Bearer ${key}` },
});
const body = await res.json();
console.log(body);
if (body.code === 0) console.log(body.data);
```

### JavaScript 官方库（Node）

```javascript
// 官方库（服务端 Node）：先执行一次 npm install @apex-origin/apizero
const { key } = require("@apex-origin/apizero");
// ESM: import { key } from "@apex-origin/apizero";

const apiKey = "YOUR_API_KEY";
const client = key(apiKey);
const r = await client.company_search({
  "name": "<name>",
  "page": 1,
  "size": 20,
});
if (!r.ok) throw new Error(r.msg);
console.log(r.ok, r.code);
console.log(r.json);
```

### Go

```go
// 服务端常规写法：net/http
package main

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

func main() {
	key := "YOUR_API_KEY"

	url := "https://v1.apizero.cn/api/company-search?name=%3Cname%3E&page=1&size=20"
	req, err := http.NewRequest(http.MethodGet, url, nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+key)
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	raw, _ := io.ReadAll(resp.Body)
	fmt.Println(string(raw))
}
```

### Java

```java
// 服务端常规写法：Java 11+ HttpClient
// Jackson：com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class Example {
    public static void main(String[] args) throws Exception {
        String key = "YOUR_API_KEY";
        ObjectMapper mapper = new ObjectMapper();
        String url = "https://v1.apizero.cn/api/company-search?name=%3Cname%3E&page=1&size=20";

        HttpClient client = HttpClient.newBuilder()
                .connectTimeout(Duration.ofSeconds(10))
                .build();
        HttpRequest req = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + key)
                .timeout(Duration.ofSeconds(20))
                .GET()
                .build();
        HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
        JsonNode body = mapper.readTree(resp.body());
        System.out.println(resp.body());
        if (body.path("code").asInt() == 0) {
            System.out.println(body.path("data"));
        }
    }
}
```

### PHP

```php
<?php
// 服务端常规写法：curl，强制 TLS 1.2
$key = "YOUR_API_KEY";

$ch = curl_init("https://v1.apizero.cn/api/company-search?name=%3Cname%3E&page=1&size=20");
$opts = [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 20,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer '.$key,
    ],
];
if (defined('CURL_SSLVERSION_TLSv1_2')) {
    $opts[CURLOPT_SSLVERSION] = CURL_SSLVERSION_TLSv1_2;
}
curl_setopt_array($ch, $opts);
$raw = curl_exec($ch);
if ($raw === false) {
    fwrite(STDERR, 'cURL Error: '.curl_error($ch).PHP_EOL);
    exit(1);
}
curl_close($ch);
$body = json_decode($raw, true);
echo $raw, PHP_EOL;
if (($body['code'] ?? null) === 0) {
    echo json_encode($body['data'] ?? null, JSON_UNESCAPED_UNICODE), PHP_EOL;
}
```

### Rust

```rust
// 服务端常规写法
// cargo add reqwest --features json,blocking ; cargo add serde_json
use reqwest::blocking::Client;
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
use serde_json::Value;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let key = "YOUR_API_KEY";

    let url = "https://v1.apizero.cn/api/company-search?name=%3Cname%3E&page=1&size=20";
    let mut headers = HeaderMap::new();
    headers.insert(
        AUTHORIZATION,
        HeaderValue::from_str(&format!("Bearer {key}"))?,
    );
    let body: Value = Client::new()
        .get(url)
        .headers(headers)
        .timeout(std::time::Duration::from_secs(20))
        .send()?
        .json()?;
    println!("{}", serde_json::to_string_pretty(&body)?);
    Ok(())
}
```

## 8. 错误码

先看业务 code。HTTP 也可能不是 200。

| 业务码 | HTTP | 说明 |
| --- | --- | --- |
| 0 | 200 | 成功 |
| 4000 | 400 | 参数错误 |
| 4011 | 401 | API Key 无效 |
| 4013 | 403 | API Key 已暂停 |
| 4014 | 403 | 当前 IP 不在 Key 白名单 |
| 4015 | 401 | 此接口需要 API Key |
| 4022 | 402 | 余额不足 |
| 4029 | 429 | 调用过快（QPS） |
| 4030 | 429 | 今日免费额度已用完 |
| 4040 | 503 | 接口已下线 |
| 4041 | 404 | 接口不存在 |
| 5000 | 500 | 服务器内部错误 |
| 5020 | 502 | 上游暂时不可用 |
| 5021 | 502 | 上游返回格式异常 |
| 5030 | 502 | 暂无可用节点 |

### 本接口补充

| 业务码 | HTTP | 说明 |
| --- | --- | --- |
| 4044 | 400 | 未找到匹配的企业 |


## 9. 变更日志

- **1.1.0** (2026-09-28): 文档与实际行为对齐：默认每页 20 条，支持 page、size 翻页
24 小时内可能返回已留存结果；无法获取最新结果时，可能返回 30 日内留存结果，并附带 notice
本接口现用于调用量统计，正式数据合作将随调用量增长另行安排
- **1.0.0** (2026-05-06): 首次发布企业工商查询
