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

# Rotate Signing Secret

> Rotate an endpoint signing secret idempotently

Replace the stored endpoint secret promptly and keep rotation requests
idempotent. Do not assume that creating, listing, or retrieving an endpoint
returns its secret; only the dedicated signing-secret operations do.


## OpenAPI

````yaml api-reference/payment-webhooks/openapi.json POST /v1/webhook_endpoints/{id}/signing_secret/rotate
openapi: 3.1.0
info:
  title: Modulus Payment Webhooks API
  version: 1.0.0
  description: Manage Payment Webhook endpoints, signing secrets, and persisted events.
servers:
  - url: https://api.sbx.moduluslabs.io
    description: >-
      Sandbox. Use the base URL supplied with your production credentials when
      going live.
security:
  - ApiKey: []
tags:
  - name: Webhook endpoints
  - name: Signing secrets
  - name: Webhook events
paths:
  /v1/webhook_endpoints/{id}/signing_secret/rotate:
    parameters:
      - $ref: '#/components/parameters/EndpointId'
      - $ref: '#/components/parameters/IdempotencyKey'
    post:
      tags:
        - Signing secrets
      summary: Rotate an endpoint signing secret
      description: >-
        Requires `webhooks.write`. A unique `Idempotency-Key` prevents duplicate
        rotation.
      operationId: rotateWebhookSigningSecret
      responses:
        '200':
          description: Signing secret rotated. This response contains the new secret.
          headers:
            Cache-Control:
              schema:
                type: string
                const: no-store
            Pragma:
              schema:
                type: string
                const: no-cache
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SigningSecret'
              example:
                signing_secret: whsec_bmV3X3NpZ25pbmdfc2VjcmV0
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    EndpointId:
      name: id
      in: path
      required: true
      description: Webhook endpoint identifier returned by the create operation.
      schema:
        type: string
        format: uuid
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: >-
        Unique key for this signing-secret rotation. Reuse the same key only
        when retrying the same operation.
      schema:
        type: string
  schemas:
    SigningSecret:
      type: object
      required:
        - signing_secret
      additionalProperties: false
      properties:
        signing_secret:
          type: string
          pattern: ^whsec_
          description: >-
            Endpoint-specific secret used to verify Standard Webhooks
            signatures.
          example: whsec_dGVzdF9zaWduaW5nX3NlY3JldA==
      example:
        signing_secret: whsec_dGVzdF9zaWduaW5nX3NlY3JldA==
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          description: Error returned for an unsuccessful Payment Webhooks API request.
          required:
            - code
            - message
            - correlation_id
          properties:
            code:
              type: string
              description: Machine-readable error code.
              example: INVALID_DESCRIPTION
            message:
              type: string
              description: >-
                Human-readable validation message. Public field tokens retain
                their API spelling; do not branch on its wording.
              example: description must be 255 characters or fewer.
            correlation_id:
              type: string
              format: uuid
              description: Unique request identifier. Include it when contacting support.
  responses:
    BadRequest:
      description: The request failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: The API key is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: The key lacks the required scope or resource ownership.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: The resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InternalError:
      description: An internal error occurred.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: A Modulus API key with the required webhook scope.

````