# Add and remove webhook addresses

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

PATCH https://dashboard.alchemy.com/api/update-webhook-addresses

Adds and removes the addresses of an address activity webhook. The JSON
body takes `webhook_id`, `addresses_to_add`, and `addresses_to_remove`.
Each list can have at most 500 addresses. Send an empty list if there is
nothing to add or remove. The request is idempotent: sending it again has
the same result.

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

## 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 PATCH \
  --url https://dashboard.alchemy.com/api/update-webhook-addresses \
  --header 'Content-Type: application/json' \
  --header 'X-Alchemy-Token: string' \
  --data '{
  "webhook_id": "string",
  "addresses_to_add": [
    "string"
  ],
  "addresses_to_remove": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json', 'X-Alchemy-Token': 'string'},
  body: JSON.stringify({
    webhook_id: 'string',
    addresses_to_add: ['string'],
    addresses_to_remove: ['string']
  })
};

fetch('https://dashboard.alchemy.com/api/update-webhook-addresses', 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-addresses"

payload = {
    "webhook_id": "string",
    "addresses_to_add": ["string"],
    "addresses_to_remove": ["string"]
}
headers = {
    "Content-Type": "application/json",
    "X-Alchemy-Token": "string"
}

response = requests.patch(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-addresses"

	payload := strings.NewReader("{\n  \"webhook_id\": \"string\",\n  \"addresses_to_add\": [\n    \"string\"\n  ],\n  \"addresses_to_remove\": [\n    \"string\"\n  ]\n}")

	req, _ := http.NewRequest("PATCH", 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.patch("https://dashboard.alchemy.com/api/update-webhook-addresses")
  .header("Content-Type", "application/json")
  .header("X-Alchemy-Token", "string")
  .body("{\n  \"webhook_id\": \"string\",\n  \"addresses_to_add\": [\n    \"string\"\n  ],\n  \"addresses_to_remove\": [\n    \"string\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://dashboard.alchemy.com/api/update-webhook-addresses");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Alchemy-Token", "string");
request.AddJsonBody("{\n  \"webhook_id\": \"string\",\n  \"addresses_to_add\": [\n    \"string\"\n  ],\n  \"addresses_to_remove\": [\n    \"string\"\n  ]\n}", false);
var response = await client.PatchAsync(request);

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

```


## Operation Specification

```yaml
path: /api/update-webhook-addresses
method: PATCH
operation:
  operationId: UpdateWebhookAddresses
  responses:
    '200':
      description: Changed the webhook's addresses
      content:
        application/json:
          schema:
            properties: {}
            type: object
            description: Construct a type with a set of properties K of type T
            additionalProperties: false
          examples:
            Example 1:
              value: {}
    '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
    '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: Internal server error
                name: ServerError
  description: |-
    Adds and removes the addresses of an address activity webhook. The JSON
    body takes `webhook_id`, `addresses_to_add`, and `addresses_to_remove`.
    Each list can have at most 500 addresses. Send an empty list if there is
    nothing to add or remove. The request is idempotent: sending it again has
    the same result.
  summary: Add and remove webhook addresses
  tags:
    - Webhooks
  security:
    - team_api_key: []
  parameters: []
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          required:
            - webhook_id
            - addresses_to_add
            - addresses_to_remove
          properties:
            webhook_id:
              type: string
              description: The webhook ID.
            addresses_to_add:
              type: array
              items:
                type: string
                nullable: true
              maxItems: 500
              nullable: true
              description: The addresses to add. Send an empty list for none.
            addresses_to_remove:
              type: array
              items:
                type: string
                nullable: true
              maxItems: 500
              nullable: true
              description: The addresses to remove. Send an empty list for none.
```
