# Update webhook

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

PUT https://dashboard.alchemy.com/api/update-webhook

Changes a webhook's active state, name, or URL. The JSON body takes
`webhook_id` and at least one of `is_active`, `name`, and `webhook_url`.
Fields that are left out keep their values.

Reference: https://www.alchemy.com/docs/data/webhooks/webhooks-api-endpoints/update-webhook

## Headers

| Name | Type | Required | Description |
|------|------|----------|-------------|
| X-Alchemy-Token | string | Yes | Your team's auth token. Find it on the Webhooks page of the Alchemy dashboard. |

## Code Examples

### cURL

```bash
curl --request PUT \
  --url https://dashboard.alchemy.com/api/update-webhook \
  --header 'Content-Type: application/json' \
  --header 'X-Alchemy-Token: string' \
  --data '{
  "is_active": false,
  "webhook_id": "string",
  "name": "string",
  "webhook_url": "string"
}'
```

### JavaScript

```javascript
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', 'X-Alchemy-Token': 'string'},
  body: JSON.stringify({is_active: false, webhook_id: 'string', name: 'string', webhook_url: 'string'})
};

fetch('https://dashboard.alchemy.com/api/update-webhook', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://dashboard.alchemy.com/api/update-webhook"

payload = {
    "is_active": False,
    "webhook_id": "string",
    "name": "string",
    "webhook_url": "string"
}
headers = {
    "Content-Type": "application/json",
    "X-Alchemy-Token": "string"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://dashboard.alchemy.com/api/update-webhook"

	payload := strings.NewReader("{\n  \"is_active\": false,\n  \"webhook_id\": \"string\",\n  \"name\": \"string\",\n  \"webhook_url\": \"string\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("X-Alchemy-Token", "string")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.put("https://dashboard.alchemy.com/api/update-webhook")
  .header("Content-Type", "application/json")
  .header("X-Alchemy-Token", "string")
  .body("{\n  \"is_active\": false,\n  \"webhook_id\": \"string\",\n  \"name\": \"string\",\n  \"webhook_url\": \"string\"\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://dashboard.alchemy.com/api/update-webhook");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Alchemy-Token", "string");
request.AddJsonBody("{\n  \"is_active\": false,\n  \"webhook_id\": \"string\",\n  \"name\": \"string\",\n  \"webhook_url\": \"string\"\n}", false);
var response = await client.PutAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /api/update-webhook
method: PUT
operation:
  operationId: UpdateWebhook
  responses:
    '200':
      description: Updated the webhook
      content:
        application/json:
          schema:
            description: |-
              Standard API response wrapper.
              All API responses are wrapped in this format for consistency.
            properties:
              data:
                description: A webhook. A key whose value would be null is left out.
                properties:
                  id:
                    type: string
                    description: The webhook ID. Other endpoints take it as `webhook_id`.
                  name:
                    type: string
                    description: Empty when the webhook has no name.
                  app_id:
                    type: string
                    description: |-
                      The ID of the webhook's app. Only V1 webhooks and webhooks of retired
                      types have one.
                  network:
                    type: string
                    description: The network of the webhook.
                  networks:
                    items:
                      type: string
                    type: array
                    description: The networks of a webhook that has more than one. Can be empty.
                  webhook_type:
                    type: string
                    description: |-
                      A webhook created before a type was retired keeps that type, for
                      example `MINED_TRANSACTION`.
                  webhook_url:
                    type: string
                    description: The URL that receives the webhook requests.
                  is_active:
                    type: boolean
                    description: Whether the webhook sends requests.
                  time_created:
                    type: number
                    format: double
                    description: Milliseconds since the epoch, truncated to whole seconds.
                  signing_key:
                    type: string
                    description: |-
                      The key that signs each webhook request. Use it to check the
                      `X-Alchemy-Signature` header.
                  version:
                    type: string
                    enum:
                      - V1
                      - V2
                    description: '`V1` only for a webhook created before V1 was retired.'
                  deactivation_reason:
                    type: string
                    description: Why the webhook was deactivated. `UNKNOWN` when no reason is set.
                required:
                  - id
                  - name
                  - network
                  - networks
                  - webhook_url
                  - is_active
                  - time_created
                  - signing_key
                  - version
                  - deactivation_reason
                type: object
                additionalProperties: false
            required:
              - data
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                data:
                  id: wh_octjglnywaupz6th
                  name: Treasury wallet activity
                  network: ETH_MAINNET
                  networks: []
                  webhook_type: ADDRESS_ACTIVITY
                  webhook_url: https://example.com/webhooks/alchemy
                  is_active: true
                  time_created: 1730764800000
                  signing_key: whsec_7mXvC3qGkJ2pT9sLwR4nYbE8
                  version: V2
                  deactivation_reason: UNKNOWN
    '400':
      description: Invalid input
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Missing required fields
                name: ValidationError
    '401':
      description: Requires authentication
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Unauthenticated request.
                name: AuthError
    '403':
      description: Active webhook limit reached
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: You have exceeded the limit of active webhooks for your plan. Please upgrade your plan to continue.
                name: PermissionError
    '404':
      description: Webhook not found
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Webhook not found
                name: null
    '503':
      description: Webhooks service unavailable
      content:
        application/json:
          schema:
            description: |-
              The error body. `name` is null for the statuses that have no name, such as
              404 and 429.
            properties:
              message:
                type: string
              name:
                type: string
                nullable: true
            required:
              - message
              - name
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                message: Error updating webhook
                name: ServerError
  description: |-
    Changes a webhook's active state, name, or URL. The JSON body takes
    `webhook_id` and at least one of `is_active`, `name`, and `webhook_url`.
    Fields that are left out keep their values.
  summary: Update webhook
  tags:
    - Webhooks
  security:
    - team_api_key: []
  parameters: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          required:
            - webhook_id
          anyOf:
            - required:
                - is_active
              properties:
                is_active:
                  type: boolean
            - required:
                - name
              properties:
                name:
                  type: string
            - required:
                - webhook_url
              properties:
                webhook_url:
                  type: string
          properties:
            webhook_id:
              type: string
              description: The webhook ID.
            is_active:
              type: boolean
              nullable: true
              description: Whether the webhook sends requests.
            name:
              type: string
              nullable: true
              description: A name for the webhook.
            webhook_url:
              type: string
              nullable: true
              description: The URL that receives the webhook requests.
```
