> ## Documentation Index
> Fetch the complete documentation index at: https://api.smartlead.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Webhook

> Update the configuration of an existing webhook

<Note>
  Use this endpoint to update the configuration of an existing webhook.
</Note>

## Path Parameters

<ParamField path="webhook_id" type="number" required>
  The webhook ID to update
</ParamField>

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your SmartLead API key
</ParamField>

## Request Body

<ParamField body="name" type="string">
  A descriptive name for the webhook
</ParamField>

<ParamField body="webhook_url" type="string">
  The URL to receive webhook events
</ParamField>

<ParamField body="event_types" type="array">
  Array of event types to subscribe to (e.g. `EMAIL_SENT`, `EMAIL_OPENED`, `EMAIL_REPLIED`, `EMAIL_CLICKED`, `LEAD_UNSUBSCRIBED`, `EMAIL_BOUNCED`)
</ParamField>

<ParamField body="categories" type="array">
  Array of lead categories to filter events by
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://server.smartlead.ai/api/v1/webhook/update/12345?api_key=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My Updated Webhook",
      "webhook_url": "https://example.com/webhook",
      "event_types": ["EMAIL_SENT", "EMAIL_REPLIED", "EMAIL_BOUNCED"],
      "categories": []
    }'
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"
  WEBHOOK_ID = 12345

  response = requests.put(
      f"https://server.smartlead.ai/api/v1/webhook/update/{WEBHOOK_ID}",
      params={"api_key": API_KEY},
      json={
          "name": "My Updated Webhook",
          "webhook_url": "https://example.com/webhook",
          "event_types": ["EMAIL_SENT", "EMAIL_REPLIED", "EMAIL_BOUNCED"],
          "categories": []
      }
  )

  result = response.json()
  print(result)
  ```

  ```javascript JavaScript theme={null}
  const API_KEY = 'YOUR_API_KEY';
  const WEBHOOK_ID = 12345;

  const response = await fetch(
    `https://server.smartlead.ai/api/v1/webhook/update/${WEBHOOK_ID}?api_key=${API_KEY}`,
    {
      method: 'PUT',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        name: 'My Updated Webhook',
        webhook_url: 'https://example.com/webhook',
        event_types: ['EMAIL_SENT', 'EMAIL_REPLIED', 'EMAIL_BOUNCED'],
        categories: []
      })
    }
  );

  const result = await response.json();
  console.log(result);
  ```
</RequestExample>

## Response Codes

<ResponseField name="200" type="Success">
  Webhook added/updated successfully
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Invalid request parameters
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Invalid or missing API key
</ResponseField>

<ResponseField name="404" type="Not Found">
  Campaign not found
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "ok": true,
    "id": 12345,
    "message": "Webhook saved successfully"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "message": "Invalid API Key"
  }
  ```
</ResponseExample>

## Related Endpoints

* [Get Campaign Webhooks](/api-reference/webhooks/get)
* [Delete Campaign Webhook](/api-reference/webhooks/delete)
