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

# Rotate a Webhook Signing Secret

> Replaces the signing secret and returns the new one once. The old secret stops working immediately, and a delivery already in flight was signed with it, so accept both signatures on the receiver until traffic has settled.

**Error codes**

| `error.code` | HTTP | Cause | What to do |
| --- | --- | --- | --- |
| `not_found` | 422 | No subscription with this id exists in the calling org. | Check the id; a deleted subscription is never returned. |



## OpenAPI

````yaml https://api.monaco.com/openapi.json post /v1/webhooks/subscriptions/{subscription_id}/rotate-secret
openapi: 3.1.0
info:
  title: Monaco Public API
  description: Public API for Monaco
  version: 1.0.0
servers:
  - url: https://api.monaco.com
security: []
paths:
  /v1/webhooks/subscriptions/{subscription_id}/rotate-secret:
    post:
      tags:
        - Webhooks
      summary: Rotate a Webhook Signing Secret
      description: >-
        Replaces the signing secret and returns the new one once. The old secret
        stops working immediately, and a delivery already in flight was signed
        with it, so accept both signatures on the receiver until traffic has
        settled.


        **Error codes**


        | `error.code` | HTTP | Cause | What to do |

        | --- | --- | --- | --- |

        | `not_found` | 422 | No subscription with this id exists in the calling
        org. | Check the id; a deleted subscription is never returned. |
      operationId: rotate_webhook_subscription_secret
      parameters:
        - name: subscription_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Subscription Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PublicItemResponse_WebhookSecretRotateResponse_
        4XX:
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponse'
components:
  schemas:
    PublicItemResponse_WebhookSecretRotateResponse_:
      properties:
        data:
          $ref: '#/components/schemas/WebhookSecretRotateResponse'
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      type: object
      required:
        - data
      title: PublicItemResponse[WebhookSecretRotateResponse]
    PublicErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: PublicErrorResponse
    WebhookSecretRotateResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: The subscription whose secret was replaced
        secret:
          type: string
          title: Secret
          description: >-
            The new signing secret, returned only here. The previous secret
            stops working immediately.
          examples:
            - whsec_...
      type: object
      required:
        - id
        - secret
      title: WebhookSecretRotateResponse
    ResponseMeta:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: Server timestamp of the response
      type: object
      title: ResponseMeta
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
          description: Machine-readable error code
          examples:
            - not_found
        message:
          type: string
          title: Message
          description: Human-readable error message
          examples:
            - Resource not found
      type: object
      required:
        - code
        - message
      title: ErrorDetail

````

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