📱 手机号码验证

基于 Google libphonenumber · 完全本地解析 · 无需第三方 API

接口地址

POST /api/parse

请求参数

参数类型必填说明
phonestring手机号码
countrystring国家代码,默认 CN

响应字段

字段类型说明
is_validboolean号码是否有效
is_possibleboolean号码长度是否可能
type_displaystring号码类型(中文)
carrierstring运营商
geo_namestring归属地
timezonestring时区
formatsobject各格式号码(E.164/国际/国内)

调用示例

curl -X POST https://phone.aink.me/api/parse \
  -H "Content-Type: application/json" \
  -d '{"phone": "13800138000", "country": "CN"}'
fetch('/api/parse', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ phone: '13800138000', country: 'CN' })
})
.then(res => res.json())
.then(data => {
    console.log('有效:', data.is_valid);
    console.log('运营商:', data.carrier);
});
import requests

resp = requests.post('https://phone.aink.me/api/parse', 
    json={'phone': '13800138000', 'country': 'CN'})
result = resp.json()
print(result['carrier'], result['geo_name'])
 '13800138000', 'country' => 'CN'];
$ch = curl_init('https://phone.aink.me/api/parse');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$resp = json_decode(curl_exec($ch), true);
echo $resp['carrier'];
?>

响应示例

{
    "is_valid": true,
    "type_display": "移动电话",
    "carrier": "中国移动",
    "geo_name": "北京市",
    "timezone": "Asia/Shanghai",
    "formats": {
        "e164": "+8613800138000",
        "national": "138 0013 8000"
    }
}