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

# Create loyalty program

> Creates a new loyalty program with default status set to `draft`. Only one loyalty program can be in `draft` status at a time. To schedule a loyalty program for future, provide a future datetime value in `starts_at`. Use the activate endpoint to make it active or scheduled. Returns the created `LoyaltyProgram` object.



## OpenAPI

````yaml https://openapi.commercengine.io/ce-admin.json post /customers/loyalty-program
openapi: 3.1.0
info:
  title: CE Admin APIs
  version: '1.0'
  summary: Comprehensive admin interface for managing your e-commerce platform
  description: >-
    Complete administrative API suite for Commerce Engine, providing powerful
    tools to manage products, orders, customers, inventory, analytics, and
    system configuration. Designed for administrators and backend integrations
    requiring full platform control.
  license:
    name: All Rights Reserved
    url: https://www.commercengine.io/contact-us
  contact:
    email: support@commercengine.io
    url: https://www.commercengine.io/contact-us
    name: Support
servers:
  - url: https://staging.api.commercengine.io/api/v1/{store_id}/admin
    description: Staging Server
    variables:
      store_id:
        default: store_id
        description: Store ID
  - url: https://prod.api.commercengine.io/api/v1/{store_id}/admin
    description: Prod Server
    variables:
      store_id:
        default: store_id
        description: Store ID
security:
  - Authorization: []
tags:
  - name: Analytics
    description: Analytics
  - name: Catalog
    description: Catalog
  - name: Coupons & promotions
    description: Coupons & promotions
  - name: Customers
    description: Customers
  - name: Filter Options
    description: Filter Options
  - name: Inventories
    description: Inventories
  - name: Marketplace
    description: Marketplace
  - name: Marketplace Catalog
    description: Marketplace Catalog
  - name: Media Gallery
    description: Media Gallery
  - name: Metrics
    description: Metrics
  - name: Orders
    description: Orders
  - name: Payments
    description: Payments
  - name: Payouts
    description: Payouts
  - name: POS
    description: POS
  - name: POSAdmin
    description: Admin endpoints to be used as proxy in pos
  - name: Segments
    description: Segments
  - name: Shipping
    description: Shipping
  - name: SSE
    description: SSE
  - name: Store
    description: Store
  - name: Webhooks
    description: Webhooks
paths:
  /customers/loyalty-program:
    post:
      tags:
        - Customers
      summary: Create loyalty program
      description: >-
        Creates a new loyalty program with default status set to `draft`. Only
        one loyalty program can be in `draft` status at a time. To schedule a
        loyalty program for future, provide a future datetime value in
        `starts_at`. Use the activate endpoint to make it active or scheduled.
        Returns the created `LoyaltyProgram` object.
      operationId: create-loyalty-program
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoyaltyProgram'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  success:
                    type: boolean
                  content:
                    properties:
                      loyalty_program:
                        $ref: '#/components/schemas/LoyaltyProgram'
                    type: object
components:
  schemas:
    LoyaltyProgram:
      title: LoyaltyProgram
      type: object
      required:
        - name
        - renewal_type
        - starts_at
        - date_of_reset
        - tier_upgrade_criteria
        - points_earning_type
        - point_value
        - redemption_expiry_type
        - redemption_inactivity_days
        - tiers
      properties:
        id:
          type: string
          readOnly: true
        name:
          description: name of loyalty program
          type: string
        renewal_type:
          description: frequency at which loyalty program will be renewed.
          enum:
            - yearly
            - never
            - custom
        starts_at:
          description: >-
            If renewal_type is "custom", a corresponding valid date must be
            specified; for other types, the value should be null.
          type:
            - string
            - 'null'
          format: date
        date_of_reset:
          description: >-
            If renewal_type is "custom", a corresponding valid date must be
            specified; for other types, the value should be null.
          type:
            - string
            - 'null'
          format: date
        tier_upgrade_criteria:
          description: >-
            to decide tier upgradation based on no of orders or total purchase
            value
          enum:
            - total-spent
            - total-orders
            - custom
        points_earning_type:
          description: >-
            Defines how points are earned. "dynamic" means points are calculated
            based on a rate (points_earning_rate), "fixed" means a fixed number
            of points are given.
          enum:
            - dynamic
            - fixed
        point_value:
          description: The monetary value of one loyalty point.
          type: number
          default: 1
        redemption_expiry_type:
          description: >-
            Defines when loyalty points are expired. "never" means the points
            never expire, "inactivity" means the points expire after a certain
            number of days of inactivity, "reset_date" means the points expire
            when the loyalty program is reset.
          enum:
            - never
            - inactivity
            - reset_date
        redemption_inactivity_days:
          description: >-
            The number of days after the last order was placed, after which the
            points expire if redemption_expiry_type is "inactivity". required if
            redemption_expiry_type is "inactivity", otherwise should be null.
          type:
            - integer
            - 'null'
        status:
          $ref: '#/components/schemas/LoyaltyProgramStatus'
          readOnly: true
        pause_starts_at:
          description: >-
            If status is "paused", the date and time from which the loyalty
            program will be paused. If not specified, the loyalty program will
            be paused immediately.
          type:
            - string
            - 'null'
          format: date-time
        pause_ends_at:
          description: >-
            If status is "paused", the date and time until which the loyalty
            program will be paused. If not specified, the loyalty program will
            remain paused until it is resumed.
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
          readOnly: true
        modified_at:
          type: string
          format: date-time
          readOnly: true
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/LoyaltyTier'
      x-tags:
        - Customers
    LoyaltyProgramStatus:
      title: LoyaltyProgramStatus
      description: The operational status of the loyalty program.
      type: string
      enum:
        - draft
        - scheduled
        - active
        - inactive
        - paused
        - expired
    LoyaltyTier:
      title: LoyaltyTier
      type: object
      required:
        - name
        - total_spent_threshold
        - total_orders_threshold
        - points_earning_rate
        - fixed_points
        - point_value
        - earn_points_with_promotion
        - redeem_points_with_promotion
      properties:
        id:
          type: string
          readOnly: true
        name:
          description: name of loyalty tier
          type: string
        total_spent_threshold:
          description: It should be null if tier upgrade criteria is total orders only.
          type:
            - integer
            - 'null'
          minimum: 0
        total_orders_threshold:
          description: It should be null if tier upgrade criteria is total spent only.
          type:
            - integer
            - 'null'
          minimum: 0
        points_earning_rate:
          description: >-
            The rate at which points are earned. For point earning type =
            dynamic
          type:
            - number
            - 'null'
        fixed_points:
          description: Fixed loyalty points for all orders. For point earning type = fixed
          type:
            - integer
            - 'null'
        is_initial:
          description: only one tier will have value as True
          type: boolean
          readOnly: true
        next_tier_id:
          description: id of next loyalty tier
          type:
            - integer
            - 'null'
          readOnly: true
      x-tags:
        - Customers
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````