# Streaming API

## Create Stream

You can create streaming with this service. Just add **address** and **webhook** data then we will send notification to your webhook. Also if you want set your live anti money laundering tracking webhook you can set with this request (this is optional).

<mark style="color:green;">`POST`</mark> `https://api.getdefy.co/v2/stream/create`

#### Header Parameters

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| apikey<mark style="color:red;">\*</mark> | String | Service Apikey |

#### &#x20;Body Parameters

| Name                                      | Type   | Description          |
| ----------------------------------------- | ------ | -------------------- |
| address<mark style="color:red;">\*</mark> | String | Wallet Address       |
| webhook<mark style="color:red;">\*</mark> | String | Webhook URL          |
| aml\_webhook                              | String | Live AML Webhook URL |

{% tabs %}
{% tab title="200: OK " %}
{% code lineNumbers="true" %}
```json
{
    "code": 0,
    "message": "OK",
    "data": null
}
```
{% endcode %}
{% endtab %}

{% tab title="400: Bad Request " %}
{% code lineNumbers="true" %}
```json
{
    "message": "Invalid webhook.",
    "code": 5004
}
```
{% endcode %}
{% endtab %}
{% endtabs %}

## Delete Stream

You can stop your streaming with this request. Just enter which address you want to stop.

<mark style="color:red;">`DELETE`</mark> `https://api.getdefy.co/v2/stream/delete`

#### Header Parameters

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| apikey<mark style="color:red;">\*</mark> | String | Service Apikey |

#### Query Parameters

| Name                                      | Type   | Description    |
| ----------------------------------------- | ------ | -------------- |
| address<mark style="color:red;">\*</mark> | String | Wallet Address |

{% tabs %}
{% tab title="200: OK " %}
```json
{
    "code": 0,
    "message": "OK",
    "data": null
}
```
{% endtab %}

{% tab title="400: Bad Request " %}
```json
{
    "message": "Invalid Address.",
    "code": 5002
}
```
{% endtab %}
{% endtabs %}

## List Streamed Addresses

You can list your streaming addresses with this request.

<mark style="color:blue;">`GET`</mark> `https://api.getdefy.co/v2/stream/list`

#### Query Parameters

| Name  | Type | Description           |
| ----- | ---- | --------------------- |
| page  | 1    | Page Number (Min: 1)  |
| limit | 50   | Page Limit (Max: 100) |

{% tabs %}
{% tab title="200: OK " %}


```json
{
    "code": 0,
    "message": "OK",
    "data": [
        {
            "address": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
            "stream_webhook": "https://www.getdefy.co/webhook",
            "created_at": "2024-07-25T13:57:09.644Z",
            "has_stream": true
        },
        {
            "address": "0x03906d9ce98bbbc8b7242ecf9448a4b4d2310705",
            "stream_webhook": "https://www.getdefy.co/webhook",
            "created_at": "2024-07-20T19:10:58.834Z",
            "has_stream": true
        }
    ],
    "page_count": 138
}
```
{% endtab %}

{% tab title="400: Bad Request " %}
```json
{
  "message": "Error Message",
  "status": 5002
}
```
{% endtab %}
{% endtabs %}
