1. 基本信息
| 接口地址 | https://v1.apizero.cn/api/desensitize |
|---|
| 请求方法 | POST |
|---|
| 分类 | content |
|---|
| 提供方 | 极数本源 |
|---|
| 计费模式 | 免费试用 |
|---|
| 单次消耗 | 0 积分 |
|---|
| 起步价 | — |
|---|
| QPS 限制 | 10 req/s |
|---|
| 每日免费额度 | 200 次(已认证用户) |
|---|
| 匿名每日额度 | 50 次(无 API Key) |
|---|
| VIP 免费 | 否 |
|---|
| 调用次数 | |
|---|
3. 请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|
text | string | 是 | 要脱敏的文本,最长 50000 字节 | — |
types | string | 否 | 类型逗号分隔:phone,idcard,bankcard,email,name 或 all(默认) | — |
with_original | bool | 否 | 是否在 detections 中回显原文,默认 false | — |
5. 请求示例 (cURL)
curl -X POST "https://v1.apizero.cn/api/desensitize" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "<text>",
"types": "<types>",
"with_original": "<with_original>"
}'
6. 响应字段
| 字段 | 类型 | 说明 | 示例 |
|---|
masked_text | string | 脱敏后的完整文本 | — |
detection_count | number | 识别到的敏感信息数量(去重) | — |
summary | object | 按类型分组的命中数量 | — |
detections | array | 每条命中明细 {type, masked, [original]} | — |
types_applied | array | 本次应用的脱敏类型列表 | — |
7. 响应示例
{
"code": 0,
"msg": "成功",
"data": {
"masked_text": "联系人:张*,电话 138****8000",
"detection_count": 2,
"summary": {
"name": 1,
"phone": 1
},
"detections": [
{
"type": "name",
"masked": "张*"
},
{
"type": "phone",
"masked": "138****8000"
}
],
"types_applied": [
"phone",
"idcard",
"bankcard",
"email",
"name"
]
}
}
8. 错误码
| code | status | 说明 |
|---|
4000 | — | text 为空或超长,或 types 不包含任何有效类型 |