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



## OpenAPI

````yaml /openapi/v1.yaml post /api/v1/raffles
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/raffles:
    post:
      tags:
        - Raffles
      summary: Create a raffle
      operationId: createRaffle
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - starts_at
                - ends_at
                - points_cost
              properties:
                name:
                  type: string
                  example: Win a year of free coffee
                description:
                  type: string
                  nullable: true
                terms_conditions:
                  type: string
                  nullable: true
                starts_at:
                  type: string
                  format: date-time
                ends_at:
                  type: string
                  format: date-time
                points_cost:
                  type: integer
                  example: 100
                  description: Points per entry
                entries_per_user:
                  type: integer
                  example: 5
                winners_count:
                  type: integer
                  default: 1
      responses:
        '201':
          description: Raffle created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessEnvelope'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  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:
    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_...`'

````