> For the complete documentation index, see [llms.txt](https://eshop.gitbook.io/eshopbox-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eshop.gitbook.io/eshopbox-developers/advanced/events-webhook/create-a-webhook.md).

# Create a Webhook

## Create a Webhook

<mark style="color:green;">`POST`</mark> `https://{{workspace}}.myeshopbox.com/api/v1/webhook`

This endpoint allows you to register a webhook.

#### Headers

| Name          | Type   | Description                         |
| ------------- | ------ | ----------------------------------- |
| Authorization | string | The Bearer token to access the API. |

#### Request Body

| Name              | Type   | Description                                                                   |
| ----------------- | ------ | ----------------------------------------------------------------------------- |
| resource          | string | The resource affected by this event.                                          |
| eventType         | string | It defines the event in CRUD format.                                          |
| eventSubType      | string | This defines the event ver specifically for an event Type                     |
| version           | string | It is used for versioning the events                                          |
| webhookMethod     | string | The CRUD format of API to be triggered by the webhook                         |
| webhookUrl        | string | The URL of the API which is supposed to be triggered outside Eshopbox domain. |
| externalChannelID | string | The channel which has registered the webhook                                  |

{% tabs %}
{% tab title="200 Webhook successfully registered." %}

```
{
    "id":"1",
    "resource": "channel_inventory",
    "eventType": "POST",
    "eventSubType": "updated",
    "version": "v1",
    "externalChannelID" : "CLARKS",
    "webhookUrl": "https://hooks.zapier.com/fake-subscription-url",
    "webhookMethod": "POST",
    "createdAt": "2020-02-27T18:32:15.528+05:30",
    "updatedAt": "2020-02-27T18:32:15.528+05:30"
}
```

{% endtab %}
{% endtabs %}

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

```
curl --location --request POST 'localhost:8080/_ah/api/esb/v1/client-webhook' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{Access-Token}}'\
--data-raw '{
	
	
 "resource": "channel_inventory",
    "eventType": "POST",
    "eventSubType": "updated",
    "version": "v1",
    "externalChannelID" : "CLARKS",
    "webhookUrl": "https://hooks.zapier.com/fake-subscription-url",
    "webhookMethod": "POST"
}'
```

{% endtab %}
{% endtabs %}
