> ## Documentation Index
> Fetch the complete documentation index at: https://www.meilisearch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Configure HTTP webhooks to receive notifications when Meilisearch indexing tasks complete or fail.

Webhooks let Meilisearch notify an external HTTP endpoint whenever a task completes. Use them to trigger downstream actions automatically, such as purging a cache after a successful index update or alerting your team when a task fails.

Webhooks are configured per project in **Project Settings > Webhooks**. Up to 20 webhooks can be configured per project.

![Webhooks section in Project Settings showing the Add webhook button and description](https://mintcdn.com/meilisearch-6b28dec2/AA64_qkPfo8VywKl/assets/images/platform/management/webhooks_empty.png?fit=max\&auto=format\&n=AA64_qkPfo8VywKl\&q=85\&s=74516c850983fb3cf3decbe5d64242ed)

## Adding a webhook

1. Go to **Project Settings > Webhooks** and click **+ Add webhook**.

![Add webhook modal with Webhook URL and Authorization Header fields](https://mintcdn.com/meilisearch-6b28dec2/AA64_qkPfo8VywKl/assets/images/platform/management/webhooks_add.png?fit=max\&auto=format\&n=AA64_qkPfo8VywKl\&q=85\&s=2e751b951b6192c9659a48e1025b6c1a)

2. Enter the **Webhook URL**: the endpoint where Meilisearch will send POST requests with task data.
3. Optionally, enter an **Authorization Header** (for example, `Bearer your-secret-token`). This header is sent with every webhook request so your endpoint can verify the source.
4. Click **Add webhook**.

## How webhooks work

When a task completes, Meilisearch sends an HTTP POST request to your configured URL. The request body is [ndjson](https://jsonlines.org/) (newline-delimited JSON), with one task object per line matching the format returned by the [Tasks API](https://www.meilisearch.com/docs/reference/api/tasks/get-task.md).

```
{"uid":1,"indexUid":"movies","status":"succeeded","type":"documentAdditionOrUpdate",...}
{"uid":2,"indexUid":"movies","status":"failed","type":"documentAdditionOrUpdate",...}
```

Your endpoint must respond with a 2xx status code. Non-2xx responses are treated as failures and retried with exponential backoff.

> [!WARNING]
>
> Multiple active webhooks may impact performance. Keep only the webhooks you actively use.

## Securing your endpoint

Always validate the `Authorization` header on incoming webhook requests. Set a long random secret and reject requests that do not match.

```js theme={null}
app.post('/webhook', (req, res) => {
  if (req.headers['authorization'] !== process.env.WEBHOOK_SECRET) {
    return res.status(401).end();
  }
  // Process the ndjson payload
  res.status(200).end();
});
```

## Example use cases

| Use case | Description |
| - | - |
| **Cache purge** | Invalidate your CDN or application cache after a `documentAdditionOrUpdate` task succeeds |
| **Slack notification** | Send a message to a Slack channel when any task fails |
| **CI/CD integration** | Signal a deployment pipeline that a new index is ready |
| **Audit log** | Append every task event to an external log store for compliance |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.