# Update a webhook endpoint

PATCH /v1/webhook-endpoints/{endpointId}. Changes an endpoint.

`PATCH https://api.chatwise.so/v1/webhook-endpoints/{endpointId}`

Changes an endpoint. Send only the fields to change, at least one.

- `status: PAUSED` stops new deliveries: what happens while it is paused isn't sent. Deliveries already waiting are sent once it is active again.
- `status: ACTIVE` resumes it, also after Chatwise disabled it, and clears its failure count.
- Removing an event cancels its deliveries that weren't sent yet. Changing `accountIds` cancels none.
- A new `url` also receives the deliveries that were already waiting.

The API key needs the `webhooks:write` scope. It also needs `messages:read` when the endpoint has `message.*` events, before or after the change. See [authentication and scopes](https://chatwise.so/docs/authentication.md).

## Example

**curl**:

```bash
curl -X PATCH 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C' \
  -H "Authorization: Bearer $CHATWISE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "status": "PAUSED"
}'
```

**Node.js**:

```js
const response = await fetch("https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.CHATWISE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "status": "PAUSED"
  }),
});
const body = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${body.message}`);
console.log(body.data);
```

**Python**:

```python
import json
import os
import urllib.request

request = urllib.request.Request(
    "https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C",
    method="PATCH",
    headers={
        "Authorization": f"Bearer {os.environ['CHATWISE_API_KEY']}",
        "Content-Type": "application/json",
    },
    data=json.dumps({
      "status": "PAUSED"
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    print(json.load(response)["data"])
```

## Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `endpointId` | string | **Required.** The endpoint's id (`we_…`). |

## Body

JSON. Unknown fields are refused with a 400.

| Field | Type | Description |
| --- | --- | --- |
| `name` | string | A name for the endpoint, 1 to 80 characters. Spaces around it are ignored. Can't be blank, or contain control characters or unpaired surrogates. |
| `url` | string | Where to send events: a public `https://` URL on port 443, without a username, password or `#fragment`. Spaces around it are ignored. At most 2048 characters. |
| `events` | array of strings | The events to receive. `message.*` events also need the `messages:read` scope. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. |
| `accountIds` | array of strings | The accounts to send events for, instead of the ones it has. An empty list means every account. Leave out to keep them. At most 50. |
| `status` | string | `PAUSED` to stop deliveries, `ACTIVE` to resume them. |

## Response

**200.** The endpoint after the change.

```json
{
  "data": {
    "id": "we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C",
    "name": "Order support",
    "url": "https://example.com/webhooks/chatwise",
    "events": [
      "message.received"
    ],
    "accountIds": [],
    "status": "PAUSED",
    "apiVersion": "2026-12-01",
    "health": {
      "lastSuccessAt": "2026-11-12T09:21:08.000Z",
      "lastFailureAt": null,
      "consecutiveFailures": 0,
      "disabledAt": null,
      "disabledReason": null
    },
    "createdAt": "2026-11-02T10:00:00.000Z",
    "updatedAt": "2026-11-13T11:20:00.000Z"
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `data.id` | string | The endpoint's id. |
| `data.name` | string | The endpoint's name. |
| `data.url` | string | Where events are sent. |
| `data.events` | array of strings | The events it receives. Each one of `message.received`, `message.sent`, `message.delivered`, `message.read`, `message.failed`, `comment.received`. |
| `data.accountIds` | array of strings | The accounts it receives events for. Empty means every account. |
| `data.status` | string | `ACTIVE`, `PAUSED` by the workspace, or `DISABLED` by Chatwise (see `health.disabledReason`). |
| `data.apiVersion` | string | The payload format it receives, as a date. |
| `data.health` | object | How its deliveries are going. |
| `data.health.lastSuccessAt` | string or null | When an attempt last succeeded. ISO 8601, in UTC. |
| `data.health.lastFailureAt` | string or null | When an attempt last failed. ISO 8601, in UTC. |
| `data.health.consecutiveFailures` | integer | Failed attempts since the last success. |
| `data.health.disabledAt` | string or null | When Chatwise disabled it. ISO 8601, in UTC. |
| `data.health.disabledReason` | string or null | Why Chatwise disabled it. |
| `data.createdAt` | string | When it was created. ISO 8601, in UTC. |
| `data.updatedAt` | string | When it, or its health, last changed. ISO 8601, in UTC. |

## Errors

| Status | Message | What it means |
| --- | --- | --- |
| 400 | Expected property name or '}' in JSON at position 1 (line 1 column 2) | The request body isn't valid JSON. The message says where. |
| 400 | Validation failed | A parameter or body field is missing, unknown or malformed. `errors` lists each one. |
| 400 | Use a public https:// URL on port 443, without a username, password or #fragment. | The URL can't receive webhooks. |
| 400 | Every account id must be one of this workspace's connected accounts. | An id in `accountIds` isn't one of the workspace's accounts. |
| 400 | Message events need an API key with the messages:read scope too. | The key lacks `messages:read`, which `message.*` events need. |
| 401 | A valid Bearer API key is required | The `Authorization` header is missing or isn't `Bearer <API key>`. |
| 401 | Invalid or revoked API key | The key doesn't exist, was revoked, or has expired. |
| 401 | Invalid API key | Chatwise couldn't check the key. Try again. |
| 403 | API key does not have the required scope: webhooks:write | The key lacks the route's scope. Create a key that has it. |
| 403 | Changing an endpoint that receives message events needs an API key with the messages:read scope too. | The endpoint has `message.*` events and the key lacks `messages:read`. |
| 404 | Webhook endpoint not found | No endpoint with this id in the key's workspace. |
| 413 | request entity too large | The request body is larger than 100 KB. |
| 429 | API key rate limit exceeded | Wait the number of seconds in the `Retry-After` header. |
| 500 | Internal server error | Something failed in Chatwise. Retry reads with backoff. |

The body of an error is described in [errors](https://chatwise.so/docs/errors.md).
