# Webhooks

## Overview

By setting a `webhook` URL in the request to [API Endpoints](/cloud-api/api-endpoints.md#create-anonymization-task), a HTTPS POST request will be sent to the specified URL, as soon as the submitted file has finished processing.

{% code overflow="wrap" %}

```python
payload = {
    "anonymization_method": "blur",
    "face": True,
    "webhook": "https://example.com/webhook/dev?param=test"
}

response = requests.post(
     "https://api.celantur.com/v2/task/", 
      data=json.dumps(payload), 
      headers={'Authorization': auth_token}
 )

```

{% endcode %}

The payload sent to the webhook URL looks like this:

```json
{
    "customer_id": "247d7a0f-f03c-40b9-bed6-b2c4a00c5d80", 
    "task_id": 1693295888421318, 
    "task_status": "done", 
    "anonymized_url": "https://cloudapi-customer-uploads-v2-dev-eu-central-1.s3.amazonaws.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxxxxxxxxxxxxxx/1/anonymized.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVKZ73AQDINGO3STH%2F20230829%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20230829T080023Z&X-Amz-Expires=14400&X-Amz-SignedHeaders=host&X-Amz-Signature=5c99b77982c11da5e9889d3c88c0d2a109270d8c2b0f17d61566ccxxx0495xxx”
}

```

{% hint style="info" %}
Webhooks are especially useful to trigger the download of a file, right after it has finished processing.
{% endhint %}

## Webhook status

The task’s webhook status is either:&#x20;

* `empty`
* `set`
* `sent`
* `failed`

The webhook status can be retrieved from the response bodies of [API Endpoints](/cloud-api/api-endpoints.md#get-task) and [API Endpoints](/cloud-api/api-endpoints.md#get-task-status) endpoint.

## Prerequisites for webhooks

* [ ] Make sure you have a publicly available HTTPS endpoint (URL) on your server.
* [ ] Set the webhook URL in the [API Endpoints](/cloud-api/api-endpoints.md#create-anonymization-task) request's JSON body.


---

# 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.celantur.com/cloud-api/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.
