本API提供身份证号码生成相关的服务,包括获取地区数据、生成身份证号码等功能。所有API返回JSON格式数据。
| 11 - 北京市 | 12 - 天津市 | 31 - 上海市 | 32 - 江苏省 |
| 33 - 浙江省 | 44 - 广东省 | 50 - 重庆市 | 51 - 四川省 |
| 北京市 01 - 北京市 |
上海市 01 - 上海市 |
天津市 01 - 天津市 |
重庆市 01 - 重庆市 |
| 江苏省 01 - 南京市 05 - 苏州市 |
浙江省 01 - 杭州市 02 - 宁波市 |
广东省 01 - 广州市 03 - 深圳市 |
四川省 01 - 成都市 |
| 01 - 东城区 | 02 - 西城区 | 05 - 朝阳区 | 06 - 丰台区 |
| 07 - 石景山区 | 08 - 海淀区 | 09 - 门头沟区 | 11 - 房山区 |
获取所有可用的省份信息。
{
"code": 200,
"message": "success",
"data": [
{
"code": "11",
"name": "北京市"
},
{
"code": "31",
"name": "上海市"
}
]
}
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| province_code | string | 是 | 省份代码(参考上方速查表) |
{
"code": 200,
"message": "success",
"data": [
{
"code": "01",
"name": "北京市"
}
]
}
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| province_code | string | 是 | 省份代码(参考上方速查表) |
| city_code | string | 是 | 城市代码(参考上方速查表) |
{
"code": 200,
"message": "success",
"data": [
{
"code": "01",
"name": "东城区"
},
{
"code": "02",
"name": "西城区"
}
]
}
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| province_code | string | 是 | 省份代码(参考上方速查表) |
| city_code | string | 是 | 城市代码(参考上方速查表) |
| district_code | string | 是 | 区县代码(参考上方速查表) |
| birthdate | string | 是 | 出生日期,格式:YYYYMMDD |
| gender | string | 是 | 性别:male(男)或female(女) |
| count | integer | 否 | 生成数量,默认1,最大100 |
{
"province_code": "11",
"city_code": "01",
"district_code": "01",
"birthdate": "19900101",
"gender": "male",
"count": 2
}
{
"code": 200,
"message": "success",
"data": [
{
"id_number": "110101199001011234",
"name": "张三"
},
{
"id_number": "110101199001015678",
"name": "李四"
}
]
}
| 错误码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 请求参数错误 |
| 404 | 资源不存在 |
| 429 | 请求频率超限 |
| 500 | 服务器内部错误 |
Content-Type: application/json 头// 生成身份证号码示例
fetch('https://api.baymaxgroup.com/sfz/generate.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
province_code: '11',
city_code: '01',
district_code: '01',
birthdate: '19900101',
gender: 'male',
count: 1
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
$url = 'https://api.baymaxgroup.com/sfz/generate.php';
$data = array(
'province_code' => '11',
'city_code' => '01',
'district_code' => '01',
'birthdate' => '19900101',
'gender' => 'male',
'count' => 1
);
$options = array(
'http' => array(
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
print_r($response);
import requests
import json
url = 'https://api.baymaxgroup.com/sfz/generate.php'
data = {
'province_code': '11',
'city_code': '01',
'district_code': '01',
'birthdate': '19900101',
'gender': 'male',
'count': 1
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=data, headers=headers)
result = response.json()
print(result)