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

# Create a promotion



## OpenAPI

````yaml /openapi/v1.yaml post /api/v1/promotions
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/promotions:
    post:
      tags:
        - Promotions
      summary: Create a promotion
      operationId: createPromotion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromotionInput'
            example:
              title: Double points weekend
              description: Earn 2x points on everything
              start_date: '2026-08-01'
              end_date: '2026-08-03'
      responses:
        '201':
          description: Promotion created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessEnvelope'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    PromotionInput:
      type: object
      properties:
        title:
          type: string
          example: Double points weekend
        description:
          type: string
          nullable: true
        active:
          type: boolean
          default: true
        start_date:
          type: string
          format: date
          example: '2026-08-01'
        end_date:
          type: string
          format: date
          example: '2026-08-03'
        time_active:
          $ref: '#/components/schemas/TimeActive'
    SuccessEnvelope:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          type: object
    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:
    BadRequest:
      description: Validation or business-rule error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            success: false
            error:
              message: Provide exactly one of "user_id" or "identifier"
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: 'API key from the Rigaly dashboard: `Authorization: Bearer rgly_sk_...`'

````