Creare un controllo AML 
Crea un nuovo controllo AML per un indirizzo del wallet o per un hash di transazione specifico. La richiesta riserva immediatamente i fondi necessari ed espone lo stato corrente dell’analisi.
POST /v1/aml-checks/new
Richiesta 
Parametri 
| Campo | Tipo | Obbligatorio | Descrizione | 
|---|---|---|---|
| type | string | Sì | Tipo di servizio AML: address oppure hash | 
| network | string | Sì | Codice della rete blockchain (vedi tabella) | 
| address | string | Sì | Indirizzo valido per la rete selezionata. Per type = hash corrisponde all’indirizzo del destinatario. | 
| hash | string | Condizionale* | Hash valido per la rete selezionata. Obbligatorio quando type = hash | 
| direction | string | Condizionale** | Direzione della transazione (deposit o withdrawal). Obbligatorio quando type = hash. Se i fondi arrivano al tuo indirizzo è un deposito (ricevi). Se escono verso un indirizzo esterno è un prelievo (invi). | 
* Solo per i controlli basati su hash.
 ** Solo per i controlli basati su hash. Il valore predefinito è deposit se non viene specificato.
Tipi di servizio supportati 
| Tipo | Descrizione | 
|---|---|
| address | Analizza un indirizzo e calcola il relativo profilo di rischio | 
| hash | Analizza un singolo hash di transazione, compresa la direzione in entrata/uscita | 
Reti supportate 
| Codice | Rete | 
|---|---|
| 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"
}'
# Calcola la firma
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)
# Esegui la richiesta API
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'
});
// Calcola la firma
const signature = crypto
  .createHash('sha256')
  .update(requestBody + apiSecret)
  .digest('hex');
// Esegui la richiesta API
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);
// Calcola la firma
$signature = hash('sha256', $requestBody . $apiSecret);
// Esegui la richiesta API
$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'
})
# Calcola la firma
signature = hashlib.sha256((request_body + api_secret).encode()).hexdigest()
# Esegui la richiesta API
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())Esempio di richiesta per hash 
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"
}'
# Calcola la firma
SIGNATURE=$(echo -n "${REQUEST_BODY}${API_SECRET}" | sha256sum | cut -d' ' -f1)
# Esegui la richiesta API
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'
});
// Calcola la firma
const signature = crypto
  .createHash('sha256')
  .update(requestBody + apiSecret)
  .digest('hex');
// Esegui la richiesta API
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);
// Calcola la firma
$signature = hash('sha256', $requestBody . $apiSecret);
// Esegui la richiesta API
$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'
})
# Calcola la firma
signature = hashlib.sha256((request_body + api_secret).encode()).hexdigest()
# Esegui la richiesta API
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())Risposta 
La risposta restituisce l’identificativo del controllo AML e i dati di rischio più recenti. Se l’elaborazione è ancora in corso, lo stato rimane pending o processing finché non viene prodotto un risultato finale.
Campi della risposta 
| Campo | Tipo | Descrizione | 
|---|---|---|
| code | integer | Codice di risposta (0 = successo) | 
| result | object | Dati del controllo AML | 
| result.id | string | Identificativo del controllo AML | 
| result.type | string | Tipo di servizio AML (address oppure hash) | 
| result.address | string | Indirizzo analizzato | 
| result.hash | string | Hash analizzato (solo per i controlli hash) | 
| result.direction | string | Direzione della transazione (deposit o withdrawal) se applicabile | 
| result.network | string | Codice della rete blockchain | 
| result.status | string | Stato del controllo (pending, processing, completed, failed) | 
| result.risk_score | float | Punteggio di rischio | 
| result.risk_level | string | Livello di rischio testuale (low, medium, high) | 
| result.blacklist | boolean | true se viene rilevata una corrispondenza in blacklist | 
| result.risk_factors | array | Elenco dei fattori di rischio | 
| result.checked_at | string | Timestamp di creazione del controllo (ISO 8601) | 
Esempio di risposta 
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"
  }
}Possibili errori 
| Codice errore | Descrizione | 
|---|---|
| 1 | Errore di autenticazione (token o firma non validi) | 
| 2 | Servizio o parametri non validi | 
| 5 | Wallet non trovato | 
| 6 | Fondi insufficienti per eseguire il controllo | 
| 35 | Servizio non disponibile per il tuo progetto | 
| 500 | Errore interno del server | 
