> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update WebHook

> Update an existing WebHook record.

Updates an existing WebHook record. You must include the `Id` of the record to update along with all required fields.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`WebHook-Edit`** role.
</Note>

## Enums

<Accordion title="eWebhookAction — Action values">
  | Value | Name                                 |
  | ----- | ------------------------------------ |
  | 1     | None                                 |
  | 2     | CoworkerUpdate                       |
  | 3     | CoworkerCreate                       |
  | 4     | BlogPostCreate                       |
  | 5     | BlogPostUpdate                       |
  | 6     | BookingCreate                        |
  | 7     | BookingUpdate                        |
  | 8     | BookingDelete                        |
  | 9     | SendWelcomeEmail                     |
  | 10    | CoworkerContractActivate             |
  | 11    | CoworkerContractCancel               |
  | 12    | CoworkerContractRenew                |
  | 13    | CoworkerContractUpgradeDowngrade     |
  | 14    | CoworkerContractActivateFirst        |
  | 15    | CoworkerInvoiceCreateFirst           |
  | 16    | CoworkerInvoiceCreate                |
  | 17    | CoworkerInvoiceDelete                |
  | 18    | CoworkerInvoiceUpdate                |
  | 19    | CoworkerInvoiceRefund                |
  | 20    | CoworkerInvoiceCreditNote            |
  | 21    | CoworkerInvoicePaid                  |
  | 22    | CoworkerInvoiceFailedPayment         |
  | 23    | CoworkerInvoiceReceivedPayment       |
  | 24    | CoworkerInvoiceAwaitingPayment       |
  | 25    | CalendarEventCreate                  |
  | 26    | CalendarEventUpdate                  |
  | 27    | CalendarEventAttendeeDelete          |
  | 28    | CalendarEventAttendeeCreate          |
  | 29    | CalendarEventAttendeeUpdate          |
  | 30    | GlobalChatMessageCreate              |
  | 31    | NewsLetterSubscriberCreate           |
  | 32    | NewsLetterSubscriberSubscribed       |
  | 33    | NewsLetterSubscriberUnSubscribed     |
  | 34    | NewsLetterSubscriberRemovedFromGroup |
  | 35    | CoworkerCheckout                     |
  | 36    | CoworkerCheckin                      |
  | 37    | CoworkerCheckinFailed                |
  | 38    | VisitorNotification                  |
  | 39    | CommunityBoardNewThread              |
  | 40    | CommunityBoardNewReply               |
  | 41    | VisitorCheckedin                     |
  | 42    | VisitorRegistered                    |
  | 43    | BlogPostDelete                       |
  | 44    | CalendarEventDelete                  |
  | 45    | HelDeskMessageCreated                |
  | 46    | HelpDeskCommentCreated               |
  | 47    | CheckinCreated                       |
  | 48    | CheckinUpdated                       |
  | 49    | CheckinDeleted                       |
  | 50    | CoworkerDelete                       |
  | 51    | CoworkerMessageCreate                |
  | 52    | DeliveryCreated                      |
  | 53    | DeliveryAssigned                     |
  | 54    | ProposalCreated                      |
  | 55    | ProposalUpdated                      |
  | 56    | ProposalDeleted                      |
  | 57    | TeamCreated                          |
  | 58    | TeamUpdated                          |
  | 59    | TeamDeleted                          |
  | 60    | CoworkerContractUpdate               |
  | 61    | AccessControlUpdate                  |
  | 62    | CoworkerContractCreate               |
  | 63    | FailedCheckin                        |
  | 64    | VisitorDeleted                       |
  | 65    | CoworkerInvoiceLedgerEntryCreate     |
  | 66    | CoworkerInvoiceLedgerEntryDelete     |
  | 67    | CoworkerInvoiceLedgerEntryUpdate     |
  | 68    | CoworkerProductCreate                |
  | 69    | CoworkerProductUpdate                |
  | 70    | CoworkerProductDelete                |
  | 71    | FloorPlanDeskCreate                  |
  | 72    | FloorPlanDeskDelete                  |
  | 73    | FloorPlanDeskUpdate                  |
  | 74    | TariffCreate                         |
  | 75    | TariffDelete                         |
  | 76    | TariffUpdate                         |
  | 77    | CoworkerContractDelete               |
  | 78    | FloorPlanCreate                      |
  | 79    | FloorPlanDelete                      |
  | 80    | FloorPlanUpdate                      |
  | 81    | ProductCreate                        |
  | 82    | ProductDelete                        |
  | 83    | ProductUpdate                        |
  | 84    | BusinessUpdate                       |
  | 85    | CommunityGroupCreate                 |
  | 86    | CommunityGroupDelete                 |
  | 87    | CommunityGroupUpdate                 |
  | 88    | CoworkerPaymentMethodCreate          |
  | 89    | CoworkerPaymentMethodDelete          |
  | 90    | CoworkerPaymentMethodUpdate          |
</Accordion>

## Request Body

### Required Fields

<ParamField body="Id" type="integer" required>
  The Id of the WebHook record to update.
</ParamField>

<ParamField body="BusinessId" type="integer" required>
  ID of the location that owns this webhook. Events raised in this location trigger it, and a webhook registered on a network parent location also receives events from that parent's child locations..
</ParamField>

<ParamField body="Name" type="string" required>
  Display name used to identify this webhook in the location's webhook list; it is not sent to the endpoint..
</ParamField>

<ParamField body="Action" type="integer" required>
  The single event that triggers this webhook, such as CoworkerCreate, BookingCreate or CoworkerInvoicePaid. Only one action per webhook, so create a separate record for each event you need. Defaults to None, which never fires, so always set this explicitly..
</ParamField>

<ParamField body="URL" type="string" required>
  Endpoint that receives the HTTP POST JSON payload when the webhook fires, up to 1024 characters. It must start with http or https; any other value records an error and deactivates the webhook on the first delivery attempt..
</ParamField>

### Optional Fields

<ParamField body="Description" type="string">
  Optional free-text note describing the webhook's purpose. It is not shown in the admin form and is not sent to the endpoint..
</ParamField>

<ParamField body="Active" type="boolean">
  Whether the webhook is enabled and will fire when its action occurs. Set false to pause delivery without deleting the record. Nexudus sets it to false automatically once ErrorCount passes 10, or when the URL does not start with http..
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT \
    "https://spaces.nexudus.com/api/sys/webhooks" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "Name": "",
      "Action": 0,
      "URL": "",
      "Id": 87654321
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/webhooks',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        Name: '',
        Action: 0,
        URL: '',
        Id: 87654321
      })
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.put(
      'https://spaces.nexudus.com/api/sys/webhooks',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'Name': '',
          'Action': 0,
          'URL': '',
          'Id': 87654321
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Status" type="integer">
  HTTP status code. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string">
  A human-readable message confirming the update.
</ResponseField>

<ResponseField name="Value" type="object">
  Contains the `Id` of the updated record.
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `true` if the webhook was updated successfully.
</ResponseField>

<ResponseField name="Errors" type="array">
  `null` on success.
</ResponseField>

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "WebHook was successfully updated.",
  "Value": {
    "Id": 87654321
  },
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T10:30:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}
```

### 400

<ResponseField name="Message" type="string">
  A summary of the validation error(s), in the format `PropertyName: error message`.
</ResponseField>

<ResponseField name="Value" type="any">
  `null` on validation failure.
</ResponseField>

<ResponseField name="Errors" type="object[]">
  Array of validation errors.

  <Expandable>
    <ResponseField name="AttemptedValue" type="any">
      The value that was submitted for the field, or `null` if missing.
    </ResponseField>

    <ResponseField name="Message" type="string">
      The validation error message.
    </ResponseField>

    <ResponseField name="PropertyName" type="string">
      The name of the property that failed validation.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `false` when the request fails validation.
</ResponseField>

```json Example Response theme={null}
{
  "Message": "Name: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "Name"
    }
  ],
  "WasSuccessful": false
}
```
