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

# Rotate webhook secret

> Generate a new HMAC secret for a webhook. The new secret is returned once — store it securely



## OpenAPI

````yaml https://api.struct.to/webhookopenapi.json post /webhooks/{webhook_id}/rotate-secret
openapi: 3.1.0
info:
  title: Polymarket Webhook API
  description: ''
  license:
    name: ''
  version: 1.0.0
servers:
  - url: https://api.struct.to/v1
security: []
tags:
  - name: Webhooks
    description: Webhook subscription management (CRUD operations)
  - name: Webhook Callbacks
    description: Outgoing HTTP calls to your endpoints when subscribed events occur
paths:
  /webhooks/{webhook_id}/rotate-secret:
    post:
      tags:
        - Webhooks
      summary: Rotate webhook secret
      description: >-
        Generate a new HMAC secret for a webhook. The new secret is returned
        once — store it securely
      operationId: rotate_secret
      parameters:
        - name: webhook_id
          in: path
          description: Webhook UUID
          required: true
          schema:
            type: string
      responses:
        '200':
          description: New secret generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RotateSecretResponse'
        '401':
          description: Missing or invalid API key
        '404':
          description: Webhook not found or not owned by user
      security:
        - api_key: []
components:
  schemas:
    RotateSecretResponse:
      type: object
      description: Response for POST /v1/webhook/{id}/rotate-secret
      required:
        - secret
        - rotated_at
      properties:
        secret:
          type: string
          description: The new HMAC secret (only returned once — store it securely)
        rotated_at:
          type: integer
          format: int64
          description: Timestamp of rotation (ms since epoch)

````