cURL
curl "https://api.ruseo.cn/api/idcard?idcard=330226199805132185&action=info&eighteen=true&address=demo&birthday=demo&sex=1"
验证中国大陆身份证号码合法性,提取户籍地、出生日期、性别等信息,支持15位/18位
https://api.ruseo.cn/api/idcard
接口调用前需要确认的核心配置。
/api/idcardidcard必填参数必须传入,示例值可直接用于联调。
免费API不强制要求API Key,但如果您希望统计个人调用次数,请在请求时附加参数 key=您的API_KEY。
注册账号后即可获得API Key。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
key |
否 | string | 可选参数:携带此参数可统计您的个人调用次数。请注册账号获取API Key。 | YOUR_API_KEY |
idcard |
否 | string | 身份证号码(15位或18位),action=fake时可为空 | 330226199805132185 |
action |
否 | string | 操作类型:validate(验证)|info(详细信息)|upgrade(15位升18位)|fake(生成假数据),默认validate | info |
eighteen |
否 | boolean | action=fake时有效:true=生成18位,false=生成15位,默认true | |
address |
否 | string | action=fake时有效:指定地址(如:北京市、广东省深圳市),默认随机 | |
birthday |
否 | string | action=fake时有效:指定出生日期(4-8位数字,如:1999、199901、19990101),默认随机 | |
sex |
否 | number | action=fake时有效:0=女,1=男,默认随机 | |
优先使用示例地址测试请求参数是否正确。
https://api.ruseo.cn/api/idcard?idcard=330226199805132185&action=info&eighteen=true&address=demo&birthday=demo&sex=1
curl "https://api.ruseo.cn/api/idcard?idcard=330226199805132185&action=info&eighteen=true&address=demo&birthday=demo&sex=1"
$url = 'https://api.ruseo.cn/api/idcard?idcard=330226199805132185&action=info&eighteen=true&address=demo&birthday=demo&sex=1';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.ruseo.cn/api/idcard?idcard=330226199805132185&action=info&eighteen=true&address=demo&birthday=demo&sex=1')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "idcard",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
idcard |
string | 输入的身份证号码 | |
is_valid |
boolean | 身份证号码是否合法 | |
message |
string | 验证结果描述 | |
address_code |
string | 地址码(6位数字) | |
address |
string | 完整地址(省市区) | |
province |
string | 省份 | |
city |
string | 城市 | |
district |
string | 区县 | |
birthday |
string | 出生日期(格式:Y-m-d) | |
age |
number | 年龄(周岁) | |
constellation |
string | 星座 | |
zodiac |
string | 生肖 | |
sex |
string | 性别(男/女) | |
sex_code |
number | 性别代码(1=男,0=女) | |
length |
number | 号码长度(15或18) | |
check_bit |
string | 校验位(18位身份证的最后一位) | |
is_abandoned |
boolean | 地址码是否已废弃(行政区划变更) | |
upgraded_id |
string | action=upgrade时返回:升级后的18位身份证号码 | |
fake_id |
string | action=fake时返回:生成的假身份证号码 | |
is_18bit |
boolean | action=fake时返回:是否为18位号码 | |
note |
string | action=fake时返回:提示信息 | |
source |
string | 数据来源:jxlwqq/id-validator 或 fallback | |
点击左侧“发送请求”查看结果...