介绍

完整的信贷反欺诈服务对接流程,需要您优先完成前端 SDK 集成,以此来获取设备信息;而后进行后端风险事件上报,获得完整的风控决策和服务。
本文档即为后端风险事件上报的具体对接 API 规范,包含 API 地址、认证参数、请求参数、响应参数等部分。

API 方式

Base URL

API

URLHTTP 请求方式入参格式输出格式字符集Charset
api-base-url?partner_code=xxx&partner_key=xxxPOSTapplication/jsonjsonUTF-8

认证参数

字段类型含义建议备注
partner_codeString合作方标识必须由TD分配
partner_keyString合作方密钥必须由TD分配

请求参数

  • 一次完整的智能决策请求参数通常是由两部分字段组成

    • 基础字段
    • 业务字段

基础字段

字段类型含义建议备注
event_timeString事件真实发生时间必须符合 ISO 8601 标准,格式 YYYY-MM-DDTHH:mm:ss.sssZ ,例如 2021-10-12T14:20:50.521+07:00
event_typeString事件类别必须枚举值:
1.register:注册
2.login:登录
3.idv:身份认证
4.loan:授信
5.disburse:用信
scenarioString业务场景枚举值:
1.cashloan
2.bnpl
3.creditcard
4.p2p默认default
不传则默认default
terminalTerminal终端信息强烈建议详见Terminal 终端信息
extObject扩展信息条件必须与 TD 约定好的扩展信息
ext_response_typesString需要额外返回的信息建议如device_info,表示返回设备详情。若不传该字段,则不返回设备信息。

业务字段

请求示例

{
    "event_time":"2021-10-12T14:20:50.521+07:00",
    "event_type":"loan",
    "terminal":{
        "black_box":"aGPH165*****83672ropYaFxT7",
        "ip":"210.20.10.33"
    },
    "scenario":"default",
    "profile":{
        "name":"Pierre Laurent",
        "id":{
            "id_country":"GB",
            "id_type":"passport",
            "id_number":"G402****",
            "valid_date":"2028-01-01"
        },
        "phone":{
            "country_code":86,
            "phone_number":"18700001111"
        },
        "email":"xxxx",
        "birthdate":"1998-01-01",
        "birthplace":{
            "country":"GB",
            "region":"The Greater London",
            "city":"London",
            "district":"Knightsbridge",
            "detail":"87-135 Brompton Rd"
        },
        "sex":"male",
        "address":{
            "country":"GB",
            "region":"The Geater London",
            "city":"London",
            "district":"Knightsbridge",
            "detail":" 87-135 Brompton Rd",
            "zip_code":"SW3 1QE"
        },
        "marital_status":"single",
        "education":"master",
        "company_name":"xxx",
        "company_phone":{
            "country_code":86,
            "phone_number":"18700001111"
        },
        "company_address":{
            "country":"GB",
            "region":"The Geater London",
            "city":"London",
            "district":"Knightsbridge",
            "detail":" 87-135 Brompton Rd",
            "zip_code":"SW3 1QE"
        }
    },
    "contact":[
        {
            "name":"Pierre Laurent",
            "phone":{
                "country_code":86,
                "phone_number":"18700001111"
            },
            "relationship":"spouse"
        },
        {
            "name":"张三",
            "phone":{
                "country_code":86,
                "phone_number":"18700001112"
            },
            "relationship":"friend"
        }
    ],
    "card":{
        "card_number":"xxxx",
        "bank_name":"xxx"
    },
    "identity_ext":{
        "face_image_type":"url",
        "face_image":[
            "url1",
            "url2"
        ],
        "face_video_type":"url",
        "face_video":"https://xxx...",
        "id_image_type":"url",
        "id_image":"https://xxx..."
    },
    "ext":{
        "ext_response_types":"device_info"
    }
}

响应参数

字段类型含义建议备注
codeIntegerAPI 状态码必须AFD返回的状态码,详见后面 API 状态码部分
messageString状态信息条件必须在 API 异常状态下会输出具体的异常原因
sequence_idString响应唯一码必须用于跟踪每次请求记录的唯一标识
device_infoDeviceInfo设备信息条件必须ext_response_types含有 device_info时返回
scoreInteger风险分必须AFD决策风险分,分数越高表明风险越高
resultString决策结果必须枚举值:1. decline:拒绝 ;2. review:审查 ;3. accept:通过
reasonsArray决策原因列表必须当探查到风险时,展示风险的原因列表
idString决策原因 ID必须决策原因的唯一编码
reasonString决策原因必须决策原因解释说明

API 状态码

Code描述
200成功
301未购买此服务
302流量已被禁用
303流量不足
304服务已过期
305日流量已封顶
11000{字段名}入参错误
11001格式错误
11002入参解析失败
11302scenario 入参错误
11400无法找到对应的工作流
11401工作流执行错误
11500系统错误
11501工作流所有节点执行失败

响应示例

{
    "code":200,
    "device_info":{
        "device_id":"A1VHK6r9-T3E2-U77L-786n-6kn6ZJhQt5ee",
        "device_os":"Android",
        "device_detail":{
            "android_id":"591b4eb2a65e88f5",
            "api_version":"31",
            "app_version":"4.1.5.6",
            "available_memory":1509920768,
            "available_storage":31501324288,
            "baseband_version":"MOLY.LR12A.R3.MP.V98.1.P22",
            "battery_level":100,
            "brand":"Redmi",
            "bssid":"80:8d:b7:be:ef:16",
            "carrier":"中国联通,-",
            "cell_ip":"11.77.85.128",
            "charge_state":"full",
            "country_iso":"cn",
            "cpu_hardware":"AArch64 Processor rev 2 (aarch64)",
            "cpu_type":"MT6771V/C",
            "current_time":1687772256849,
            "device_name":"lancelot",
            "device_svn":"07",
            "dns_address":"192.168.8.55",
            "fp_version":"4.1.5.6",
            "gps_location":{
                "address":"浙江省杭州市余杭区仓前镇450路",
                "city":"杭州市",
                "province":"浙江省",
                "township":"仓前镇"
            },
            "hardware":"mt6768",
            "host":"m1-xm-ota-bd274.bj.idc.xiaomi.com",
            "installed_packages":"[{"package":"com.miui.screenrecorder","name":"-"},{"package":"com.miui.fm","name":"-"},{"package":"com.mi.liveassistant","name":"-"},{"package":"com.xiaomi.vipaccount","name":"-"},{"package":"com.qiyi.video","name":"-"},{"package":"cn.tongdun.android.demo4156","name":"-"},{"package":"cn.tongdun.android.demo4159","name":"-"},{"package":"com.miui.thirdappassistant","name":"-"},{"package":"com.android.soundrecorder","name":"-"},{"package":"cn.wps.moffice_eng","name":"-"}]",
            "ip":"123.157.153.130",
            "ipv6":"fe80::5c5f:4e9c:b980:17c4",
            "language":"zh",
            "latitude":30.281102,
            "longitude":120.012233,
            "mcc":"460,",
            "mnc":"01,",
            "model":"M2004J19C",
            "network_type":"wifi",
            "package_name":"cn.tongdun.android.demo4156",
            "product":"lancelot",
            "proxy_info":"",
            "running_packages":"cn.tongdun.android.demo4156",
            "screen_brightness":256,
            "screen_resolution":"1080x2340",
            "sign_md5":"03ce925f76ceb40e1c2ed8bfe3fcdd0c480a7ba8689ff814c601edfbf79e339e",
            "sim_operator":"中国联通,-",
            "ssid":"IT-YUNZM123",
            "startup_time":"2023-06-21 10:14:59",
            "system_version":"12",
            "time_zone":"UTC+08:00",
            "total_memory":3881115648,
            "total_storage":50979336192,
            "up_time":458557139,
            "vpn_ip":"",
            "wifi_ip":"10.57.201.50"
        },
        "ip_location":{
            "country":"China",
            "region":"Zhejiang",
            "city":"Hangzhou",
            "country_id":"CN",
            "continent":"Asia"
        },
        "device_risk_label":[
            "abnormal_network_connection"
        ],
        "device_risk_tools":{
            "installed_risk_tools_type":[
                "quick_macro"
            ],
            "running_risk_tools_type":[
                "quick_macro"
            ]
        }
    },
    "reasons":[
        {
            "id":"fbd5ff***98b86298f",
            "reason":"xxx"
        },
        {
            "id":"29b4a58aa***38dd5654ce6467",
            "reason":"xxx"
        }
    ],
    "result":"accept",
    "score":0,
    "sequence_id":"1693278374751000X3D9A00381169466"
}