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

# Update an Endpoint

> Change an endpoint's events, or switch it off and on.

Name the endpoint by its `url` in the body. URLs are matched after normalising, so `https://Example.com` finds `https://example.com/`.


## OpenAPI

````yaml platform/webhooks/openapi.json PATCH /venue/{venueId}/webhooks/{receiverId}/endpoints
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/{receiverId}/endpoints:
    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'
      - name: receiverId
        in: path
        required: true
        schema:
          type: string
        description: The webhook's id, from `receiverId` on the webhook.
        example: 3f2b8c1e-6d4a-4f1b-9a7e-2c5d8e9f0a1b
    patch:
      tags:
        - Webhooks
      summary: Update an endpoint
      description: Changes an endpoint's events, or switches it off and on.
      operationId: updateWebhookEndpoint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEndpointRequest'
            example:
              url: https://example.com/nowbookit
              isActive: false
      responses:
        '200':
          description: The updated webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookResponse'
              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
        '400':
          description: The request failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              example:
                code: ValidationError
                message: Request body failed validation
                requestId: 8f14e45f-ceea-4c6f-8f89-example
                errors:
                  events:
                    - 'Too small: expected array to have >=1 items'
        '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: >-
            This webhook doesn't send to that URL. Also returned when webhooks
            aren't switched on for this organisation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: AppError
                message: This webhook doesn't send to that URL.
                requestId: 8f14e45f-ceea-4c6f-8f89-example
components:
  schemas:
    UpdateEndpointRequest:
      type: object
      additionalProperties: false
      description: Send `events`, `isActive` or both.
      properties:
        url:
          type: string
          description: >-
            The endpoint to change. Matched after normalising, so either form
            works.
        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: Replaces the endpoint's events.
        isActive:
          type: boolean
          description: '`false` switches the endpoint off, `true` back on.'
      required:
        - url
    WebhookResponse:
      type: object
      properties:
        webhook:
          $ref: '#/components/schemas/Webhook'
      required:
        - webhook
    ValidationErrorResponse:
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          properties:
            errors:
              type: object
              description: Per-field validation messages, keyed by field.
              additionalProperties:
                type: array
                items:
                  type: string
          required:
            - errors
    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.