> For the complete documentation index, see [llms.txt](https://api.omicall.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.omicall.com/omicall-api/webhooks.md).

# Webhooks

## Danh sách webhook

<mark style="color:blue;">`GET`</mark> `[URL/api/webhooks/list`

Danh sách webhook

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Access token |

{% tabs %}
{% tab title="200 Danh sách Webhook" %}

```
{
    "status_code": 9999,
    "instance_id": "stg",
    "payload": [
        {
            "url": "https://demo.omicall.com/omicall/updatecall",
            "type": "call",
            "status": "actived"
        }
    ],
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Đăng ký Webhook

<mark style="color:green;">`POST`</mark> `[URL]/api/webhooks/register`

Ghi danh Webhook

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Access token |

#### Request Body

| Name    | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| webhook | object | <p>Đối tượng :<br>- <strong>type</strong> : <em>Loại Webhook</em> : call, contact<br>- <strong>url</strong> : <em>Đường dẫn Webhook</em> <br><em>- <strong>events</strong> : \["ringing",",answered","hangup"]</em></p><p><br><code>{</code> <br> <code>"webhook" : {</code> <br>   <code>"type" : "call",</code> <br>    <code>"url" : "https\://...." ,</code></p><p>    <code>"events": null</code><br>  <code>}</code> <br><code>}</code></p> |

{% tabs %}
{% tab title="200 Ghi danh Webhook thành công" %}

```
{
    "status_code": 9999,
    "instance_id": "stg",
    "payload": [
        {
            "url": "https://demo.omicall.com/omicall/updatecall",
            "type": "call",
            "status": "actived"
        }
    ],
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Hủy Webhook

<mark style="color:green;">`POST`</mark> `[URL]/api/webhooks/destroy?hook_type=`

Hủy đăng ký Webhook

#### Query Parameters

| Name       | Type   | Description                                                                    |
| ---------- | ------ | ------------------------------------------------------------------------------ |
| hook\_type | string | <p>Một trong các giá trị sau<br>- <strong>call</strong> : Lịch sử cuộc gọi</p> |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Access token |

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

```
```

{% endtab %}
{% endtabs %}
