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

# Update Webhook

> Update an existing webhook's events or active status

## Authentication

<ResponseField name="Authorization" type="string" required>
  Bearer authentication header of the form `Bearer <token>`, where `<token>` is your auth token.
</ResponseField>

## Request Body

<ParamField body="id" type="string" required>
  Unique identifier of the webhook to update
</ParamField>

<ParamField body="events" type="string[]">
  Updated array of event types to subscribe to. An empty array `[]` is valid and will remove all event subscriptions. Available events: `job_added` `job_activated` `job_deactivated` `job_deleted` `applicant_applied` `cv_upload_completed` `meeting_booked`
</ParamField>

<ParamField body="active" type="boolean">
  Set to `true` to activate or `false` to deactivate the webhook
</ParamField>

<Info>
  At least one of `events` or `active` must be provided alongside the required `id` field. Both can be sent together in a single request.
</Info>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request PATCH 'https://api.hirempire.com/v1/webhook' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "id": "0c8t5e54-e053-40b2-8c9c-b45rgy0acf8a",
      "active": false
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.hirempire.com/v1/webhook', {
    method: 'PATCH',
    headers: {
      'Authorization': 'Bearer YOUR_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      id: "0c8t5e54-e053-40b2-8c9c-b45rgy0acf8a",
      active: false
    })
  });

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

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

  url = "https://api.hirempire.com/v1/webhook"
  headers = {
      "Authorization": "Bearer YOUR_TOKEN",
      "Content-Type": "application/json"
  }

  payload = {
      "id": "0c8t5e54-e053-40b2-8c9c-b45rgy0acf8a",
      "active": False
  }

  response = requests.patch(url, headers=headers, data=json.dumps(payload))
  data = response.json()
  print(data)
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();

  $payload = json_encode([
      "id" => "0c8t5e54-e053-40b2-8c9c-b45rgy0acf8a",
      "active" => false
  ]);

  curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.hirempire.com/v1/webhook',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_HTTPHEADER => array(
      'Authorization: Bearer YOUR_TOKEN',
      'Content-Type: application/json'
    ),
  ));

  $response = curl_exec($curl);
  curl_close($curl);

  $data = json_decode($response, true);
  print_r($data);
  ?>
  ```
</RequestExample>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the webhook was updated successfully
</ResponseField>

<ResponseField name="data" type="object">
  Updated webhook details

  <Expandable title="Data Object Properties">
    <ResponseField name="id" type="string">
      Unique identifier of the updated webhook
    </ResponseField>

    <ResponseField name="active" type="boolean">
      Current active status of the webhook
    </ResponseField>

    <ResponseField name="modified_at" type="string">
      ISO 8601 timestamp of when the webhook was last modified
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "id": "0c8t5e54-e053-40b2-8c9c-b45rgy0acf8a",
      "active": false,
      "modified_at": "2025-07-01T04:39:20.000Z"
    }
  }
  ```
</ResponseExample>

## Error Responses

### Validation Errors

**400 - Bad Request**

```json theme={null}
{
  "success": false,
  "error": "Field 'request_url' is required and must be a string."
}
```

**400 - Bad Request**

```json theme={null}
{
  "success": false,
  "error": "Field 'events' is required and must be an array."
}
```

**400 - Bad Request**

```json theme={null}
{
  "success": false,
  "error": "Invalid event: invalid_event_name."
}
```

**400 - Bad Request**

```json theme={null}
{
  "success": false,
  "error": "Invalid token"
}
```

**400 - Bad Request**

```json theme={null}
{
  "success": false,
  "error": "Input is incorrect."
}
```

**400 - Bad Request**

```json theme={null}
{
  "success": false,
  "error": "Invalid request url"
}
```

### Authorization Errors

**401 - Unauthorized**

```json theme={null}
{
  "success": false,
  "error": "Token is expired"
}
```

**401 - Unauthorized**

```json theme={null}
{
  "success": false,
  "error": "Invalid webhook id"
}
```
