# Webhooks

Webhooks are used to send real-time [events](/core-api-reference/events.md) to external listeners and can be managed via API or using the related back-office app in the *Apps* section of the admin dashboard.

Newly created webhooks are enabled by default. You can disable them by passing the `_disable` trigger attribute and eventually re-enable them by passing the `_enable` trigger attribute.

When an enabled webhook is triggered, Commerce Layer sends a `POST` request to the webhook's `callback_url` and the related [event callback](/core-api-reference/event_callbacks.md) is created. The request contains a JSON payload in the same format that you get when fetching the same resource through the REST API. For each resource, you can also configure the related resources that should be [included](https://docs.commercelayer.io/developers/including-associations) in the request body (listed in the `include_resources` attribute).

{% hint style="info" %}
The endpoint listening for webhooks has **5 seconds** to respond with a **`2xx`** (usually `200` ) response code, acknowledging a successful delivery. If the request times out or gets a response with a status code other than `2xx`, it is considered failed.
{% endhint %}

## Circuit breaker

Each webhook has a `circuit_state` breaker (`closed` by default) that can become `open` once the number of consecutive failures exceeds the [specified threshold](https://docs.commercelayer.io/developers/real-time-webhooks#handling-webhook-failures), in such case no further calls to the failing callback are made. You can check the number of consecutive failures recorded by the circuit breaker associated with a webhook by inspecting the `circuit_failure_count` attribute. The counter will be reset on the first successful call to the callback URL. You can force the circuit's reset (to the `closed` state and zero failures count) by updating the webhook with the trigger attribute `_reset_circuit` set to `true`.

<details>

<summary>How-to</summary>

Check the related [guide](https://docs.commercelayer.io/developers/real-time-webhooks) for more info about real-time webhooks and the related events.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
