---
title: "Webhooks"
description: "Webhooks"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/python/reference/webhooks"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-20"
---

# Webhooks

## Webhooks

A [webhook](/docs/headless-cms/about-webhooks) is a mechanism that sends real-time information to any third-party app or service to keep your application in sync with your Contentstack account. Webhooks allow you to specify a URL to which you would like Contentstack to post data when an event happens.

## create

The create method creates a new webhook in a specific stack.

```
data = {
"webhook":{
               "name":"Test",
               "destinations":[
               {
                   "target_url":"http://example.com",
                   "http_basic_auth":"basic",
                   "http_basic_password":"test",
                   "custom_header":[
                   {
                       "header_name":"Custom",
                       "value":"testing"
                   }
                   ]
               }
               ],
               "notifiers": "dave.joe@gmail.com",
               "channels":[
               "assets.create"
               ],
               "branches":[
               "main"
               ],
               "retry_policy":"manual",
               "disabled":false,
               "concise_payload":true
           }
           }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks().create(data).json()
```

Data required to create a new webhook

## delete

The delete method removes an existing webhook from the stack permanently.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = response = client.stack('api_key').webhooks('webhook_uid').delete().json()
```

UID of the webhook

## executions

The execution method retrieves the execution details of a specific webhook, which includes the execution UID.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks('webhook_execution_uid').executions().json()
```

UID of the webhook execution

## export

The export method exports an existing webhook to a downloadable JSON file.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks('webhook_uid').export().json()
```

UID of the webhook

## fetch

The fetch method retrieves the details of a specific webhook.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks('webhook_uid').fetch().json()
```

UID of the webhook

## find

The find method retrieves the details of all the webhooks available in the stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack("api_key").webhooks().find().json()
```

## import

The import method imports an existing webhook by uploading a JSON file.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
file_path = "tests/resources/mock_content_types/import_content_types.json"
response = client.stack('api_key').webhooks().imports(file_path).json()
```

The path of the file to be uploaded

## logs

The logs method retrieves the latest execution log of the webhooks.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks().logs('execution_uid').json()
```

UID of the execution

## retry

The retry method makes a manual attempt to execute a webhook after the automatic attempts are exhausted.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks().retry('execution_uid').json()
```

UID of the execution

## update

The update method allows you to update the details of an existing webhook in the stack.

```
data = {
        "webhook":{
            "name":"Updated webhook",
            "destinations":[
            {
                "target_url":"http://example.com",
                "http_basic_auth":"basic",
                "http_basic_password":"test",
                "custom_header":[
                {
                    "header_name":"Custom",
                    "value":"testing"
                }
                ]
            }
            ],
            "channels":[
            "assets.create"
            ],
            "branches":[
            "main"
            ],
            "retry_policy":"manual",
            "disabled":true,
            "concise_payload":true
        }
        }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').webhooks('webhook_uid').update(data).json()
```

The updated data of the webhook

## Webhooks | Python Management SDK | Contentstack

Webhooks send real-time event data to third-party apps to keep them in sync with your account in the Contentstack Python Management SDK.