> ## 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.

# Create Webhook

> Register a new webhook endpoint to receive event notifications

## 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="request_url" type="string" required>
  The URL where webhook events will be sent via POST requests. Must be a valid, publicly accessible URL.
</ParamField>

<ParamField body="events" type="string[]" required>
  Array of event types to subscribe to. Available events: `job_added` `job_activated` `job_deactivated` `job_deleted` `applicant_applied` `cv_upload_completed` `meeting_booked`
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.hirempire.com/v1/create-webhook' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "request_url": "https://example.com/webhook",
      "events": [
          "job_added",
          "applicant_applied",
          "meeting_booked"
      ]
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.hirempire.com/v1/create-webhook', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      request_url: "https://example.com/webhook",
      events: [
        "job_added",
        "applicant_applied",
        "meeting_booked"
      ]
    })
  });

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

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

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

  payload = {
      "request_url": "https://example.com/webhook",
      "events": [
          "job_added",
          "applicant_applied",
          "meeting_booked"
      ]
  }

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

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

  $payload = json_encode([
      "request_url" => "https://example.com/webhook",
      "events" => [
          "job_added",
          "applicant_applied",
          "meeting_booked"
      ]
  ]);

  curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.hirempire.com/v1/create-webhook',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    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 created successfully
</ResponseField>

<ResponseField name="data" type="object">
  Webhook details

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

    <ResponseField name="events" type="string[]">
      Array of subscribed event types
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "id": "8fc4ea3c-ecc4-4a92-96fd-a14436a79a1b",
      "events": [
        "job_added",
        "applicant_applied",
        "meeting_booked"
      ]
    }
  }
  ```
</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."
}
```

<Info>
  You can register multiple webhooks per workspace — there is no longer a one-per-workspace limit. Each webhook is independent and can subscribe to any combination of event types.
</Info>

### Authorization Errors

**401 - Unauthorized**

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

**401 - Unauthorized**

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