检查 AML 状态
获取已有 AML 检查的最新状态及风险评估。若有新信息,数据会自动刷新。
POST /v1/aml-checks/check
请求
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | AML 检查 ID |
bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{
"id": "1042"
}'
# 计算签名
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)
# 发送请求
curl -X POST "https://api.trxup.com/v1/aml-checks/check" \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "X-Signature: ${SIGNATURE}" \
-H "Content-Type: application/json" \
-d "${REQUEST_BODY}"javascript
const crypto = require('crypto');
const axios = require('axios');
const apiToken = 'your_api_token';
const apiSecret = 'your_api_secret';
const requestBody = JSON.stringify({
id: '1042'
});
// 计算签名
const signature = crypto
.createHash('sha256')
.update(requestBody + apiSecret)
.digest('hex');
// 发送请求
axios({
method: 'post',
url: 'https://api.trxup.com/v1/aml-checks/check',
headers: {
'Authorization': `Bearer ${apiToken}`,
'X-Signature': signature,
'Content-Type': 'application/json'
},
data: requestBody
})
.then(response => console.log(response.data))
.catch(error => console.error(error));php
<?php
$apiToken = 'your_api_token';
$apiSecret = 'your_api_secret';
$requestBody = json_encode([
'id' => '1042'
]);
// 计算签名
$signature = hash('sha256', $requestBody . $apiSecret);
// 发送请求
$ch = curl_init('https://api.trxup.com/v1/aml-checks/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiToken,
'X-Signature: ' . $signature,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>python
import hashlib
import json
import requests
api_token = 'your_api_token'
api_secret = 'your_api_secret'
request_body = json.dumps({
'id': '1042'
})
# 计算签名
signature = hashlib.sha256((request_body + api_secret).encode()).hexdigest()
# 发送请求
headers = {
'Authorization': f'Bearer {api_token}',
'X-Signature': signature,
'Content-Type': 'application/json'
}
response = requests.post(
'https://api.trxup.com/v1/aml-checks/check',
headers=headers,
data=request_body
)
print(response.json())响应
返回 AML 检查的最新风险数据。若检查仍为 pending,服务器会在响应前重新获取结果,因此每次调用都返回最新状态;请持续轮询,直至状态变化。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| code | integer | 响应码(0 = 成功) |
| request_id | string | 唯一请求标识符 |
| result | object | AML 检查数据 |
| result.id | string | AML 检查 ID |
| result.type | string | AML 服务类型(address 或 hash) |
| result.address | string | 被检查的地址 |
| result.network | string | 区块链网络代码,写法与支持的网络列表一致(例如 TRX、TetherOMNI) |
| result.status | string | 当前状态(pending, processing, completed, failed, expired, skipped) |
| result.risk_score | string|null | 风险评分,保留两位小数的字符串(例如 "12.50"),尚无评分时为 null |
| result.risk_level | string|null | 风险等级(low、medium、high) |
| result.blacklist | boolean | 是否命中黑名单 |
| result.risk_factors | array | 资金所关联的风险类别,按 score 从大到小排列,每个类别一项;未报告任何类别时为空数组 [](例如检查尚未完成时) |
| result.risk_factors[].name | string | 类别键,取值为风险因素类别中列出的键之一;列表之外的类别报告为 other |
| result.risk_factors[].label | string | 类别的英文名称(不翻译) |
| result.risk_factors[].group | string | 类别的风险分组:low、medium 或 high |
| result.risk_factors[].score | number | 与该类别关联的资金占比,取值 0 到 1,保留 3 位小数 |
| result.checked_at | string | 检查创建时间(ISO 8601) |
| result.hash | string | 被检查的哈希(仅 hash 服务) |
| result.direction | string | 被检查的交易一方,deposit 或 withdrawal(仅 hash 服务) |
风险因素类别
risk_factors[].name 始终是下列键之一。列表之外的类别报告为 other。label 始终为英文:它是响应内容的一部分,而非翻译。
| name | label | group |
|---|---|---|
enforcement_action | Enforcement Action | high |
ransom | Ransom | high |
dark_market | Dark Market | high |
dark_service | Dark Service | high |
illegal_service | Illegal Service | high |
mixer | Mixer | high |
scam | Scam | high |
gambling | Gambling | high |
stolen_coins | Stolen Coins | high |
exchange_fraudulent | Fraudulent Exchange | high |
child_exploitation | Child Exploitation | high |
sanctions | Sanctions | high |
terrorism_financing | Terrorism Financing | high |
malware | Malware | high |
infrastructure_as_a_service | Infrastructure-as-a-Service | medium |
decentralized_exchange_contract | Decentralized Exchange Contract | medium |
unnamed_service | Unnamed Service | medium |
atm | ATM | medium |
risky_exchange | Risky Exchange | medium |
p2p_exchange_mlrisk_high | P2P Exchange (High Risk) | medium |
liquidity_pools | Liquidity Pools | medium |
exchange | Exchange | low |
merchant_services | Merchant Services | low |
wallet | Wallet | low |
miner | Miner | low |
payment | Payment | low |
marketplace | Marketplace | low |
p2p_exchange | P2P Exchange | low |
seized_assets | Seized Assets | low |
other | Other | low |
响应示例
json
{
"code": 0,
"request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
"result": {
"id": "1042",
"type": "address",
"address": "TPY1Kb8cKAZQfm95gXQQs2Mh8Uygtos21D",
"network": "TRX",
"status": "completed",
"risk_score": "12.50",
"risk_level": "medium",
"blacklist": false,
"risk_factors": [
{
"name": "exchange",
"label": "Exchange",
"group": "low",
"score": 0.9
},
{
"name": "p2p_exchange_mlrisk_high",
"label": "P2P Exchange (High Risk)",
"group": "medium",
"score": 0.1
}
],
"checked_at": "2024-03-25T10:42:12+00:00"
}
}对于哈希检查,hash 和 direction 位于 checked_at 之后:
json
{
"code": 0,
"request_id": "bbf74bcd-fb36-4df8-adc8-25f2bacd087b",
"result": {
"id": "1043",
"type": "hash",
"address": "TPY1Kb8cKAZQfm95gXQQs2Mh8Uygtos21D",
"network": "TRX",
"status": "completed",
"risk_score": "3.20",
"risk_level": "low",
"blacklist": false,
"risk_factors": [],
"checked_at": "2024-03-25T10:44:31+00:00",
"hash": "E3F2A1B66DBB9F0B24C4125229163944A7D91EB3F1AC5E409FFCEE0C81A913F2",
"direction": "deposit"
}
}可能的错误
| 错误码 | Key | 说明 |
|---|---|---|
| 1 | auth | 认证错误(令牌或签名无效) |
| 2 | invalid_service_or_params | 参数无效(id 缺失或为空) |
| 30 | aml_check_not_found | 未找到 AML 检查,或该检查属于其他账户 |
| 500 | internal_server_error | 服务器内部错误 |