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

# Rotate the signing secret

> Issues a new signing secret for an external reward and returns it
**once** — it is never shown again by any endpoint. The previous secret
stops working immediately, so deploy the new one to your endpoint
promptly: calls signed with a secret your endpoint no longer accepts will
fail verification, and those redemptions are cancelled without charging
the customer.




## OpenAPI

````yaml /openapi/v1.yaml post /api/v1/rewards/{id}/webhook/rotate-secret
openapi: 3.1.0
info:
  title: Rigaly Business API
  version: '1.0'
  description: |
    Public API for businesses to manage their Rigaly loyalty programs: issue
    and redeem points, manage rewards, validate redemptions, and generate mass
    codes for physical products.

    All endpoints require an API key created in the Rigaly business dashboard
    (Tools → API Management), passed as `Authorization: Bearer rgly_sk_...`.
  contact:
    email: support@rigaly.com
servers:
  - url: https://api.rigaly.com
    description: Production
security:
  - apiKey: []
paths:
  /api/v1/rewards/{id}/webhook/rotate-secret:
    post:
      tags:
        - Rewards
      summary: Rotate the signing secret
      description: >
        Issues a new signing secret for an external reward and returns it

        **once** — it is never shown again by any endpoint. The previous secret

        stops working immediately, so deploy the new one to your endpoint

        promptly: calls signed with a secret your endpoint no longer accepts
        will

        fail verification, and those redemptions are cancelled without charging

        the customer.
      operationId: rotateRewardWebhookSecret
      parameters:
        - $ref: '#/components/parameters/ResourceId'
      responses:
        '200':
          description: New secret (shown once)
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          digital_webhook_secret:
                            type: string
                            description: 64-character hex secret. Store it now.
              example:
                success: true
                message: >-
                  Signing secret rotated. Store it now — it is never shown
                  again.
                data:
                  digital_webhook_secret: >-
                    8c1f0a94d3e27b65f4a1c0d9e8b7a6f5c4d3e2b1a09f8e7d6c5b4a3928170615
        '400':
          description: >-
            The reward is not externally sourced
            (`REWARD_NOT_EXTERNALLY_SOURCED`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                success: false
                error:
                  message: REWARD_NOT_EXTERNALLY_SOURCED
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    ResourceId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    ErrorEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
  responses:
    NotFound:
      description: Resource not found (or belongs to another business)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              message: Reward not found
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'API key from the Rigaly dashboard: `Authorization: Bearer rgly_sk_...`'

````