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

# Create Webhook

> Create a new webhook

Creates a new webhook subscription. Webhooks allow you to receive real-time HTTP POST notifications when specific events occur in your account.

### Request Body

| Field          | Type      | Required | Description                                                                                                                  |
| -------------- | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `name`         | string    | Yes      | A descriptive name for the webhook                                                                                           |
| `url`          | string    | Yes      | The URL to receive webhook POST requests (must be a valid URL)                                                               |
| `events`       | string\[] | Yes      | Array of event types to subscribe to                                                                                         |
| `dispositions` | number\[] | No       | Filter `CALL_LOGGED` events by disposition IDs. If provided, only calls with matching dispositions will trigger the webhook. |

#### Available Events

| Event             | Description                                                                   |
| ----------------- | ----------------------------------------------------------------------------- |
| `CALL_LOGGED`     | Triggered when a user logs a call, capturing relevant call details            |
| `CONTACT_SNOOZED` | Triggered when a contact is snoozed, capturing the contact and snooze details |

### Example Request

```json theme={null}
{
  "name": "CRM Call Sync",
  "url": "https://example.com/webhooks/salesfinity",
  "events": ["CALL_LOGGED"],
  "dispositions": [1, 4]
}
```

### Response (201)

Returns the created webhook object.

```json theme={null}
{
  "_id": "507f1f77bcf86cd799439011",
  "name": "CRM Call Sync",
  "url": "https://example.com/webhooks/salesfinity",
  "events": ["CALL_LOGGED"],
  "dispositions": [1, 4],
  "status": "active",
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-01-15T10:00:00.000Z"
}
```


## OpenAPI

````yaml POST /v1/webhooks
openapi: 3.0.1
info:
  title: Salesfinity API
  description: API documentation for Salesfinity platform
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://client-api.salesfinity.co
security:
  - ApiKeyAuth: []
paths:
  /v1/webhooks:
    post:
      tags:
        - Webhooks
      description: Create a new webhook
      operationId: create-webhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookDTO'
      responses:
        '201':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                type: object
components:
  schemas:
    CreateWebhookDTO:
      type: object
      properties:
        name:
          type: string
          description: A descriptive name for the webhook
        url:
          type: string
          format: uri
          description: The URL to receive webhook POST requests
        events:
          type: array
          items:
            type: string
            enum:
              - CALL_LOGGED
              - CONTACT_SNOOZED
          description: Event types to subscribe to
        dispositions:
          type: array
          items:
            type: integer
          description: Filter CALL_LOGGED events by disposition IDs
      required:
        - name
        - url
        - events
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````