## Update a webhook subscription

**put** `/v3/webhook-subscriptions/{subscriptionId}`

Update an existing webhook subscription. You can modify the target URL,
subscribed events, or activate/deactivate the subscription.

**Note:** The signing secret cannot be changed via this endpoint.

### Path Parameters

- `subscriptionId: string`

### Body Parameters

- `is_active: optional boolean`

  Activate or deactivate the subscription

- `phone_numbers: optional array of string`

  Updated list of phone numbers to filter events for. Set to a non-empty array to filter events to specific phone numbers. Set to an empty array or null to remove the filter and receive events from all phone numbers. Phone numbers must be in E.164 format.

- `routing_id_header: optional string`

  Updated header name for the chat id. Set to null or an empty string to fall back to `Linq-Chat-Id`.

- `routing_key_header: optional string`

  Updated header name for the routing token. Set to null or an empty string to disable delivery affinity and drop the stored tokens.

- `subscribed_events: optional array of WebhookEventType`

  Updated list of event types to subscribe to

  - `"message.sent"`

  - `"message.received"`

  - `"message.read"`

  - `"message.delivered"`

  - `"message.failed"`

  - `"message.edited"`

  - `"reaction.added"`

  - `"reaction.removed"`

  - `"poll.received"`

  - `"poll.failed"`

  - `"poll.sent"`

  - `"poll.delivered"`

  - `"poll.read"`

  - `"poll.updated"`

  - `"poll.vote.added"`

  - `"poll.vote.removed"`

  - `"poll.reaction.added"`

  - `"participant.added"`

  - `"participant.removed"`

  - `"chat.created"`

  - `"chat.group_name_updated"`

  - `"chat.group_icon_updated"`

  - `"chat.group_name_update_failed"`

  - `"chat.group_icon_update_failed"`

  - `"chat.background_updated"`

  - `"chat.background_update_failed"`

  - `"chat.typing_indicator.started"`

  - `"chat.typing_indicator.stopped"`

  - `"phone_number.status_updated"`

  - `"phone_number.assigned"`

  - `"phone_number.released"`

  - `"phone_number.line_type_updated"`

  - `"contact_card.received"`

  - `"call.initiated"`

  - `"call.ringing"`

  - `"call.answered"`

  - `"call.ended"`

  - `"call.failed"`

  - `"call.declined"`

  - `"call.no_answer"`

  - `"location.sharing.started"`

  - `"location.sharing.stopped"`

  - `"payment.succeeded"`

  - `"payment.canceled"`

  - `"payment.expired"`

  - `"payment.declined"`

  - `"payment.authorized"`

  - `"connection.created"`

  - `"connection.revoked"`

  - `"zero_day_retention.updated"`

  - `"phone_number.forwarding_updated"`

  - `"environment.line_moved"`

  - `"contact_card.created"`

  - `"contact_card.updated"`

  - `"contact_card.deleted"`

  - `"api_token.created"`

  - `"api_token.renamed"`

  - `"api_token.expiry_scheduled"`

  - `"api_token.expired"`

  - `"api_token.activated"`

  - `"api_token.deleted"`

  - `"environment.created"`

  - `"environment.renamed"`

  - `"environment.deleted"`

  - `"webhook_subscription.created"`

  - `"webhook_subscription.deleted"`

  - `"webhook_subscription.target_url_changed"`

  - `"webhook_subscription.enabled"`

  - `"webhook_subscription.disabled"`

  - `"webhook_subscription.events.updated"`

  - `"webhook_subscription.phone_numbers.updated"`

  - `"webhook_subscription.routing_headers_set"`

  - `"webhook_subscription.routing_headers_cleared"`

  - `"team_member.added"`

  - `"team_member.signed_in"`

  - `"team_member.signed_out"`

- `target_url: optional string`

  New target URL for webhook events

### Returns

- `WebhookSubscription object { id, created_at, is_active, 6 more }`

  - `id: string`

    Unique identifier for the webhook subscription

  - `created_at: string`

    When the subscription was created

  - `is_active: boolean`

    Whether this subscription is currently active

  - `subscribed_events: array of WebhookEventType`

    List of event types this subscription receives

    - `"message.sent"`

    - `"message.received"`

    - `"message.read"`

    - `"message.delivered"`

    - `"message.failed"`

    - `"message.edited"`

    - `"reaction.added"`

    - `"reaction.removed"`

    - `"poll.received"`

    - `"poll.failed"`

    - `"poll.sent"`

    - `"poll.delivered"`

    - `"poll.read"`

    - `"poll.updated"`

    - `"poll.vote.added"`

    - `"poll.vote.removed"`

    - `"poll.reaction.added"`

    - `"participant.added"`

    - `"participant.removed"`

    - `"chat.created"`

    - `"chat.group_name_updated"`

    - `"chat.group_icon_updated"`

    - `"chat.group_name_update_failed"`

    - `"chat.group_icon_update_failed"`

    - `"chat.background_updated"`

    - `"chat.background_update_failed"`

    - `"chat.typing_indicator.started"`

    - `"chat.typing_indicator.stopped"`

    - `"phone_number.status_updated"`

    - `"phone_number.assigned"`

    - `"phone_number.released"`

    - `"phone_number.line_type_updated"`

    - `"contact_card.received"`

    - `"call.initiated"`

    - `"call.ringing"`

    - `"call.answered"`

    - `"call.ended"`

    - `"call.failed"`

    - `"call.declined"`

    - `"call.no_answer"`

    - `"location.sharing.started"`

    - `"location.sharing.stopped"`

    - `"payment.succeeded"`

    - `"payment.canceled"`

    - `"payment.expired"`

    - `"payment.declined"`

    - `"payment.authorized"`

    - `"connection.created"`

    - `"connection.revoked"`

    - `"zero_day_retention.updated"`

    - `"phone_number.forwarding_updated"`

    - `"environment.line_moved"`

    - `"contact_card.created"`

    - `"contact_card.updated"`

    - `"contact_card.deleted"`

    - `"api_token.created"`

    - `"api_token.renamed"`

    - `"api_token.expiry_scheduled"`

    - `"api_token.expired"`

    - `"api_token.activated"`

    - `"api_token.deleted"`

    - `"environment.created"`

    - `"environment.renamed"`

    - `"environment.deleted"`

    - `"webhook_subscription.created"`

    - `"webhook_subscription.deleted"`

    - `"webhook_subscription.target_url_changed"`

    - `"webhook_subscription.enabled"`

    - `"webhook_subscription.disabled"`

    - `"webhook_subscription.events.updated"`

    - `"webhook_subscription.phone_numbers.updated"`

    - `"webhook_subscription.routing_headers_set"`

    - `"webhook_subscription.routing_headers_cleared"`

    - `"team_member.added"`

    - `"team_member.signed_in"`

    - `"team_member.signed_out"`

  - `target_url: string`

    URL where webhook events will be sent

  - `updated_at: string`

    When the subscription was last updated

  - `phone_numbers: optional array of string`

    Phone numbers this subscription filters for. If null or empty, events from all phone numbers are delivered.

  - `routing_id_header: optional string`

    Header carrying the chat id. Defaults to `Linq-Chat-Id` when affinity is on.

  - `routing_key_header: optional string`

    Header carrying the routing token. Null disables delivery affinity.

### Example

```http
curl https://api.linqapp.com/api/partner/v3/webhook-subscriptions/$SUBSCRIPTION_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \
    -d '{
          "is_active": true,
          "phone_numbers": [
            "+12025551234"
          ],
          "routing_id_header": "X-Chat-Id",
          "routing_key_header": "X-Route-Token",
          "subscribed_events": [
            "message.sent",
            "message.delivered"
          ],
          "target_url": "https://webhooks.example.com/linq/events"
        }'
```

#### Response

```json
{
  "id": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
  "created_at": "2024-01-15T10:30:00Z",
  "is_active": true,
  "subscribed_events": [
    "message.sent",
    "message.delivered",
    "message.read"
  ],
  "target_url": "https://webhooks.example.com/linq/events",
  "updated_at": "2024-01-15T10:30:00Z",
  "phone_numbers": [
    "string"
  ],
  "routing_id_header": "X-Chat-Id",
  "routing_key_header": "X-Route-Token"
}
```
