# Webhook

## Principles

A webhook is an HTTP endpoint that will be called by the BlurIt API when the status of a job changes. Webhooks are the preferred way to be notified of a status change as it eliminates the needs to periodically call the `GET /innovation-service/anonymization` route to get a job status.

When using webhooks, you’re in charge of developing the endpoint with respect to the specifications (see below) and making the endpoint available on the Internet. The endpoint must no be secured with IP filtering or other similar security controls.

## Create you webhook endpoint

To process webhooks, you need to:

1. Expose an endpoint on your server
2. Configure your endpoint on your customer manager or directly from our API.
3. Handle webhook events

### Step 1

To receive webhook events you need to develop an endpoint which can receive a HTTP POST call.

### Step 2

Configure your endpoints in your manager developer section, or with our webhook API (see [#add-your-endpoint-in-our-system](#add-your-endpoint-in-our-system "mention")).

NOTE: you cannot configure more than 5 endpoints.

### Step 3

When we deliver a webhook event to your server:

1. First check if the `X-Auth-Token` header exists in the request and that its value is the same as the one we provided to you during the creation of the endpoint (see [Setting up with the Manager](/webhook/setting-up-with-the-manager.md)). If the header is not present or do not match the one that is configured for your endpoint, reject the call.
2. Process the request to extract the taskId and the status (see [#request-format](#request-format "mention") below)
3. Acknowledge the webhook event (see [#response-format](#response-format "mention") below). **Warning : if you don't respect the response format, we might stop calling your endpoint and you may not receive further notifications.**
4. Apply your business logic

## Webhook specifications

### Request format

The requests made to your endpoint will be formatted as follow:

```
{
    "taskId": "XXXXXXXXXXX",
    "status": "XXXXX"
}
```

`status` can have the following values: `Sent`, `Started`, `Succeeded`, `Failed`

### Response format

Your endpoint must send a `200 OK` response formatted as follow:

```
{
    "taskId": "XXXXXXXXXXX"
}
```

## Workflow

* `POST /innovation-service/anonymization` to create a anonymization job. The route will return a unique job ID.

We will then send you POST requests to your endpoint to notify you when the status of the task changes.

* `GET /innovation-service/anonymization?anonymization_job_id={{your_job_id}}` . To get the url of the processed le.
* `GET /innovation-service/result/{fileName}` to download the actual processed media.

<figure><img src="/files/6dihl0RB7O4yFgsYOLbn" alt=""><figcaption></figcaption></figure>

## Add your endpoint in our system

Once you have developed your endpoint route, you can add its URL either in the Manager (see [Setting up with the Manager](/webhook/setting-up-with-the-manager.md)) or by calling an API route (see [Setting up with API calls](/webhook/setting-up-with-api-calls.md)).


---

# 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://doc-api.blurit.io/webhook.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.
