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

# Create webhook

> Registers a webhook on the instance. Up to 5 per instance.



## OpenAPI

````yaml /en/api-reference/openapi.json post /instances/{id}/webhooks
openapi: 3.1.0
info:
  title: Zapfy API
  description: >-
    Multi-tenant WhatsApp API. Send messages and manage webhooks through a
    single surface.
  version: 1.0.0
servers:
  - url: https://api.zapfy.io/v1
security:
  - accountToken: []
paths:
  /instances/{id}/webhooks:
    parameters:
      - $ref: '#/components/parameters/InstanceId'
    post:
      tags:
        - Webhooks
      summary: Create webhook
      description: Registers a webhook on the instance. Up to 5 per instance.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookInput'
      responses:
        '201':
          description: Webhook created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Webhook'
        '401':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '409':
          $ref: '#/components/responses/Error'
components:
  parameters:
    InstanceId:
      name: id
      in: path
      required: true
      description: Instance ID.
      schema:
        type: string
  schemas:
    WebhookInput:
      type: object
      required:
        - url
        - events
      properties:
        url:
          type: string
          format: uri
          example: https://your-app.com/webhooks
          description: HTTPS URL that will receive the events via POST.
        events:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/WebhookEvent'
          example:
            - MESSAGE_RECEIVED
            - MESSAGE_STATUS
          description: Events that trigger the webhook.
        enabled:
          type: boolean
          default: true
          description: 'Whether the webhook is active. Default: `true`.'
    Webhook:
      type: object
      properties:
        id:
          type: string
          example: 01J9Z...
          description: Webhook identifier.
        url:
          type: string
          example: https://your-app.com/webhooks
          description: HTTPS URL that receives the events.
        events:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEvent'
          description: Events subscribed by this webhook.
        enabled:
          type: boolean
          example: true
          description: Whether the webhook is active.
        createdAt:
          type: string
          format: date-time
          description: Creation date (ISO 8601).
    WebhookEvent:
      type: string
      enum:
        - MESSAGE_RECEIVED
        - MESSAGE_SENT
        - MESSAGE_STATUS
        - CONNECTION_UPDATE
        - QRCODE_UPDATED
      description: >-
        Event type. `MESSAGE_RECEIVED` = incoming message; `MESSAGE_SENT` =
        message sent by the instance; `MESSAGE_STATUS` = delivery/read status
        change; `CONNECTION_UPDATE` = instance connection change;
        `QRCODE_UPDATED` = new QR Code to pair.
  responses:
    Error:
      description: Error.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Instance not found
  securitySchemes:
    accountToken:
      type: http
      scheme: bearer
      description: Account token (`zpfy_acct_...`) — manages instances and webhooks.

````