## Update a webhook endpoint

**patch** `/v1/webhook_endpoints/{endpoint}`

Updates an endpoint: its destination, its label, which kinds it
receives, or whether it is enabled.

Read `status` before disabling anything — disabling drops what is
queued.

### Path Parameters

- `endpoint: string`

### Body Parameters

- `description: optional string`

  A new label. Text a human reads: control characters are refused.

- `event_kinds: optional array of string`

  Replaces the subscription list outright. An empty array means every kind.

- `status: optional string`

  `enabled` or `disabled`.

  **Disabling is a cutoff, not a pause.** Every event still queued for
  this endpoint is dropped when you disable it, and while it is disabled no
  new event is queued for it. Enabling it again resumes with what happens
  next — there is no backlog to replay, by design: a destination that has
  just come back up is the worst possible moment to hand it hours of stale
  events in one burst.

  **Nothing is lost, and the response tells you how to get it.**
  `backlog_dropped` says how many events were dropped and
  `backlog_resume_cursor` says where they start; pass that cursor to
  `GET /v1/streams/events` to read them. Keep it — a webhook does not carry a
  stream position, so this response is the only place a push-only
  integration is handed one.

  One delivery may still arrive after this call returns: an attempt already
  on the wire cannot be recalled, and it is counted in `backlog_dropped`
  even if it lands. The count is an upper bound on what was lost.

- `url: optional string`

  A new destination. Validated exactly as at registration. Events already queued go to the new url — a delivery in flight when you change it re-reads the endpoint before it dials, so it follows the change too.

### Returns

- `Endpoint object { id, created_at, disabled_at, 8 more }`

  A destination this brand's events are delivered to.

  - `id: string`

    The endpoint's id.

  - `created_at: string`

  - `disabled_at: string`

    When this endpoint was last disabled. `null` while it is enabled.

  - `event_kinds: array of string`

    The event kinds delivered here, or `null` for every kind (including kinds added later).

  - `health: EndpointHealth`

    How a destination has been behaving, taken from the deliveries actually
    attempted against it. Worth reading before assuming an integration is
    healthy: a destination that has been refusing events shows up here well
    before anyone notices they are missing.

    - `consecutive_failures: number`

      Failed attempts since the last success. Reset to 0 by any success.

    - `last_failure_at: string`

      When a delivery to this endpoint last failed. `null` if none ever has.

    - `last_failure_reason: string`

      A short reason for the last failure, written for a human reading it. The wording is not stable; do not branch on it.

    - `last_failure_status: number`

      The HTTP status of that last failure. `null` when the attempt never reached a response at all — a name that did not resolve, a refused connection, a timeout, or an address we will not dial.

    - `last_success_at: string`

      When a delivery to this endpoint last succeeded. `null` if none ever has.

  - `status: string`

    `enabled` or `disabled`. A disabled endpoint receives nothing, and events are not queued for it — see the update operation. Values grow additively.

  - `updated_at: string`

  - `url: string`

    Where events are POSTed. `https` only.

  - `backlog_dropped: optional number`

    How many undelivered events were dropped by THIS request, present only
    on the response to a request that disabled or deleted the endpoint.
    Disabling is a cutoff: everything still queued for this endpoint is
    dropped then and there rather than waiting to be replayed later.

  - `backlog_resume_cursor: optional string`

    Where to pick the dropped events back up: pass it as the `cursor` query
    parameter to `GET /v1/streams/events` and the first event you receive is the
    first one dropped. Present alongside `backlog_dropped` and only then.

    **Keep it if you rely on webhooks alone.** A webhook carries the event's
    identity but not its position in the stream, so this response is the only
    place a push-only integration is handed the position of the gap it just
    created. Reconnecting without a cursor starts at the present moment and
    skips the gap entirely.

    It stays valid while the events behind it are retained; past that the
    stream answers `410 cursor_expired` rather than pretending.

  - `description: optional string`

    Your own label for this endpoint.

### Example

```http
curl https://whatsapp.messages.api.linqapp.com/v1/webhook_endpoints/$ENDPOINT \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LINQ_WHATSAPP_API_KEY" \
    -d '{}'
```

#### Response

```json
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "disabled_at": "2019-12-27T18:11:19.117Z",
  "event_kinds": [
    "string"
  ],
  "health": {
    "consecutive_failures": 0,
    "last_failure_at": "2019-12-27T18:11:19.117Z",
    "last_failure_reason": "last_failure_reason",
    "last_failure_status": 0,
    "last_success_at": "2019-12-27T18:11:19.117Z"
  },
  "status": "status",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "url": "url",
  "backlog_dropped": 0,
  "backlog_resume_cursor": "backlog_resume_cursor",
  "description": "description"
}
```
