# Update a webhook

Source: https://developers.swell.is/backend-api/webhooks/update-a-webhook

Update a webhook.

## Arguments

- `id` (objectId, required): The unique identifier for the webhook.
- `alias` (string): Alias used to refer to the webhook configuration.
- `url` (string): URL endpoint for the webhook.
- `events` (string): Array of trigger events for the webhook.
- `enabled` (boolean): Determines whether the webhook is enabled. Defaults to false.
- `retry_disabled_events` (boolean): Determines whether the webhook retries disabled events.
- `schedule` (object): Schedule for specifying when a webhook is to be fired.
  - `hour` (int): The hour for which to fire the webhook. Min `0`, max `23`.
  - `month_day` (int): The day of the month for which to fire the webhook. Min `1`, max `31`.
  - `month` (int): The month for which to fire the webhook. Min `1`, max `12`.
  - `week_day` (int): The month for which to fire the webhook. Min `0`, max `6`.
- `date_scheduled` (date): Date for which the webhook is scheduled to fire.

## Example request

**Update**

`PUT /:webhooks/:id`

**cURL**

```bash
$ curl https://api.swell.store/:webhooks/6151f193ae97e82ccbf6f0a7 \
  -u store-id:secret-key \
  -d enabled=true \
  -X PUT
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.put('/:webhooks/{id}', {
  id: '6151f193ae97e82ccbf6f0a7',
  enabled: true
});
```

**PHP**

```php
<?php $swell = new \Swell\Client('store-id', 'secret-key');

$swell->put('/:webhooks/{id}', [
  'id' => '6151f193ae97e82ccbf6f0a7',
  'enabled' => true
]);
```

## Example response

```json
{
  "url": "http://localhost:5000",
  "enabled": false,
  "alias": "webhook",
  "description": null,
  "events": [
    "order.created",
    "order.submitted",
    "order.updated"
  ],
  "api": "com",
  "date_final_attempt": null,
  "date_scheduled": null,
  "date_created": "2021-09-27T16:30:11.837Z",
  "date_updated": "2021-10-28T16:04:21.648Z",
  "id": "6151f193ae97e82ccbf6f0a7"
}
```
