创建 AML 检查
创建针对钱包地址或特定交易哈希的 AML 检查。请求会立即冻结所需余额,并返回当前的检查状态。
POST /v1/aml-checks/new
请求
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 是 | AML 服务类型:address 或 hash |
| network | string | 是 | 区块链网络代码(见下表) |
| address | string | 是 | 所选网络的有效地址。若 type = hash,该地址为接收方地址。 |
| hash | string | 条件* | 所选网络的合法哈希。type = hash 时必填 |
| direction | string | 条件** | 交易方向(deposit 或 withdrawal)。type = hash 时必填。如果资金流向您的地址,为 deposit(收款);流向外部地址,为 withdrawal(付款)。 |
* 仅适用于哈希检查。
** 仅适用于哈希检查。若未提供,默认值为 deposit。
支持的服务类型
| 类型 | 说明 |
|---|---|
| address | 检查钱包地址并计算风险概况 |
| hash | 检查单笔交易哈希,包括收款/付款方向 |
支持的网络
| 代码 | 网络 |
|---|---|
| TRX | TRON |
| BTC | Bitcoin |
| ETC | Ethereum Classic |
| LTC | Litecoin |
| BSC | BNB Chain |
| XRP | Ripple |
| MATIC | Polygon |
| ADA | Cardano |
| XLM | Stellar |
bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{
"type": "address",
"network": "ETH",
"address": "0x6Dc1f03B1d2c27D6c741832F4AA83322D41De7Ea"
}'
# 计算签名
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)
# 发送请求
curl -X POST "https://api.tronzap.com/v1/aml-checks/new" \
-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({
type: 'address',
network: 'ETH',
address: '0x6Dc1f03B1d2c27D6c741832F4AA83322D41De7Ea'
});
// 计算签名
const signature = crypto
.createHash('sha256')
.update(requestBody + apiSecret)
.digest('hex');
// 发送请求
axios({
method: 'post',
url: 'https://api.tronzap.com/v1/aml-checks/new',
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([
'type' => 'address',
'network' => 'ETH',
'address' => '0x6Dc1f03B1d2c27D6c741832F4AA83322D41De7Ea',
], JSON_UNESCAPED_SLASHES);
// 计算签名
$signature = hash('sha256', $requestBody . $apiSecret);
// 发送请求
$ch = curl_init('https://api.tronzap.com/v1/aml-checks/new');
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({
'type': 'address',
'network': 'ETH',
'address': '0x6Dc1f03B1d2c27D6c741832F4AA83322D41De7Ea'
})
# 计算签名
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.tronzap.com/v1/aml-checks/new',
headers=headers,
data=request_body
)
print(response.json())哈希检查示例
bash
#!/bin/bash
API_TOKEN="your_api_token"
API_SECRET="your_api_secret"
REQUEST_BODY='{
"type": "hash",
"network": "BTC",
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"hash": "E3F2A1B66DBB9F0B24C4125229163944A7D91EB3F1AC5E409FFCEE0C81A913F2",
"direction": "withdrawal"
}'
# 计算签名
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)
# 发送请求
curl -X POST "https://api.tronzap.com/v1/aml-checks/new" \
-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({
type: 'hash',
network: 'BTC',
address: 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
hash: 'E3F2A1B66DBB9F0B24C4125229163944A7D91EB3F1AC5E409FFCEE0C81A913F2',
direction: 'withdrawal'
});
// 计算签名
const signature = crypto
.createHash('sha256')
.update(requestBody + apiSecret)
.digest('hex');
// 发送请求
axios({
method: 'post',
url: 'https://api.tronzap.com/v1/aml-checks/new',
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([
'type' => 'hash',
'network' => 'BTC',
'address' => 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
'hash' => 'E3F2A1B66DBB9F0B24C4125229163944A7D91EB3F1AC5E409FFCEE0C81A913F2',
'direction' => 'withdrawal'
], JSON_UNESCAPED_SLASHES);
// 计算签名
$signature = hash('sha256', $requestBody . $apiSecret);
// 发送请求
$ch = curl_init('https://api.tronzap.com/v1/aml-checks/new');
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({
'type': 'hash',
'network': 'BTC',
'address': 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh',
'hash': 'E3F2A1B66DBB9F0B24C4125229163944A7D91EB3F1AC5E409FFCEE0C81A913F2',
'direction': 'withdrawal'
})
# 计算签名
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.tronzap.com/v1/aml-checks/new',
headers=headers,
data=request_body
)
print(response.json())响应
响应返回 AML 检查的唯一 ID 及最新风险数据。若检查仍在进行中,状态会保持为 pending 或 processing。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| code | integer | 响应码(0 = 成功) |
| result | object | AML 检查数据 |
| result.id | string | AML 检查 ID |
| result.type | string | AML 服务类型(address 或 hash) |
| result.address | string | 被检查的地址 |
| result.hash | string | 被检查的哈希(仅 hash 服务) |
| result.direction | string | 交易方向(deposit 或 withdrawal) |
| result.network | string | 区块链网络代码 |
| result.status | string | 检查状态(pending, processing, completed, failed) |
| result.risk_score | float | 风险评分 |
| result.risk_level | string | 风险等级(low、medium、high) |
| result.blacklist | boolean | 是否命中黑名单 |
| result.risk_factors | array | 风险因素列表 |
| result.checked_at | string | 检查创建时间(ISO 8601) |
响应示例
json
{
"code": 0,
"result": {
"id": "01jq7h6bvf6p5t1amnz6y3n8c4",
"type": "address",
"address": "0x6Dc1f03B1d2c27D6c741832F4AA83322D41De7Ea",
"network": "ETH",
"status": "completed",
"risk_score": 12.5,
"risk_level": "medium",
"blacklist": false,
"risk_factors": [
{
"name": "p2p_exchange_mlrisk_high",
"label": "P2P Exchange (High Risk)",
"group": "medium",
"score": 0.796
},
{
"name": "exchange",
"label": "Exchange",
"group": "low",
"score": 0.203
}
],
"checked_at": "2024-03-25T10:42:12Z"
}
}可能的错误
| 错误码 | 说明 |
|---|---|
| 1 | 认证错误(令牌或签名无效) |
| 2 | 服务或参数无效 |
| 5 | 未找到钱包 |
| 6 | 余额不足,无法执行检查 |
| 35 | 服务对当前项目不可用 |
| 500 | 服务器内部错误 |
