sinch-number-lookup-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSinch Number Lookup API
Sinch Number Lookup API
Overview
概述
Queries phone numbers for carrier, line type, porting, SIM swap, VoIP detection, and reassigned number detection. Used for fraud prevention, routing, and data enrichment.
- v2 Base URL:
https://lookup.api.sinch.com - v1 Base URL: (legacy -- no OAuth2, no projectId)
https://number-lookup.api.sinch.com - Endpoint:
POST /v2/projects/{projectId}/lookups - Auth: OAuth2 (recommended) or HTTP Basic. See sinch-authentication.
- One number per request. No batch endpoint.
查询电话号码的运营商、线路类型、转网状态、SIM卡更换、VoIP检测及重分配号码检测信息。适用于欺诈预防、路由决策和数据补全场景。
- v2 基础URL:
https://lookup.api.sinch.com - v1 基础URL: (旧版 -- 不支持OAuth2,无需projectId)
https://number-lookup.api.sinch.com - 接口地址:
POST /v2/projects/{projectId}/lookups - 认证方式: OAuth2(推荐)或HTTP Basic认证。详见sinch-authentication。
- 单次请求仅支持一个号码,无批量接口。
Getting Started
快速开始
Canonical curl Example
标准curl示例
bash
curl -X POST \
'https://lookup.api.sinch.com/v2/projects/YOUR_project_id/lookups' \
-H 'Content-Type: application/json' \
-u YOUR_key_id:YOUR_key_secret \
-d '{
"number": "+12025550134",
"features": ["LineType", "SimSwap", "VoIPDetection", "RND"],
"rndFeatureOptions": { "contactDate": "2025-01-01" }
}'For OAuth2, replace with .
-u-H 'Authorization: Bearer YOUR_access_token'For SDK setup (Node.js, Python, Java, .NET), see the Getting Started Guide.
bash
curl -X POST \
'https://lookup.api.sinch.com/v2/projects/YOUR_project_id/lookups' \
-H 'Content-Type: application/json' \
-u YOUR_key_id:YOUR_key_secret \
-d '{
"number": "+12025550134",
"features": ["LineType", "SimSwap", "VoIPDetection", "RND"],
"rndFeatureOptions": { "contactDate": "2025-01-01" }
}'若使用OAuth2认证,将替换为。
-u-H 'Authorization: Bearer YOUR_access_token'有关SDK配置(Node.js、Python、Java、.NET),请查看快速入门指南。
Request
请求参数
| Field | Type | Required | Notes |
|---|---|---|---|
| string | Yes | Single E.164 number (with |
| string[] | No | |
| string | If | |
Critical: If is omitted, only is returned. You must explicitly request , , or .
featuresLineTypeSimSwapVoIPDetectionRND| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | 是 | 单个E.164格式号码(需带 |
| string[] | 否 | 可选值: |
| string | 当请求 | 格式为 |
重要提示: 若省略参数,仅会返回信息。、和需显式指定。
featuresLineTypeSimSwapVoIPDetectionRNDResponse
响应结果
Flat object (not an array). Each feature populates its own sub-object; unrequested features are .
nullTop-level fields: , (ISO 3166-1 alpha-2),
numbercountryCodetraceIdline| Field | Type | Values |
|---|---|---|
| string | Carrier name, e.g. |
| string enum | |
| string | MCC, e.g. |
| string | MNC, e.g. |
| boolean | Whether ported |
| string | ISO 8601 datetime |
| object|null | Per-feature error ( |
simSwap| Field | Type | Values |
|---|---|---|
| boolean | Whether SIM swap occurred |
| string enum | |
| object|null | Per-feature error |
voIPDetection| Field | Type | Values |
|---|---|---|
| string enum | |
| object|null | Per-feature error |
rnd| Field | Type | Values |
|---|---|---|
| boolean | Disconnected after |
| object|null | Per-feature error |
For full response schemas, see the API Reference.
返回扁平对象(非数组)。每个请求的功能会生成对应的子对象;未请求的功能字段值为。
null顶层字段: 、(ISO 3166-1 alpha-2格式)、
numbercountryCodetraceIdline| 字段 | 类型 | 取值 |
|---|---|---|
| string | 运营商名称,例如 |
| 字符串枚举 | |
| string | MCC代码,例如 |
| string | MNC代码,例如 |
| boolean | 号码是否转网 |
| string | ISO 8601格式的日期时间 |
| object|null | 对应功能的错误信息(包含 |
simSwap| 字段 | 类型 | 取值 |
|---|---|---|
| boolean | 是否发生SIM卡更换 |
| 字符串枚举 | |
| object|null | 对应功能的错误信息 |
voIPDetection| 字段 | 类型 | 取值 |
|---|---|---|
| 字符串枚举 | |
| object|null | 对应功能的错误信息 |
rnd| 字段 | 类型 | 取值 |
|---|---|---|
| boolean | 在 |
| object|null | 对应功能的错误信息 |
完整响应结构请查看API参考文档。
Common Workflows
常见工作流
1. Fraud check before verification
1. 验证前的欺诈核查
- Look up the number with
features: ["SimSwap", "VoIPDetection"] - If is
simSwap.swappedandtrueisswapPeriodorSP4H→ flag as high riskSP24H - If is
voIPDetection.probabilityorHigh→ require additional verificationLikely - If either feature returns a non-null → fall back to the other feature's result for risk scoring
error - Otherwise → proceed with SMS/voice verification
- 调用查询接口,指定
features: ["SimSwap", "VoIPDetection"] - 若为
simSwap.swapped且true为swapPeriod或SP4H→ 标记为高风险SP24H - 若为
voIPDetection.probability或High→ 要求额外验证步骤Likely - 若任一功能返回非空→ 基于另一功能的结果进行风险评分
error - 否则 → 继续执行短信/语音验证
2. Pre-send number hygiene
2. 发送前的号码清洗
- Look up the number with (include
features: ["LineType", "RND"])rndFeatureOptions.contactDate - If is
rnd.disconnected→ remove from contact listtrue - Route based on : SMS for
line.type, voice forMobileLandline
- 调用查询接口,指定(需包含
features: ["LineType", "RND"])rndFeatureOptions.contactDate - 若为
rnd.disconnected→ 从联系人列表中移除该号码true - 根据进行路由:给
line.type号码发送短信,给Mobile号码拨打语音电话Landline
3. Combined lookup + verification
3. 联合查询+验证
- Look up the number with
features: ["LineType", "SimSwap"] - If is
line.type→ use voice verification instead of SMSLandline - If is
simSwap.swapped→ skip SMS verification, use an alternative channeltrue - See Combined Lookup + Verification for the full flow.
- 调用查询接口,指定
features: ["LineType", "SimSwap"] - 若为
line.type→ 使用语音验证替代短信验证Landline - 若为
simSwap.swapped→ 跳过短信验证,使用其他渠道true - 完整流程请查看联合查询+验证。
4. Multiple numbers
4. 多号码处理
No batch endpoint. Use parallel requests:
javascript
const results = await Promise.all(
numbers.map((number) => sinch.numberLookup.lookup({ number, features: ['LineType', 'SimSwap'] }))
);无批量接口,可使用并行请求:
javascript
const results = await Promise.all(
numbers.map((number) => sinch.numberLookup.lookup({ number, features: ['LineType', 'SimSwap'] }))
);Gotchas
注意事项
- must be explicit. Omitting it returns only
features. SIM swap, VoIP, and RND require explicit opt-in.LineType - VoIP probability is a string enum, not a 0–1 score. Values: ,
Unknown,Low,Likely.High - SIM swap periods are short codes like ,
SP24H-- not human-readable strings.SP7D - Partial failures are possible. Each feature sub-object has its own . A lookup can succeed for
errorbut fail forline.simSwap - RND requires . Omitting
contactDatewhen requestingrndFeatureOptionscauses aRND.400 - SIM swap depends on carrier support. Not available for all numbers or regions.
- VoIPDetection and RND are alpha. Behavior may change.
- Rate limiting. when exceeded. Contact Sinch for tier info.
429 Too Many Requests - Non-obvious error codes: means Account Locked (not payment required),
402means the API is disabled for your project. If response includes a403, direct the user to check this documentation.403
- 参数必须显式指定:省略该参数仅返回
features信息。SIM卡更换、VoIP检测和RND功能需显式开启。LineType - VoIP概率为字符串枚举,而非0-1的数值评分。取值包括:、
Unknown、Low、Likely。High - SIM卡更换周期为短代码,例如、
SP24H-- 并非易读字符串。SP7D - 可能出现部分失败:每个功能子对象都有独立的字段。查询可能在
error功能上成功,但在line功能上失败。simSwap - RND功能需指定:请求RND时若省略
contactDate会导致rndFeatureOptions错误。400 - SIM卡更换功能依赖运营商支持:并非所有号码或地区都支持该功能。
- VoIPDetection和RND为测试版:功能行为可能发生变化。
- 请求频率限制:超出限制会返回。如需了解具体限额,请联系Sinch。
429 Too Many Requests - 非直观错误码:表示账户锁定(并非需要付款),
402表示你的项目未启用该API。若响应返回403,请引导用户查看此文档。403