> ## 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.

# Update a reward

> Partial update — include only the fields to change (e.g. `{ "active": false }` to disable).



## OpenAPI

````yaml /openapi/v1.yaml patch /api/v1/rewards/{id}
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}:
    patch:
      tags:
        - Rewards
      summary: Update a reward
      description: >-
        Partial update — include only the fields to change (e.g. `{ "active":
        false }` to disable).
      operationId: updateReward
      parameters:
        - $ref: '#/components/parameters/ResourceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RewardInput'
      responses:
        '200':
          description: Reward updated
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          reward:
                            $ref: '#/components/schemas/Reward'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    ResourceId:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    RewardInput:
      type: object
      properties:
        name:
          type: string
          example: Free Coffee
        description:
          type: string
          nullable: true
        points_cost:
          type: integer
          minimum: 0
          example: 500
        active:
          type: boolean
          default: true
        start_date:
          type: string
          format: date
          nullable: true
        end_date:
          type: string
          format: date
          nullable: true
        time_active:
          $ref: '#/components/schemas/TimeActive'
        conditions:
          type: string
          nullable: true
          maxLength: 1000
          description: >-
            Free-text conditions shown to customers and returned on validation —
            use it to encode product restrictions your system enforces.
        cooldown_mode:
          type: string
          enum:
            - none
            - limit
            - once
          default: none
        cooldown_count:
          type: integer
          nullable: true
        cooldown_amount:
          type: integer
          nullable: true
        cooldown_unit:
          type: string
          enum:
            - minute
            - hour
            - day
            - month
          nullable: true
        birthday:
          type: boolean
          default: false
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    Reward:
      allOf:
        - $ref: '#/components/schemas/RewardInput'
        - type: object
          properties:
            id:
              type: string
              format: uuid
            business_id:
              type: string
              format: uuid
            type:
              type: string
              example: standard
            image_url:
              type: string
              nullable: true
            created_at:
              type: string
              format: date-time
    TimeActive:
      type: object
      description: >-
        Per-day time-of-day windows. Omit a day to leave it unrestricted; omit
        the whole field for always-active.
      additionalProperties:
        type: object
        properties:
          active:
            type: boolean
          start:
            type: string
            example: '09:00'
          end:
            type: string
            example: '17:00'
      example:
        monday:
          active: true
          start: '09:00'
          end: '17:00'
        tuesday:
          active: true
          start: '09:00'
          end: '17:00'
    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_...`'

````