# API Reference

## Проверка адреса кошелька

<mark style="color:green;">`POST`</mark> `https://aml.alfabit.org/api/public/check/address/`

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

#### Request Body

| Name                                      | Type    | Description                                                                                                                    |
| ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| coin<mark style="color:red;">\*</mark>    | string  | BTC, TRX, ETH, BCH, BSV, LTC, BSC, TetherOMNI, ETC, XRP, MATIC, SOL, ADA, DOGE, ZEC, ALGO, ARB, DOT, XLM, NEAR, XTZ, TON, AVAX |
| address<mark style="color:red;">\*</mark> | string  | Адрес кошелька выбранной валюты                                                                                                |
| callback\_url                             | HttpUrl | Callback url для отправки хука с отчета о выполненной проверке                                                                 |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}
{% code fullWidth="false" %}

```json
Ответ на запрос
{
    "result": True,
    "message": "Task with report was added to queue",
    "report_id": 1
}


WEbhook с AML отчетом, который придет на указанный callback url

{
  "id": 1,
  "address": "bc1q860ry4y7vqpmykpzev4kta6d8dpfs226r8gv6c",
  "hash": "",
  "created_date": "1704362643.4713116",
  "check_response": {
    "detail": "success",
    "uid": "6596827e858c7765122575",
    "address_details_data": {
      "black_lists_connections": false,
      "has_black_list_flag": false,
      "counterparty": {
        "address": "bc1q860ry4y7vqpmykpzev4kta6d8dpfs226r8gv6c"
      },
      "received_usd": null,
      "sent_usd": null,
      "balance_usd": null,
      "balance_approximate": null,
      "balance": null,
      "reported_balance_precision": null,
      "tokens": {},
      "extras": {
        "tags": [],
        "services": {
          "use_platform": [
            "Coinbase",
            "Kucoin",
            "Binance",
            "Paxful",
            "Bybit",
            "DarkMarket-OMG",
            "BitZlato.com"
          ]
        }
      }
    },
    "Address": "bc1q860ry4y7vqpmykpzev4kta6d8dpfs226r8gv6c",
    "TxHash": "",
    "Blockchain": "BTC",
    "Risk": 45,
    "Cluster": "",
    "Category": "Dark Market 10.8%,Enforcement action 0.9%,Gambling 0.4%,Illegal Service 0.2%,Miner 0.1%,Mixer 0.1%,Other 0.2%,Payment 0.6%,Sanctions 1.3%,Wallet 0.2%,Exchange 79.2%,Risky Exchange 3.8%,P2P Exchange 0.5%,P2P exchange | High ML risk 1.2%",
    "Status": "Active",
    "First": null,
    "Last": null,
    "Received": 0,
    "Sent": 0,
    "Transactions": null,
    "Time": "2024-01-04 10:03:42",
    "CategoryArray": {
      "Dark Market": 10.8,
      "Enforcement action": 0.9,
      "Gambling": 0.4,
      "Illegal Service": 0.2,
      "Miner": 0.1,
      "Mixer": 0.1,
      "Other": 0.2,
      "Payment": 0.6,
      "Sanctions": 1.3,
      "Wallet": 0.2,
      "Exchange": 79.2,
      "Risky Exchange": 3.8,
      "P2P Exchange": 0.5,
      "P2P exchange | High ML risk": 1.2
    }
  },
  "requests_left": 839
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}
{% endtabs %}

## Проверка хэша транзакции

<mark style="color:green;">`POST`</mark> `https://aml.alfabit.org/api/public/check/hash/`

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

#### Request Body

| Name                                      | Type    | Description                                                                                                                    |
| ----------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
| coin<mark style="color:red;">\*</mark>    | string  | BTC, TRX, ETH, BCH, BSV, LTC, BSC, TetherOMNI, ETC, XRP, MATIC, SOL, ADA, DOGE, ZEC, ALGO, ARB, DOT, XLM, NEAR, XTZ, TON, AVAX |
| hash<mark style="color:red;">\*</mark>    | string  | Хэш транзакции выбранной валюты                                                                                                |
| callback\_url                             | HttpUrl | Callback url для отправки хука с отчета о выполненной проверке                                                                 |
| address<mark style="color:red;">\*</mark> | string  | Адрес получателя                                                                                                               |
| direction                                 | string  | deposit(default)/withdrawal                                                                                                    |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}
{% code fullWidth="false" %}

```json
Ответ на запрос
{
    "result": True,
    "message": "Task with report was added to queue",
    "report_id": 1
}


WEbhook с AML отчетом, который придет на указанный Callback url
{
  "id": 1,
  "address": "bc1qctkm5xa50wtls89n8k6tndygc7pxqu8dy8f6tj",
  "hash": "ff8a9d25e77a19f0b90bf5231e21621a73e86e2c20a1673579291c3924d0540c",
  "created_date": "1704365109.1574",
  "check_response": {
    "detail": "success",
    "uid": "65968c215d1a6515862953",
    "address_details_data": {
      "black_lists_connections": false,
      "has_black_list_flag": false,
      "counterparty": {
        "address": "bc1qctkm5xa50wtls89n8k6tndygc7pxqu8dy8f6tj"
      },
      "received_usd": null,
      "sent_usd": null,
      "balance_usd": null,
      "balance_approximate": null,
      "balance": null,
      "reported_balance_precision": null,
      "tokens": {},
      "extras": {
        "tags": [],
        "services": []
      }
    },
    "Address": "bc1qctkm5xa50wtls89n8k6tndygc7pxqu8dy8f6tj",
    "TxHash": "ff8a9d25e77a19f0b90bf5231e21621a73e86e2c20a1673579291c3924d0540c",
    "Blockchain": "BTC",
    "Risk": 72,
    "Cluster": "",
    "Category": "Payment 3.5%,Exchange 0.2%,Risky Exchange 96.2%",
    "Status": "Active",
    "First": null,
    "Last": null,
    "Received": 0,
    "Sent": 0,
    "Transactions": null,
    "Time": "2024-01-04 10:44:49",
    "CategoryArray": {
      "Payment": 3.5,
      "Exchange": 0.2,
      "Risky Exchange": 96.2
    }
  },
  "requests_left": 838
}
```

{% endcode %}
{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}
{% endtabs %}

## Доступные токены для проверки

<mark style="color:blue;">`GET`</mark> `https://aml.alfabit.org/api/public/coins/`

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}

```json
{
    "result": true,
    "coins": {
        "BTC": "BTC",
        "TRX": "TRX",
        "ETH": "ETH",
        "BCH": "BCH",
        "BSV": "BSV",
        "LTC": "LTC",
        "BSC": "BSC",
        "TetherOMNI": "TetherOMNI",
        "ETC": "ETC",
        "XRP": "XRP",
        "MATIC": "MATIC",
        "SOL": "SOL",
        "ADA": "ADA",
        "DOGE": "DOGE",
        "ZEC": "ZEC",
        "ALGO": "ALGO"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}
{% endtabs %}

## История проверок

<mark style="color:blue;">`GET`</mark> `https://aml.alfabit.org/api/public/checks/history/`

#### Query Parameters

| Name        | Type   | Description                  |
| ----------- | ------ | ---------------------------- |
| check\_type | string | Тип проверки address/hash    |
| check\_id   | string | id проверки                  |
| page\_size  | string | Кол-во элементов на странице |
| page        | string | Номер страницы               |

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}

```json
{
  "count": 11,
  "pages": 2,
  "next": 2,
  "previous": null,
  "results": [
    {
      "id": 1,
      "hash": null,
      "check_response": {
        "detail": "Success",
        "Address": "bc1q860ry4y7vqpmykpzev4kta6d8dpfs226r8gv6c",
        "Blockchain": "BTC",
        "Risk": 12.0,
        "Category": "Darknet Marketplace 7.3%,Illegal Service 0.6%,Payment Processor 0.1%,Sanctions 1.7%,Exchange With Low ML Risk 83.4%,Exchange With Very High ML Risk 4.1%,P2P Exchange With High ML Risk 2.6%",
        "Status": "Active",
        "First": "Jan 09, 2023 09:04 PM",
        "Last": "Jan 10, 2023 05:33 PM",
        "Received": 47.95938782,
        "Sent": 46.91616405,
        "Transactions": 50,
        "Time": "Jan 10, 2023 06:16 PM GMT"
      },
      "callback_url": "https://webhook.site/my-aml-check",
      "address": "bc1q860ry4y7vqpmykpzev4kta6d8dpfs226r8gv6c",
      "created_date": "1673374596.62137",
      "api_user_id": 1,
      "status": "Sent"
    },
    ...
  ]
}
```

{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}
{% endtabs %}

## Баланс проверок

<mark style="color:blue;">`GET`</mark> `https://aml.alfabit.org/api/public/balance/`

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}

```json
{
    "user_id": 2,
    "available_count_checks": 100
}
```

{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}
{% endtabs %}

## Генерация pdf-файла

<mark style="color:blue;">`GET`</mark> `https://aml.alfabit.org/api/public/pdf-file/`

#### Query Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| check\_id | string | ID проверки |

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}

```json
{
    "status": True, 
    "url": url
}
```

{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}

{% tab title="403: Forbidden Недостаточно прав" %}

```json
{
    "detail": "You can't view checks that aren't yours"
}
```

{% endtab %}
{% endtabs %}

## Категории риска

<mark style="color:blue;">`GET`</mark> `https://aml.alfabit.org/api/public/categories`

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | api ключ    |

{% tabs %}
{% tab title="200: OK Успешный запрос" %}

```json
{
    "categories_group": {
        "high": [
            "Fraud shop",
            "Illicit actor organization",
            "High risk jurisdiction",
            "Enforcement action",
            "Ransom",
            "Dark Market",
            "Dark Service",
            "Illegal Service",
            "Mixer",
            "Scam",
            "Gambling",
            "Stolen Coins",
            "Exchange fraudulent",
            "Child exploitation",
            "Sanctions",
            "Terrorism financing",
            "Special measures",
            "Online pharmacy",
            "Malware"
        ],
        "medium": [
            "Infrastructure as a service",
            "Decentralized exchange contract",
            "Smart contract",
            "Token smart contract",
            "Lending contract",
            "Protocol privacy",
            "Unnamed service",
            "ATM",
            "Risky Exchange",
            "Exchange | Moderate ML risk",
            "Exchange | High ML risk",
            "Exchange | Very High ML risk",
            "P2P exchange | High ML risk",
            "Liquidity pools"
        ],
        "low": [
            "Merchant services",
            "ICO",
            "Exchange",
            "Trusted exchange",
            "Wallet",
            "Miner",
            "Payment",
            "Marketplace",
            "Exchange | Low ML risk",
            "P2P Exchange | Low ML risk",
            "P2P Exchange",
            "Seized assets",
            "Other",
            "Bridge",
            "NFT platform collection"
        ]
    },
    "categories_assessments": {
        "Fraud shop": 100,
        "Illicit actor organization": 100,
        "High risk jurisdiction": 100,
        "Enforcement action": 100,
        "Ransom": 100,
        "Dark Market": 100,
        "Dark Service": 100,
        "Illegal Service": 100,
        "Mixer": 100,
        "Scam": 100,
        "Stolen Coins": 100,
        "Exchange fraudulent": 100,
        "Child exploitation": 100,
        "Sanctions": 100,
        "Terrorism financing": 100,
        "Special measures": 100,
        "Online pharmacy": 100,
        "Malware": 100,
        "Gambling": 75,
        "Infrastructure as a service": 50,
        "Decentralized exchange contract": 50,
        "Smart contract": 50,
        "Token smart contract": 50,
        "Lending contract": 50,
        "Protocol privacy": 50,
        "Unnamed service": 50,
        "ATM": 50,
        "Risky Exchange": 50,
        "Exchange | Moderate ML risk": 50,
        "Exchange | High ML risk": 50,
        "Exchange | Very High ML risk": 50,
        "P2P exchange | High ML risk": 50,
        "Liquidity pools": 50,
        "Merchant services": 10,
        "ICO": 10,
        "Exchange": 10,
        "Trusted exchange": 10,
        "Wallet": 10,
        "Payment": 10,
        "Marketplace": 10,
        "Exchange | Low ML risk": 10,
        "P2P Exchange | Low ML risk": 10,
        "P2P Exchange": 10,
        "Seized assets": 10,
        "Other": 10,
        "Bridge": 10,
        "NFT platform collection": 10,
        "Miner": 0
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized Необходимо авторизоваться для запроса" %}

```json
{
    "detail": "Not authenticated"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Системная ошибка" %}

{% endtab %}
{% endtabs %}

### &#x20;<a href="#id-681b5ae3d2" id="id-681b5ae3d2"></a>
