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

# Create a Webhook

> Create a webhook and get its signing secret.

> [!WARNING]
>
> The `secret` is returned only in this response. Store it now. If you lose it, [rotate it](https://api-docs.nowbookit.com/platform/webhooks/rotate-secret.md).

Each call creates a new webhook with its own secret. To send to another URL with the same secret, [add an endpoint](https://api-docs.nowbookit.com/platform/webhooks/add-endpoint.md) instead.


## OpenAPI

````yaml platform/webhooks/openapi.json POST /venue/{venueId}/webhooks
openapi: 3.0.4
info:
  title: NowBookIt Webhooks API
  description: >-
    Manage the webhooks that send a venue's booking and gift card events to your
    system.
  version: v1
  contact:
    email: platform.integrations@nowbookit.com
servers:
  - url: https://platform.uat.nowbookit.com/api/comms
    description: UAT
  - url: https://platform.nowbookit.com/api/comms
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Webhooks
    description: Webhook management.
paths:
  /venue/{venueId}/webhooks:
    parameters:
      - name: venueId
        in: path
        required: true
        schema:
          type: string
        description: Your venue's id. Must be the venue your API key belongs to.
        example: '6319'
    post:
      tags:
        - Webhooks
      summary: Create a webhook
      description: >-
        Creates a webhook with its own signing secret, sending the chosen events
        to one URL.
      operationId: createWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
            example:
              url: https://example.com/nowbookit
              events:
                - booking.created
                - booking.updated
                - booking.cancelled
      responses:
        '201':
          description: The webhook and its signing secret.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateWebhookResponse'
              example:
                webhook:
                  receiverId: 3f2b8c1e-6d4a-4f1b-9a7e-2c5d8e9f0a1b
                  orgId: org_01HXYZEXAMPLE
                  scope: venues
                  name: Your integration
                  outputFormat: standard
                  createdByIntegrationId: your-integration-id
                  venues:
                    - venueId: '6319'
                      secretLast4: Q2xY
                  endpoints:
                    - url: https://example.com/nowbookit
                      eventTypes:
                        - booking.created
                        - booking.updated
                        - booking.cancelled
                      isActive: true
                secret: whsec_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        '400':
          description: That address points inside a private network. Use a public endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: AppError
                message: >-
                  That address points inside a private network. Use a public
                  endpoint.
                requestId: 8f14e45f-ceea-4c6f-8f89-example
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: UnauthorisedError
                message: Invalid API key
                requestId: 8f14e45f-ceea-4c6f-8f89-example
        '403':
          description: Only an API key for this venue can manage its webhooks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: AppError
                message: Only an API key for this venue can manage its webhooks.
                requestId: 8f14e45f-ceea-4c6f-8f89-example
        '404':
          description: Webhooks aren't switched on for this organisation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: AppError
                message: Webhooks aren't switched on for this organisation.
                requestId: 8f14e45f-ceea-4c6f-8f89-example
components:
  schemas:
    CreateWebhookRequest:
      type: object
      additionalProperties: false
      properties:
        url:
          type: string
          maxLength: 2048
          description: >-
            Your endpoint. Must be `https://` on a public address, with no
            username or password. Redirects are not followed.
          example: https://example.com/nowbookit
        events:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - booking.created
              - booking.updated
              - booking.seated
              - booking.finished
              - booking.cancelled
              - giftcard.created
              - giftcard.updated
              - giftcard.cancelled
              - giftcard.redeemed
          description: >-
            The events to send. Booking events need `reservations:read` on your
            key, gift card events `giftcards:read`.
      required:
        - url
        - events
    CreateWebhookResponse:
      type: object
      properties:
        webhook:
          $ref: '#/components/schemas/Webhook'
        secret:
          type: string
          description: >-
            The signing secret: `whsec_` followed by 43 characters. Shown only
            in this response, so store it now.
          example: whsec_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      required:
        - webhook
        - secret
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: >-
            Error class name, e.g. `UnauthorisedError`, `ValidationError`,
            `AppError`.
          example: AppError
        message:
          type: string
          description: What went wrong, described in plain language.
          example: No webhook with that id at this venue.
        requestId:
          type: string
          description: >-
            A unique reference for this request, handy if you contact support
            about it.
          example: 8f14e45f-ceea-4c6f-8f89-example
      required:
        - code
        - message
        - requestId
    Webhook:
      type: object
      description: A webhook never includes its secret.
      properties:
        receiverId:
          type: string
          description: The webhook's id.
        orgId:
          type: string
          description: The venue's organisation.
        scope:
          type: string
          enum:
            - venues
            - group
          description: Always `venues` for webhooks created with an API key.
        name:
          type: string
          description: Your integration's name.
        outputFormat:
          type: string
          enum:
            - standard
        createdByIntegrationId:
          type: string
          description: The integration whose key created it.
        venues:
          type: array
          items:
            $ref: '#/components/schemas/WebhookVenue'
        endpoints:
          type: array
          items:
            $ref: '#/components/schemas/WebhookEndpoint'
          description: The URLs events are sent to.
      required:
        - receiverId
        - orgId
        - scope
        - name
        - outputFormat
        - venues
        - endpoints
    WebhookVenue:
      type: object
      properties:
        venueId:
          type: string
        posLocationId:
          type: string
          description: Your own id for this venue, when one is set up.
        secretLast4:
          type: string
          description: The last 4 characters of this venue's signing secret.
      required:
        - venueId
        - secretLast4
    WebhookEndpoint:
      type: object
      properties:
        url:
          type: string
          description: >-
            Stored normalised, e.g. `https://Example.com` becomes
            `https://example.com/`.
        eventTypes:
          type: array
          items:
            type: string
            enum:
              - booking.created
              - booking.updated
              - booking.seated
              - booking.finished
              - booking.cancelled
              - giftcard.created
              - giftcard.updated
              - giftcard.cancelled
              - giftcard.redeemed
        isActive:
          type: boolean
          description: '`false` while the endpoint is switched off. Nothing is sent to it.'
        offForRevokedKey:
          type: boolean
          description: >-
            Present and `true` only when the endpoint was switched off because
            your API key at this venue was suspended or deleted.
      required:
        - url
        - eventTypes
        - isActive
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Your API key, with the `webhooks:manage` permission. See
        [Authorization](/platform/authorization).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.