AMLBot Client for Python
This Python client connects with the AMLBot web API, enabling address and transaction risk checks, wallet monitoring and secure webhook handling. It ships a synchronous and an asynchronous client with the same API, fully typed.
- AMLBot Client for Python
- Installation
- Client
- Webhook
Installation
pip install amlbot
# with SOCKS5 proxy support
pip install "amlbot[socks]"
Python 3.10 or newer is required.
Client
Configuration
import amlbot
# credentials are read from AMLBOT_ACCESS_ID and AMLBOT_ACCESS_KEY
with amlbot.Client() as client:
...
# given explicitly
credentials = amlbot.Credentials("EBC3B-9CC8C-7E200", "a0b1c2d3e4f5g6h7i8j9")
# from other environment variables: MY_ACCESS_ID and MY_ACCESS_KEY
credentials = amlbot.Credentials.from_environment(prefix="MY_")
# Telegram accounts send `tmId` instead of `accessId`
credentials = amlbot.Credentials.telegram(123456789, "a0b1c2d3e4f5g6h7i8j9")
client = amlbot.Client(credentials)
Usage
Every method returns the result itself, never the raw {"result": ..., "data": ...} envelope of the API.
Check an Address
Costs 1 credit.
check = client.check_address("0x28c6c06298d514db089934071355e5743bf21d60", "ETH")
print(check.status) # "pending" or "success"
print(check.uid)
# with another check mode ("lite" in Personal mode) and language
check = client.check_address("TCbbcVXHSTNLnAT5RnXH3nGC7YTgjZhjqE", "TRX", flow="advanced")
check = client.check_address("TCbbcVXHSTNLnAT5RnXH3nGC7YTgjZhjqE", "TRX", locale="fr_FR")
Check a Transaction
Costs 1 credit.
check = client.check_transaction(
"0x40488542219026d4ddfb2a4625fdd4b3754570587ec49261b8021b494cb0e8e4",
address="0x124dbe972efd16a2a0c9ad061e6313b9ec0f5768", # your side of the transaction
asset="BSC",
direction="deposit", # or "withdrawal"
)
Investigate an Address
Costs 5 credits, Business mode only.
investigation = client.investigate_address("0x2505c6a5eb35983c158f42e66b62697f5fc86452", "ETH")
# scoped to a token contract
investigation = client.investigate_address(
"0x2505...", "ETH", token_contract="0xdac17f958d2ee523a2206206994597c13d831ec7"
)
Wait for a Result
Most checks resolve in about 2 minutes, some take longer. Waiting polls the check for free.
check = client.check_address("0x28c6c06298d514db089934071355e5743bf21d60", "ETH")
final = client.wait_for_result(check) # an AddressCheck, always "success"
print(final.risk_score) # 0.63, or None when AMLBot found no risk
print(final.blacklisted) # False
print(final.signals) # {"exchange": 0.317, "gambling": 0.594, ...}
print(final.checked_at) # datetime in UTC
# change the polling
final = client.wait_for_result(check, timeout=900, interval=10, maximum_interval=60)
Recheck a Check
Fetches the current state of a check, for free.
check = client.recheck("6855252bbd86e138331438") # AddressCheck | TransactionCheck | Investigation
# when the kind is known, the result is typed as that kind
check = client.recheck("6855252bbd86e138331438", kind=amlbot.AddressCheck)
# also works when waiting
final = client.wait_for_result("6855252bbd86e138331438", kind=amlbot.AddressCheck)
Testing the check kind
match check:
case amlbot.AddressCheck():
print("Address: %s" % check.address)
print(" with risk score: %s" % check.risk_score)
print(" with balance: %s" % (check.address_details and check.address_details.balance))
case amlbot.TransactionCheck():
print("Transaction: %s" % check.transaction_hash)
print(" with direction: %s" % check.direction)
print(" with amount: %s" % check.amount)
case amlbot.Investigation():
print("Investigation: %s" % check.address)
print(" with report: %s" % check.xls_report_url)
Find the History of an Address
Free. Pages are 0-based and hold the most recent checks first.
history_page = client.history(query_hash="0x28c6c06298d514db089934071355e5743bf21d60")
for entry in history_page.entries:
print(entry.uid, entry.status, entry.risk_score)
print(history_page.total_count) # matching checks across all pages
# filters
history_page = client.history(page=2, address_checks=True, asset="ETH")
history_page = client.history(transaction_checks=True)
Iterate over the History
Free. Pages are fetched only when the iteration reaches them, so stopping early costs nothing.
for entry in client.iterate_history(transaction_checks=True, asset="ETH"):
print(entry.uid, entry.risk_score)
# resume an interrupted export, and bound it
for entry in client.iterate_history(start_page=40, maximum_pages=10):
...
Subscribe an Address to Monitoring
Requires a plan with the Address Monitoring feature. AMLBot then sends a monitoring alert when the address becomes riskier.
# the current risk of the address, a MonitoringPayload
snapshot = client.subscribe_monitoring(check.uid)
Set the Webhook URL
webhook_url = client.set_webhook("https://service.example.com/webhooks/amlbot")
List the Supported Coins
Public, no credentials needed.
coins = client.coins()
print(coins.coins) # {"0": "ETC", "1": "ETH", "3": "BTC", ...}
print(coins.limited_coins) # address risk only, no connection risk
print(coins.precision_rates["ETH"]) # Decimal("1E-9"), from base units to whole coins
print(coins.assets_by_flow["lite"]) # assets supported by a check mode
List the Risk Signals
Public, no credentials needed.
signals = client.signals()
print(signals.groups["high"]) # ("enforcement_action", "ransom", "dark_market", ...)
print(signals.assessments["gambling"]) # 0.75
Read the Account Status
Checks and history pages carry the state of the account when they were returned.
check = client.check_address("0x28c6c06298d514db089934071355e5743bf21d60", "ETH")
print(check.account.credits) # credits left
print(check.account.flow) # check mode configured on the account
Field names
Fields use Python names. The names of the API are accepted as aliases:
| Field | API name |
|---|---|
risk_score, risk_level |
riskscore, risk_score_level |
blacklisted, blacklist_connections |
hasBlackListFlag, blackListsConnections |
checked_at (UTC datetime) |
timestamp |
transaction_hash, fiat_amount, high_risk |
tx, fiat, hasHighRisk |
pdf_report_url, xls_report_url, investigation_url |
pdfReport, xlsReport, investigationLink |
account.credits, account.promo, account.flow |
balance, promoFlow, amlFlow |
HistoryPage.entries, page_size, total_count |
data, pageLimit, totalCount |
Asynchronous Client
amlbot.AsyncClient has the same methods, and works with asyncio and trio.
import anyio
import amlbot
async with amlbot.AsyncClient() as client:
check = await client.check_address("0x28c6c06298d514db089934071355e5743bf21d60", "ETH")
with anyio.fail_after(600):
final = await client.wait_for_result(check)
async for entry in client.iterate_history(asset="ETH", maximum_pages=5):
print(entry.uid)
Errors
Every error raised by the package derives from AMLBotError:
AMLBotError
├── MissingCredentialsError signed request without credentials, nothing was sent
├── TransportError network or proxy failure; .request_sent tells if credits may be spent
├── HTTPStatusError non-2xx response without an AMLBot error body (.status_code, .body)
│ └── RateLimitError HTTP 429 (.retry_after)
├── APIError {"result": false, "description": ...}, e.g. "Invalid token" (.description)
├── ResponseValidationError body that does not match the documented shape (.body)
├── CheckFailedError check ended as "failed" or "error" (.uid, .status, .check)
├── CheckTimeoutError still pending at the wait deadline (.uid, .last_check)
└── WebhookError rejected webhook
├── WebhookSignatureError
├── WebhookTimestampError
└── WebhookPayloadError
try:
final = client.wait_for_result(client.check_address(address, "SOL"))
except amlbot.APIError as error:
print("Refused: %s" % error.description)
except amlbot.CheckFailedError as error:
print("Check %s ended as %s" % (error.uid, error.status))
except amlbot.CheckTimeoutError as error:
print("Check %s is still running, wait again later" % error.uid)
Advanced Configuration
The client can be configured further to meet the demands of the application:
client = amlbot.Client(
# None: read from AMLBOT_ACCESS_ID and AMLBOT_ACCESS_KEY
credentials=None,
# change the api url, a path prefix is kept
base_url="https://extrnlapiendpoint.silencatech.com",
# forward proxy with an allowlisted IP address
proxy=None,
# seconds, or an httpx.Timeout
timeout=30.0,
# extra headers sent with every request
headers=None,
# retries, see below
retry=amlbot.RetryPolicy(maximum_attempts=3, backoff=0.5, maximum_backoff=10.0),
# requests per second, a shared RateLimiter, or None to disable
rate_limit=5,
# default language of check results
locale=None,
# a fully configured httpx.Client, instead of proxy, timeout and headers
http_client=None,
)
Getting through the IP Allowlist
There are three ways to send the requests from an allowlisted IP address.
Forward proxy, such as Squid or an SSH tunnel. TLS stays end to end:
client = amlbot.Client(proxy="http://user:password@egress.internal:3128")
# needs the "socks" extra
client = amlbot.Client(proxy="socks5://127.0.0.1:1080")
Reverse proxy or API gateway:
client = amlbot.Client(
base_url="https://gateway.internal/amlbot",
headers={"X-Gateway-Key": "..."},
)
nginx configuration
location /amlbot/ {
proxy_pass https://extrnlapiendpoint.silencatech.com/;
proxy_set_header Host extrnlapiendpoint.silencatech.com;
proxy_ssl_server_name on;
}
Your own httpx client, for mTLS, custom transports or connection limits:
client = amlbot.Client(http_client=httpx.Client(proxy=..., verify=..., limits=...))
Retries
Paid requests are only retried when AMLBot provably never received them, so a check is never billed twice:
| Failure | Paid request (checks) | Free request (recheck, history...) |
|---|---|---|
| connection error, connection timeout, proxy error | retried | retried |
HTTP 429, honouring Retry-After |
retried | retried |
| HTTP 5xx, read timeout, dropped connection | not retried | retried |
client = amlbot.Client(retry=amlbot.NO_RETRY)
Rate Limiting
AMLBot allows 5 requests per second per account. Every client limits itself to that by default.
# share one budget between clients of the same process
limiter = amlbot.RateLimiter(limit=5)
first = amlbot.Client(rate_limit=limiter)
second = amlbot.Client(rate_limit=limiter)
Webhook
Configuration
import amlbot
# the access key is read from AMLBOT_ACCESS_KEY
verifier = amlbot.WebhookVerifier()
# or given explicitly
verifier = amlbot.WebhookVerifier("a0b1c2d3e4f5g6h7i8j9")
Usage
Verify a Check Result
AMLBot calls the webhook URL when a check reaches its final status.
notified = verifier.verify_check_result(request.headers, raw_body)
# fetch the result from the API, for free
check = client.recheck(notified.uid)
Verify a Monitoring Alert
AMLBot calls the webhook URL when a monitored address becomes riskier or blacklisted.
notification = verifier.verify_monitoring(raw_body)
print(notification.tonce) # UNIX timestamp of the alert
print(notification.payload.address)
print(notification.payload.risk_score)
FastAPI Example
@app.post("/webhooks/amlbot/checks")
async def check_webhook(request: Request) -> Response:
try:
notified = verifier.verify_check_result(request.headers, await request.body())
except amlbot.WebhookError:
return Response(status_code=401)
try:
check = await client.recheck(notified.uid)
except amlbot.CheckFailedError as error:
check = error.check
print(check)
return Response(status_code=200)
examples/fastapi_application.py is a complete and tested integration: start a check, receive both webhook kinds, and dispatch them to your own handlers.
Testing your Service
amlbot.testing builds correctly signed webhooks for your own tests:
from amlbot.testing import signed_check_result, signed_monitoring
headers, body = signed_check_result(access_key, {"result": True, "data": {...}})
test_client.post("/webhooks/amlbot/checks", headers=headers, content=body)
body = signed_monitoring(access_key, {"address": "0x...", "riskscore": 0.9})
test_client.post("/webhooks/amlbot/monitoring", content=body)
Metadata
Release files for amlbot 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| amlbot-0.1.0.tar.gz | 57.2 kB | With provenance | Details for amlbot-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| amlbot-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for amlbot-0.1.0-py3-none-any.whl |
Total release size: 96.5 kB
Release files / amlbot-0.1.0.tar.gz
| Download URL | amlbot-0.1.0.tar.gz |
|---|---|
| Size | 57.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b677b142a1dc534d81f8221fa6f75ab3ab86208b08c34c13b5cb95ab68b7fb96
|
|
BLAKE2b-256 checksum How to use checksums |
7952a6a168363bca6e6b759b8b01717ce378970db50fb4bb9b410bc98a792860
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logRelease files / amlbot-0.1.0-py3-none-any.whl
| Download URL | amlbot-0.1.0-py3-none-any.whl |
|---|---|
| Size | 39.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39c2acba8fa71e4b167a3ccd9553db2d2e39f657bfe47ed454875dcf7a9e481a
|
|
BLAKE2b-256 checksum How to use checksums |
1562cf8390d77d0a39a9e9d24d4f8513bbb7ff514142c5f1abff10eda3efcc61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logSecurity for amlbot 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for amlbot-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.