在互联网金融、消费信贷、在线教育分期、信用租赁和电商风控等众多场景中,用户信用评分 是企业精准评估风险的核心指标。
个人信用分API 依托AI多维算法模型,通过多头借贷、社交行为、设备指纹与流量特征等维度,输出综合信用评分(300–900分)。
本文档将介绍如何使用 Node.js 安全调用该API,包含完整加密、请求及错误处理逻辑,帮助开发者快速接入并实现风控自动化。
https://api.tianyuanapi.com/api/v1/JRZQ0L85?t=13位时间戳Access-Id:您的账户凭证Content-Type:application/json所有请求参数需使用 AES-128-CBC 加密 并进行 Base64编码 后放入 data 字段。
curl -X POST "https://api.tianyuanapi.com/api/v1/JRZQ0L85?t=1730457600000" \
-H "Access-Id: your_access_id_here" \
-H "Content-Type: application/json" \
-d '{"data":"Base64EncodedEncryptedDataHere"}'import crypto from 'crypto';
import fetch from 'node-fetch';
// ========== AES 加密 ==========
function encryptData(payload, accessKey) {
const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv('aes-128-cbc', Buffer.from(accessKey, 'utf8'), iv);
let encrypted = cipher.update(JSON.stringify(payload), 'utf8', 'base64');
encrypted += cipher.final('base64');
return Buffer.concat([iv, Buffer.from(encrypted, 'base64')]).toString('base64');
}
// ========== AES 解密 ==========
function decryptData(encryptedData, accessKey) {
const buffer = Buffer.from(encryptedData, 'base64');
const iv = buffer.slice(0, 16);
const cipherText = buffer.slice(16);
const decipher = crypto.createDecipheriv('aes-128-cbc', Buffer.from(accessKey, 'utf8'), iv);
let decrypted = decipher.update(cipherText, undefined, 'utf8');
decrypted += decipher.final('utf8');
return JSON.parse(decrypted);
}
// ========== API 调用 ==========
async function callCreditScoreAPI() {
const accessKey = 'your_16byte_key';
const accessId = 'your_access_id_here';
const url = `https://api.tianyuanapi.com/api/v1/JRZQ0L85?t=${Date.now()}`;
const payload = {
mobile_no: '13800001111',
id_card: '110101199001012345',
name: '张三'
};
try {
const encrypted = encryptData(payload, accessKey);
const res = await fetch(url, {
method: 'POST',
headers: {
'Access-Id': accessId,
'Content-Type': 'application/json'
},
body: JSON.stringify({ data: encrypted })
});
const response = await res.json();
if (response.code === 0) {
const decrypted = decryptData(response.data, accessKey);
console.log('信用分结果:', decrypted);
} else {
console.error('调用失败:', response.message);
}
} catch (err) {
console.error('调用异常:', err);
}
}
callCreditScoreAPI();响应结构层级:
{
"code": 0,
"message": "业务成功",
"transaction_id": "20251102123456789",
"data": {
"score_120_General": "480"
}
}字段名 | 含义 | 说明 |
|---|---|---|
mobile_no | 手机号 | 用户注册手机号 |
id_card | 身份证号 | 用户身份证号码 |
name | 姓名 | 用户真实姓名 |
score_120_General | 综合信用分 | 300–900分,分数越高风险越低,为-1表示未命中 |
个人信用分API 具有以下应用价值:
通过Node.js轻松调用个人信用分接口,可快速实现安全、高效的信用分评估与风控集成。
借助AES加密与Base64安全传输机制,确保敏感信息在网络中传输安全可靠。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。