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

# Rotate signing secret

> Mints a new secret and demotes the current one to a 24-hour overlap window, during which deliveries carry a SECOND `v1=` signature computed with the old secret. Accept either during rotation — that overlap is what stops an in-flight retry from failing the moment you rotate.

The new secret is returned only here.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/payments/webhooks/{webhookId}/rotate
openapi: 3.1.0
info:
  title: Hypermid API
  description: >-
    Price and execute cross-chain swaps, read reference data and payer balances,
    and quote the fiat on-ramp. Quotes return an executable `transactionRequest`
    your frontend submits directly, so Hypermid never custodies the funds.


    Payments — `checkout`, `deposit`, and `withdrawal` sessions — and
    payment-link management are available through these merchant REST endpoints
    and the [`@hypermid/sdk`](https://docs.hypermid.io/sdk/payments) package.
    Payer-facing routes are intentionally omitted.
  version: 0.2.0
  contact: {}
servers:
  - url: https://server.hypermid.io
    description: Production — live keys (sk_live_…)
  - url: https://server.hypermid.io
    description: Sandbox — test keys (sk_test_…), testnets only
security: []
tags:
  - name: payments
    description: >-
      Create and read payment sessions, manage webhooks, and configure payout
      addresses with a secret partner key.
  - name: payment links
    description: >-
      Create, read, version, and revoke reusable checkout payment links with a
      secret partner key.
  - name: quote
    description: >-
      Route pricing for the orchestration product. Returns an executable
      `transactionRequest` your frontend submits directly, so Hypermid never
      custodies the funds.
  - name: status
    description: >-
      Resolve the state of a submitted swap or transfer. Two endpoints with
      different audiences — see each one's description before choosing.
  - name: catalog
    description: >-
      Reference data an integration needs to render a picker: supported chains
      and tokens, prices, routable connections, and fee configuration. A sandbox
      key sees only testnets here.
  - name: balances
    description: Read a payer wallet's token balances across supported chains.
  - name: onramp
    description: >-
      The fiat rail — card and bank payment for crypto, quoted and settled
      through our onramp partner. Requires per-partner onramp credentials on
      your account.
  - name: webhooks
    description: >-
      Events Hypermid sends TO you when a session completes. These are requests
      we make to your server, not endpoints you call.
paths:
  /v1/payments/webhooks/{webhookId}/rotate:
    post:
      tags:
        - payments
      summary: Rotate signing secret
      description: >-
        Mints a new secret and demotes the current one to a 24-hour overlap
        window, during which deliveries carry a SECOND `v1=` signature computed
        with the old secret. Accept either during rotation — that overlap is
        what stops an in-flight retry from failing the moment you rotate.


        The new secret is returned only here.
      operationId: PaymentController_rotateWebhook
      parameters:
        - name: webhookId
          required: true
          in: path
          schema:
            type: string
      responses:
        '201':
          description: Signing secret rotated; the new secret is returned only here.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiEnvelope'
                  - type: object
                    required:
                      - data
                    properties:
                      data:
                        $ref: '#/components/schemas/RotateWebhookSecretResponseDto'
        '401':
          description: Missing, invalid, or non-secret partner key (`UNAUTHORIZED`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentErrorResponseDto'
        '403':
          description: >-
            Key or operation forbidden (`FORBIDDEN` or
            `RECIPIENT_NOT_ALLOWLISTED`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentErrorResponseDto'
        '404':
          description: >-
            Checkout, webhook, or configured capability not found
            (`PAYMENT_NOT_FOUND`, `NOT_FOUND`, or `NOT_CONFIGURED`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentErrorResponseDto'
        '500':
          description: Unexpected server error (`INTERNAL_ERROR`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentErrorResponseDto'
      security:
        - bearer: []
components:
  schemas:
    ApiEnvelope:
      type: object
      properties:
        traceId:
          type: string
          description: W3C trace id of the request — correlate with logs/traces in SigNoz.
          example: 4bf92f3577b34da6a3ce929d0e0e4736
        code:
          type: string
          enum:
            - OK
            - BAD_REQUEST
            - UNAUTHORIZED
            - FORBIDDEN
            - NOT_FOUND
            - CONFLICT
            - RATE_LIMITED
            - PAYLOAD_TOO_LARGE
            - UNSUPPORTED_CHAIN
            - INTERNAL_ERROR
            - UPSTREAM_TIMEOUT
            - UPSTREAM_ERROR
            - SERVICE_UNAVAILABLE
            - KILL_SWITCH_ACTIVE
            - CIRCUIT_BREAKER_OPEN
            - NO_QUOTE_AVAILABLE
            - QUOTE_STALE
            - SIMULATION_REVERTED
            - INVALID_PARAMS
            - AMOUNT_OUT_OF_BOUNDS
            - PAYOUT_TOKEN_NOT_ALLOWED
            - RECIPIENT_NOT_ALLOWLISTED
            - PAYMENT_EXPIRED
            - PAYMENT_NOT_FOUND
            - NOT_CONFIGURED
            - INSUFFICIENT_LIQUIDITY
            - ROUTE_TEMPORARILY_UNAVAILABLE
            - UNSUPPORTED_ROUTE
            - OVER_DELIVERY_CAP
          description: >-
            Domain error code. `OK` on success; non-OK values come with a
            non-null `error`.
          example: OK
        error:
          type:
            - string
            - 'null'
          description: Human-readable error message. `null` on success.
          example: null
        data:
          type:
            - object
            - 'null'
          description: Endpoint-specific payload. `null` on error.
      required:
        - traceId
        - code
        - error
        - data
    RotateWebhookSecretResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Endpoint that was rotated.
        secret:
          type: string
          description: The NEW signing secret. Returned only here — store it now.
        secretPreviousExpiresAt:
          type: string
          format: date-time
          description: >-
            When the old secret stops being accepted. Until then deliveries
            carry a second `v1=` signature under it.
      required:
        - id
        - secret
        - secretPreviousExpiresAt
    PaymentErrorResponseDto:
      type: object
      properties:
        traceId:
          type: string
          example: 4bf92f3577b34da6a3ce929d0e0e4736
          description: >-
            Correlation id for this request. Quote it in any support message —
            it is how we find your call in our logs.
        code:
          type: string
          enum:
            - OK
            - BAD_REQUEST
            - UNAUTHORIZED
            - FORBIDDEN
            - NOT_FOUND
            - CONFLICT
            - RATE_LIMITED
            - PAYLOAD_TOO_LARGE
            - UNSUPPORTED_CHAIN
            - INTERNAL_ERROR
            - UPSTREAM_TIMEOUT
            - UPSTREAM_ERROR
            - SERVICE_UNAVAILABLE
            - KILL_SWITCH_ACTIVE
            - CIRCUIT_BREAKER_OPEN
            - NO_QUOTE_AVAILABLE
            - QUOTE_STALE
            - SIMULATION_REVERTED
            - INVALID_PARAMS
            - AMOUNT_OUT_OF_BOUNDS
            - PAYOUT_TOKEN_NOT_ALLOWED
            - RECIPIENT_NOT_ALLOWLISTED
            - PAYMENT_EXPIRED
            - PAYMENT_NOT_FOUND
            - NOT_CONFIGURED
            - INSUFFICIENT_LIQUIDITY
            - ROUTE_TEMPORARILY_UNAVAILABLE
            - UNSUPPORTED_ROUTE
            - OVER_DELIVERY_CAP
          example: INVALID_PARAMS
          description: >-
            Stable machine-readable error code. Branch on this, not on `error`,
            whose wording may change.
        error:
          type: string
          example: orderId is required
          description: >-
            Human-readable explanation. For logs and developers — not intended
            to be shown to a payer verbatim.
        data:
          type:
            - object
            - 'null'
          example: null
          description: >-
            Always null on an error. Present so success and error envelopes have
            the same shape.
      required:
        - traceId
        - code
        - error
        - data
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Secret partner API key (`sk_live_…` or `sk_test_…`). Required to create
        or manage payment sessions. Server-side only — it can move money, so it
        must never reach a browser bundle. The key's prefix also selects the
        environment: `sk_test_` is confined to testnets.

````