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

# Rotate the Secret

> Replace the webhook's signing secret.

> [!WARNING]
>
> The old secret stops working straight away. Update your endpoint with the new secret as soon as you have it.


## OpenAPI

````yaml platform/webhooks/openapi.json POST /venue/{venueId}/webhooks/{receiverId}/rotate-secret
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}/rotate-secret:
    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
    post:
      tags:
        - Webhooks
      summary: Rotate the signing secret
      description: >-
        Replaces this venue's signing secret. The old secret stops working
        straight away.
      operationId: rotateWebhookSecret
      responses:
        '200':
          description: The new secret.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RotateSecretResponse'
              example:
                secret: whsec_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        '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: >-
            No webhook with that id at this venue. Also returned when webhooks
            aren't switched on for this organisation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: AppError
                message: No webhook with that id at this venue.
                requestId: 8f14e45f-ceea-4c6f-8f89-example
components:
  schemas:
    RotateSecretResponse:
      type: object
      properties:
        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:
        - 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
  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.