API Reference
中文

Summary

For a complete credit anti-fraud service docking process, you need to first complete the front-end SDK integration to obtain device information; then report back-end risk events to obtain complete risk control decisions and services.
This document is the specific docking API specification for back-end risk event reporting, including API addresses, authentication parameters, request parameters, response parameters, etc.

API Format

Base URL

API

URLHTTP Methodrequest Content Typeresponse Content TypeCharset
api-base-url?partner_code=xxx&partner_key=xxxPOSTapplication/jsonjsonUTF-8

Authentication

NameTypeMandatoryDescriptionNotes
partner_codeStringYesPartner codeProvided by TrustDecision
partner_keyStringYesPartner keyProvided by TrustDecision

Request

  • A complete event request parameter is usually composed of two parts of the parameter.
    • Basic Parameter(s)
    • Event Parameter(s)

Basic Parameter(s)

Parameter

Type

Description

Required/Optional

Notes

event_time

String

The specific time of the event occurs

Required

Comply with the ISO 8601 standard;
Format: yyyy-mm-ddthh: mm: ss.sssz, for example, 2021-10-12T14: 20: 50.521+07: 00

event_type

String

Event type

Required

Enumeration value:

  1. Register;
  2. Login;
  3. Identity verification;
  4. Loan
  5. Disburse

scenario

String

Event scenario

Enumeration value:

  1. cashloan
  2. bnpl
  3. creditcard
  4. p2p default
    If nothing is uploaded, it is default.

terminal

Terminal

Terminal information

Strongly recommended

See "Terminal" for details

ext

Object

Extended Information

Conditionally required

Extension information agreed with TD

ext_response_types

String

Information that needs additional returns

Recommended

For example, device_info means returning device details. If this field is not passed, the device information is not returned.

order_id

String

Customer side order id

Recommended

custom content

Event Parameter(s)

Request Example

{
    "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":"San Zhang",
            "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"
    }
}

Response Parameter(s)

Parameter

Type

Description

Required/Optional

Notes

code

Integer

API status code

Required

The status code returned by AFD, please see the API status code section below for details.

message

String

status information

Conditionally required

In the API exception state, the specific exception reason will be output.

sequence_id

String

Unique ID of Response

Required

Unique identifier used to track each request record

order_id

String

Customer side order id

Recommended

custom content, the same as request Parameter. Only displayed when the parameters are entered

device_info

DeviceInfo

Device information

Conditionally required

Returned when ext_response_types contains device_info

score

Integer

Risk score

Required

TG decision risk score, the higher the score, the higher the risk

result

String

Decision result

Required

Enumeration values:
1. decline
2. review
3. accept

reasons

Array

List of decision reasons

Required

When a risk is detected, display a list of causes of the risk

id

String

Decision Reason ID

Required

Unique code for the decision reason

reason

String

Decision Reason

Required

Explanation of the decision reasons

API Status Code

CodeDescription
200Success
301Service not purchased
302Traffic blocked
303Traffic insufficient
304Service expired
305Daily maximum volume reached
11000{Field name} input parameter error
11001Wrong format
11002Input parameter parsing failed
11302scenario input parameter error
11400The corresponding workflow cannot be found
11401Workflow execution error
11500System error
11501All nodes of the workflow failed to execute

Response Example

{
    "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":"China Unicom,-",
            "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":"No. 450, Cangqian Town, Yuhang District, Hangzhou City, Zhejiang Province",
                "city":"Hangzhou City",
                "province":"Zhejiang Province",
                "township":"Cangqian Town"
            },
            "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":"China Unicom,-",
            "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"
}