# Create new Webhook subscription

POST https://api.close.com/api/v1/webhook/
Content-Type: application/json

The subscription will send events to the specified URL.

Parameters:
  - `url` - Destination URL for the webhook subscription
  - `events` - A list of events to subscribe to. Each event has an `object_type` and an `action` from values in the [event log](/resources/event-log/list-of-events/). You can also use [Webhook Filters](/resources/webhook-subscriptions/webhook-filters/) while creating your subscription so that an event only fires to a Webhook when certain conditions are met.
  - `verify_ssl` (optional)
    - `true` (default) - Verify SSL certificate of destination webhook URL.
    - `false` - Disable SSL certificate validation on destination webhook URL. We recommend using https to protect your data during delivery.

Reference: https://developer.close.com/api/resources/webhooks/create

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /webhook/:
    post:
      operationId: create
      summary: Create new Webhook subscription
      description: |-
        The subscription will send events to the specified URL.

        Parameters:
          - `url` - Destination URL for the webhook subscription
          - `events` - A list of events to subscribe to. Each event has an `object_type` and an `action` from values in the [event log](/resources/event-log/list-of-events/). You can also use [Webhook Filters](/resources/webhook-subscriptions/webhook-filters/) while creating your subscription so that an event only fires to a Webhook when certain conditions are met.
          - `verify_ssl` (optional)
            - `true` (default) - Verify SSL certificate of destination webhook URL.
            - `false` - Disable SSL certificate validation on destination webhook URL. We recommend using https to protect your data during delivery.
      tags:
        - subpackage_webhooks
      parameters:
        - name: Authorization
          in: header
          description: Basic authentication
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/webhooks_create_Response_201'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhook'
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    WebhookSubscriptionEvent:
      type: object
      properties:
        action:
          type: string
        extra_filter:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        object_type:
          type: string
      required:
        - action
        - object_type
      title: WebhookSubscriptionEvent
    CreateWebhook:
      type: object
      properties:
        event_filter:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        events:
          type: array
          items:
            $ref: '#/components/schemas/WebhookSubscriptionEvent'
        url:
          type: string
        verify_ssl:
          type: boolean
          default: true
      required:
        - events
        - url
      title: CreateWebhook
    webhooks_create_Response_201:
      type: object
      properties: {}
      description: Empty response body
      title: webhooks_create_Response_201
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
    OAuth2:
      type: http
      scheme: bearer

```