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

# Create Loyalty Campaign

> Creates a batch of [loyalty cards](/api-reference/loyalties/get-member) aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern.  


> 📘 Global uniqueness
> All codes are unique across the whole project. Voucherify won't allow to generate the same codes in any of your campaigns.


> 🚧 Asynchronous action!
>
> This is an asynchronous action, you can't read or modify a newly created campaign until the code generation is completed. See `creation_status` field in the [loyalty campaign object](/api-reference/loyalties/loyalty-campaign-object) description.



## OpenAPI

````yaml /openapi/loyalties.json post /v1/loyalties
openapi: 3.0.1
info:
  title: Voucherify API - Loyalties
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v1/loyalties:
    post:
      tags:
        - Loyalties
      summary: Create Loyalty Campaign
      description: >-
        Creates a batch of [loyalty cards](/api-reference/loyalties/get-member)
        aggregated in a single loyalty campaign. It also allows you to define a
        custom codes pattern.  



        > 📘 Global uniqueness

        > All codes are unique across the whole project. Voucherify won't allow
        to generate the same codes in any of your campaigns.



        > 🚧 Asynchronous action!

        >

        > This is an asynchronous action, you can't read or modify a newly
        created campaign until the code generation is completed. See
        `creation_status` field in the [loyalty campaign
        object](/api-reference/loyalties/loyalty-campaign-object) description.
      operationId: create-loyalty-program
      parameters: []
      requestBody:
        description: Specify the loyalty campaign details.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoyaltiesCreateCampaignRequestBody'
            examples:
              Example:
                value:
                  name: Loyalty Program 4
                  description: This is a campaign description.
                  auto_join: true
                  join_once: true
                  use_voucher_metadata_schema: true
                  start_date: '2016-10-26T00:00:00Z'
                  expiration_date: '2024-10-26T00:00:00Z'
                  validity_timeframe:
                    duration: PT1H
                    interval: P1D
                  validity_day_of_week:
                    - 0
                    - 1
                    - 2
                    - 3
                    - 4
                    - 5
                  activity_duration_after_publishing: P24D
                  category_id: cat_0b6152ce12414820dc
                  vouchers_count: 2
                  voucher:
                    type: LOYALTY_CARD
                    loyalty_card:
                      points: 0
                      expiration_rules:
                        period_type: MONTH
                        period_value: 3
                        rounding_type: END_OF_QUARTER
                    redemption:
                      quantity: 2
                    code_config:
                      pattern: L-CARD-#######
                  metadata:
                    test: true
                  type: STATIC
                  loyalty_tiers_expiration:
                    qualification_type: BALANCE
                    start_date:
                      type: IMMEDIATE
                    expiration_date:
                      type: CUSTOM
                      extend: P3M
                      rounding:
                        type: MONTH
                        strategy: END
        required: true
      responses:
        '200':
          description: >-
            Returns a campaign object with its settings but without the loyalty
            card codes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoyaltiesCreateCampaignResponseBody'
              examples:
                Example:
                  value:
                    id: camp_wGlqXtnHddb39DvHuuhvvbxi
                    name: Loyalty Program 4
                    campaign_type: LOYALTY_PROGRAM
                    type: STATIC
                    voucher:
                      type: LOYALTY_CARD
                      loyalty_card:
                        points: 0
                        expiration_rules:
                          period_type: MONTH
                          period_value: 3
                          rounding_type: END_OF_QUARTER
                      redemption:
                        quantity: 2
                      code_config:
                        length: 7
                        charset: >-
                          0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
                        pattern: L-CARD-#######
                      is_referral_code: false
                      start_date: '2016-10-26T00:00:00.000Z'
                      expiration_date: '2024-10-26T00:00:00.000Z'
                      validity_timeframe:
                        interval: P1D
                        duration: PT1H
                    auto_join: true
                    join_once: true
                    use_voucher_metadata_schema: true
                    description: This is a campaign description.
                    start_date: '2016-10-26T00:00:00.000Z'
                    expiration_date: '2024-10-26T00:00:00.000Z'
                    validity_timeframe:
                      interval: P1D
                      duration: PT1H
                    validity_day_of_week:
                      - 0
                      - 1
                      - 2
                      - 3
                      - 4
                      - 5
                    activity_duration_after_publishing: P24D
                    vouchers_count: 0
                    active: true
                    metadata:
                      test: true
                    created_at: '2022-11-29T13:10:30.848Z'
                    category: New Customers
                    creation_status: IN_PROGRESS
                    vouchers_generation_status: IN_PROGRESS
                    protected: false
                    validation_rules_assignments:
                      object: list
                      data_ref: data
                      data: []
                      total: 0
                    category_id: cat_0b6152ce12414820dc
                    categories:
                      - id: cat_0b6152ce12414820dc
                        name: New Customers
                        hierarchy: 0
                        created_at: '2022-07-14T20:17:07.657Z'
                        object: category
                    loyalty_tiers_expiration:
                      qualification_type: BALANCE
                      start_date:
                        type: IMMEDIATE
                      expiration_date:
                        type: CUSTOM
                        extend: P3M
                        rounding:
                          type: MONTH
                          strategy: END
                    object: campaign
        '409':
          description: >-
            Returns an error if a loyalty campaign with the same name already
            exists.
          content:
            application/json:
              schema:
                type: object
                properties: {}
              examples:
                Example:
                  value:
                    code: 409
                    key: duplicate_found
                    message: Duplicated resource found
                    details: Duplicated campaign exists with name Loyalty Program 2
                    request_id: v-0c12951ec58e67577e
                    resource_id: Loyalty Program 2
                    resource_type: campaign
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - loyalties
components:
  schemas:
    LoyaltiesCreateCampaignRequestBody:
      type: object
      title: Loyalties Create Campaign Request Body
      description: Request body schema for **POST** `/loyalties`.
      allOf:
        - $ref: '#/components/schemas/CampaignsCreateLoyaltyCampaign'
    LoyaltiesCreateCampaignResponseBody:
      type: object
      title: Loyalties Create Campaign Response Body
      description: Response body schema for **POST** `/loyalties`.
      allOf:
        - $ref: '#/components/schemas/LoyaltyCampaign'
    CampaignsCreateLoyaltyCampaign:
      title: Create Loyalty Campaign
      allOf:
        - $ref: '#/components/schemas/CampaignsCreateBase'
        - type: object
          title: Schema that contains unique properties for Loyalty Campaign
          description: >-
            Body schema for creating a campaign of loyalty type using **POST**
            `v1/campaigns`.
          properties:
            campaign_type:
              type: string
              default: LOYALTY_PROGRAM
              enum:
                - LOYALTY_PROGRAM
              description: Type of campaign.
            voucher:
              $ref: '#/components/schemas/CampaignLoyaltyVoucher'
    LoyaltyCampaign:
      title: Loyalty Campaign
      properties:
        id:
          type: string
          description: Unique campaign ID, assigned by Voucherify.
          example: camp_f7fBbQxUuTN7dI7tGOo5XMDA
        name:
          type: string
          description: Campaign name.
        description:
          type: string
          description: >-
            An optional field to keep any extra textual information about the
            campaign such as a campaign description and details.
        campaign_type:
          type: string
          default: LOYALTY_PROGRAM
          enum:
            - LOYALTY_PROGRAM
          description: Type of campaign.
        type:
          type: string
          description: >-
            Defines whether the campaign can be updated with new vouchers after
            campaign creation.    


            - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will
            generate based on set criteria    

            -  `STATIC`: vouchers need to be manually published
          enum:
            - AUTO_UPDATE
            - STATIC
        voucher:
          $ref: '#/components/schemas/LoyaltyCampaignVoucher'
        auto_join:
          type: boolean
          description: >-
            Indicates whether customers will be able to auto-join a loyalty
            campaign if any earning rule is fulfilled.
        join_once:
          type: boolean
          description: >-
            Always set to `true` for loyalty campaigns, meaning customers can
            join the campaign only once. It can't be changed to `false`.
        use_voucher_metadata_schema:
          type: boolean
          description: >-
            Flag indicating whether the campaign is to use the voucher's
            metadata schema instead of the campaign metadata schema.
        validity_timeframe:
          $ref: '#/components/schemas/ValidityTimeframe'
        validity_day_of_week:
          $ref: '#/components/schemas/ValidityDayOfWeek'
        validity_hours:
          $ref: '#/components/schemas/ValidityHours'
        activity_duration_after_publishing:
          type: string
          description: >-
            Defines the amount of time the campaign will be active in ISO 8601
            format after publishing. For example, a campaign with a `duration`
            of `P24D` will be valid for a duration of 24 days.
        vouchers_count:
          type: integer
          description: Total number of unique vouchers in campaign.
        start_date:
          type: string
          format: date-time
          description: >-
            Activation timestamp defines when the campaign starts to be active
            in ISO 8601 format. Campaign is *inactive before* this date. 
          example: '2022-09-20T00:00:00.000Z'
        expiration_date:
          type: string
          format: date-time
          description: >-
            Expiration timestamp defines when the campaign expires in ISO 8601
            format.  Campaign is *inactive after* this date.
          example: '2022-09-30T00:00:00.000Z'
        active:
          type: boolean
          description: >-
            A flag to toggle the campaign on or off. You can disable a campaign
            even though it's within the active period defined by the
            `start_date` and `expiration_date`.  


            - `true` indicates an *active* campaign

            - `false` indicates an *inactive* campaign
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes assigned to the
            campaign. A set of key/value pairs that you can attach to a campaign
            object. It can be useful for storing additional information about
            the campaign in a structured format.
        created_at:
          type: string
          format: date-time
          example: '2021-12-01T08:00:50.038Z'
          description: >-
            Timestamp representing the date and time when the campaign was
            created. The value is shown in the ISO 8601 format.
        updated_at:
          type: string
          format: date-time
          example: '2022-09-20T09:18:19.623Z'
          description: >-
            Timestamp representing the date and time when the campaign was last
            updated in ISO 8601 format.
        category:
          type: string
          description: Unique category name.
        creation_status:
          type: string
          enum:
            - DONE
            - IN_PROGRESS
            - FAILED
            - DRAFT
            - MODIFYING
          description: Indicates the status of the campaign creation.
        vouchers_generation_status:
          type: string
          description: Indicates the status of the campaign's voucher generation.
          enum:
            - DONE
            - IN_PROGRESS
            - FAILED
            - DRAFT
            - MODIFYING
        readonly:
          type: boolean
          description: >-
            Indicates whether the campaign can be only read by a restricted user
            in the Areas and Stores enterprise feature. It is returned only to
            restricted users; this field is not returned for users with other
            roles.
        protected:
          type: boolean
          description: Indicates whether the resource can be deleted.
        category_id:
          type: string
          nullable: true
          description: Unique category ID that this campaign belongs to.
          example: cat_0b688929a2476386a7
        categories:
          type: array
          description: Contains details about the category.
          items:
            $ref: '#/components/schemas/Category'
        object:
          type: string
          default: campaign
          description: >-
            The type of the object represented by JSON. This object stores
            information about the campaign.
        loyalty_tiers_expiration:
          $ref: '#/components/schemas/LoyaltyTiersExpirationAll'
        validation_rules_assignments:
          $ref: '#/components/schemas/ValidationRulesAssignmentsList'
        access_settings_assignments:
          $ref: '#/components/schemas/AccessSettingsCampaignAssignmentsList'
      required:
        - id
        - name
        - campaign_type
        - type
        - auto_join
        - join_once
        - use_voucher_metadata_schema
        - created_at
        - creation_status
        - vouchers_generation_status
        - protected
        - category_id
        - categories
        - object
    CampaignsCreateBase:
      type: object
      title: Campaign Create Schema Base
      description: Base body schema for creating a campaign
      properties:
        name:
          type: string
          description: Campaign name.
        description:
          type: string
          description: >-
            An optional field to keep any extra textual information about the
            campaign such as a campaign description and details.
        type:
          type: string
          description: >-
            Defines whether the campaign can be updated with new vouchers after
            campaign creation or if the campaign consists of generic
            (standalone) vouchers.


            - `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will
            generate based on set criteria

            -  `STATIC`: vouchers need to be manually published
          enum:
            - AUTO_UPDATE
            - STATIC
        join_once:
          type: boolean
          description: >-
            If this value is set to `true`, customers will be able to join the
            campaign only once. For loyalty campaigns, it's forced to `true`,
            even if `join_once: false` is passed in the request.
        auto_join:
          type: boolean
          description: >-
            Indicates whether customers will be able to auto-join a loyalty
            campaign if any earning rule is fulfilled.
        use_voucher_metadata_schema:
          type: boolean
          description: >-
            Flag indicating whether the campaign is to use the voucher's
            metadata schema instead of the campaign metadata schema.
        vouchers_count:
          type: integer
          description: Total number of unique vouchers in campaign (size of campaign).
        start_date:
          type: string
          format: date-time
          description: >-
            Activation timestamp defines when the campaign starts to be active
            in ISO 8601 format. Campaign is *inactive before* this date. 
          example: '2022-09-20T00:00:00.000Z'
        expiration_date:
          type: string
          format: date-time
          description: >-
            Expiration timestamp defines when the campaign expires in ISO 8601
            format.  Campaign is *inactive after* this date.
          example: '2022-09-30T00:00:00.000Z'
        validity_timeframe:
          $ref: '#/components/schemas/ValidityTimeframe'
        validity_day_of_week:
          $ref: '#/components/schemas/ValidityDayOfWeek'
        validity_hours:
          $ref: '#/components/schemas/ValidityHours'
        activity_duration_after_publishing:
          type: string
          description: >-
            Defines the amount of time the vouchers will be active after
            publishing. The value is shown in the ISO 8601 format. For example,
            a voucher with the value of P24D will be valid for a duration of 24
            days.
        category_id:
          type: string
          description: >-
            Unique category ID that this campaign belongs to. Either pass this
            parameter OR the `category`.
          example: cat_0b688929a2476386a7
        category:
          type: string
          description: >-
            The category assigned to the campaign. Either pass this parameter OR
            the `category_id`.
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes assigned to the
            campaign. A set of key/value pairs that you can attach to a campaign
            object. It can be useful for storing additional information about
            the campaign in a structured format.
        access_settings:
          $ref: '#/components/schemas/AccessSettings'
    CampaignLoyaltyVoucher:
      type: object
      description: Schema model for a discount voucher.
      title: Campaign Loyalty Voucher
      properties:
        type:
          type: string
          default: LOYALTY_CARD
          enum:
            - LOYALTY_CARD
          description: Type of voucher.
        loyalty_card:
          $ref: '#/components/schemas/CampaignLoyaltyCard'
        redemption:
          type: object
          description: Defines the redemption limits on vouchers.
          properties:
            quantity:
              type: integer
              nullable: true
              description: >-
                How many times a voucher can be redeemed. A `null` value means
                unlimited.
        code_config:
          $ref: '#/components/schemas/CodeConfig'
      required:
        - type
        - loyalty_card
    LoyaltyCampaignVoucher:
      type: object
      description: Schema model for a campaign voucher.
      title: Loyalty Campaign Voucher
      properties:
        type:
          type: string
          default: LOYALTY_CARD
          enum:
            - LOYALTY_CARD
          description: Type of voucher.
        loyalty_card:
          description: Defines the voucher loyalty card details.
          allOf:
            - $ref: '#/components/schemas/CampaignLoyaltyCard'
        redemption:
          type: object
          description: Defines the redemption limits on vouchers.
          properties:
            quantity:
              type: integer
              nullable: true
              description: >-
                How many times a voucher can be redeemed. A `null` value means
                unlimited.
          required:
            - quantity
        code_config:
          allOf:
            - $ref: '#/components/schemas/CodeConfig'
          required:
            - length
            - charset
            - pattern
        is_referral_code:
          type: boolean
          description: Always `false` for a loyalty card voucher
        start_date:
          type: string
          format: date-time
          description: >-
            Activation timestamp defines when the campaign starts to be active
            in ISO 8601 format. Campaign is *inactive before* this date. 
          example: '2022-09-20T00:00:00.000Z'
        expiration_date:
          type: string
          format: date-time
          description: >-
            Expiration timestamp defines when the campaign expires in ISO 8601
            format.  Campaign is *inactive after* this date.
          example: '2022-09-30T00:00:00.000Z'
        validity_timeframe:
          $ref: '#/components/schemas/ValidityTimeframe'
        validity_day_of_week:
          $ref: '#/components/schemas/ValidityDayOfWeek'
        validity_hours:
          $ref: '#/components/schemas/ValidityHours'
      required:
        - type
        - redemption
        - code_config
        - is_referral_code
    ValidityTimeframe:
      title: Validity Timeframe
      type: object
      description: >-
        Set recurrent time periods when the earning rule is valid. For example,
        valid for 1 hour every other day.`start_date` **required** when
        including the `validity_timeframe`.
      properties:
        duration:
          type: string
          description: >-
            Defines the amount of time an earning rule will be active in ISO
            8601 format. For example, an earning rule with a `duration` of
            `PT1H` will be valid for a duration of one hour.
          example: PT1H
        interval:
          type: string
          description: >-
            Defines the intervening time between two time points in ISO 8601
            format, expressed as a duration. For example, an earning rule with
            an `interval` of `P2D` will be valid every other day.
          example: P2D
    ValidityDayOfWeek:
      title: Validity Day Of Week
      type: array
      description: >-
        Integer array corresponding to the particular days of the week in which
        the voucher is valid.


        - `0` Sunday

        - `1` Monday

        - `2` Tuesday

        - `3` Wednesday

        - `4` Thursday

        - `5` Friday

        - `6` Saturday
      items:
        type: integer
        enum:
          - 0
          - 1
          - 2
          - 3
          - 4
          - 5
          - 6
    ValidityHours:
      title: Validity Hours
      type: object
      description: Determines the hours of validity, e.g. to create a happy hours scenario.
      properties:
        daily:
          type: array
          description: >-
            Defines the recurring period(s) when the resource is active. The
            periods should not overlap.
          items:
            type: object
            description: Defines the recurring period(s) when the resource will be active.
            properties:
              start_time:
                type: string
                format: time
                description: >-
                  Defines the starting hour of validity in the HH:mm format. The
                  resource is *inactive before* this time.
                example: '12:00'
              days_of_week:
                type: array
                description: >-
                  Integer array corresponding to the particular days of the week
                  in which the resource is valid.


                  - `0` Sunday

                  - `1` Monday

                  - `2` Tuesday

                  - `3`  Wednesday

                  - `4` Thursday

                  - `5` Friday

                  - `6` Saturday
                items:
                  type: integer
                  enum:
                    - 0
                    - 1
                    - 2
                    - 3
                    - 4
                    - 5
                    - 6
              expiration_time:
                type: string
                format: time
                description: >-
                  Defines the ending hour of validity in the HH:mm format. The
                  resource is *inactive after* this time.
                example: '14:00'
    Category:
      title: Category
      description: This is an object representing a category.
      type: object
      properties:
        id:
          type: string
          description: Unique category ID assigned by Voucherify.
        name:
          type: string
          description: Category name.
        hierarchy:
          type: integer
          description: >-
            Category hierarchy. Categories with lower hierarchy are processed
            before categories with higher hierarchy value.
          minimum: 0
        object:
          type: string
          default: category
          enum:
            - category
          description: >-
            The type of the object represented by the JSON. This object stores
            information about the category.
        created_at:
          type: string
          description: >-
            Timestamp representing the date and time when the category was
            created. The value is shown in the ISO 8601 format.
          example: '2022-07-14T10:45:13.156Z'
          format: date-time
        updated_at:
          type: string
          example: '2022-08-16T10:52:08.094Z'
          description: >-
            Timestamp representing the date and time when the category was
            updated. The value is shown in the ISO 8601 format.
          format: date-time
      required:
        - id
        - name
        - hierarchy
        - created_at
        - object
    LoyaltyTiersExpirationAll:
      title: Loyalty Tiers Expiration
      type: object
      description: Defines the Loyalty Tiers Expiration.
      properties:
        qualification_type:
          type: string
          enum:
            - BALANCE
            - POINTS_IN_PERIOD
          description: >-
            Tier qualification.   


            `BALANCE`: Points balance is based on the customer's current points
            balance. Customers qualify for the tier if their points balance is
            in the points range of the tier. 
             `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold.
        qualification_period:
          type: string
          description: >-
            Customers can qualify for the tier if they collected enough points
            in a given time period. So, in addition to the customer having to
            reach a points range, they also need to have collected the points
            within a set time period.    


            | **Period** | **Definition** |

            |:---|:---|

            | **Calendar Month** | Points collected in one calendar month<br
            />January, February, March, etc. |

            | **Calendar Quarter** | Points collected in the quarter<br />-
            January - March<br />- April - June<br />- July - September<br />-
            October - December |

            | **Calendar Half-year** | Points collected in the half-year<br />-
            January - June<br />- July - December |

            | **Calendar Year** | Points collected in one calendar year<br
            />January - December |
          enum:
            - MONTH
            - QUARTER
            - HALF_YEAR
            - YEAR
        start_date:
          type: object
          description: Defines the conditions for the start date of the tier.
          properties:
            type:
              type: string
              enum:
                - IMMEDIATE
                - NEXT_PERIOD
              description: |-
                What triggers the tier to be valid for a customer.    
                `IMMEDIATE`: After reaching the minimum required points. 
                `NEXT_PERIOD`: When the next qualification period starts.
          required:
            - type
        expiration_date:
          type: object
          description: Defines the conditions for the expiration date of a tier.
          properties:
            type:
              type: string
              enum:
                - END_OF_PERIOD
                - END_OF_NEXT_PERIOD
                - BALANCE_DROP
                - CUSTOM
              description: >-
                What triggers the tier to expire for a customer.    

                `END_OF_PERIOD`: Expire tier at the end of the period.    

                `END_OF_NEXT_PERIOD`:  Expire tier at the end of the next
                period. 
                 `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. 
                 `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.
            extend:
              type: string
              description: >-
                Extend the expiration by adding extra months or days in ISO 8601
                format. The tier will remain active even though it reaches its
                expiration time period. For example, a tier with a duration of
                `P3M` will be valid for an additional duration of 3 months and a
                tier with a duration of `P1D` will be valid for an additional
                duration of 1 day.
            rounding:
              description: Defines the rounding mechanism for tier expiration.
              properties:
                type:
                  type: string
                  enum:
                    - MONTH
                    - QUARTER
                    - HALF_YEAR
                    - YEAR
                    - CUSTOM
                  description: >-
                    This mechanism describes a custom rounding for the
                    expiration date.
                strategy:
                  type: string
                  enum:
                    - START
                    - END
                  description: >-
                    This mechanism describes a rounding strategy for the
                    expiration date.
                unit:
                  type: string
                  description: >-
                    Defines the type of unit of time in which the rounding
                    period is counted.
                  default: MONTH
                  enum:
                    - MONTH
                value:
                  type: integer
                  description: >-
                    Value for the unit of time that the rounding applies to.
                    Units for this parameter are defined by the `rounding.unit`
                    parameter.    

                    - `0`: January

                    - `1`: February

                    - `2`: March

                    - `3`: April

                    - `4`: May

                    - `5`: June

                    - `6`: July

                    - `7`: August

                    - `8`: September

                    - `9`: October

                    - `10`: November

                    - `11`: December
          required:
            - type
            - extend
      required:
        - qualification_type
        - start_date
        - expiration_date
    ValidationRulesAssignmentsList:
      title: Validation Rules Assignments List
      description: List of Validation Rules Assignments
      type: object
      properties:
        object:
          type: string
          default: list
          enum:
            - list
          description: >-
            The type of the object represented by JSON. This object stores
            information about validation rules assignments.
        data_ref:
          type: string
          default: data
          enum:
            - data
          description: >-
            Identifies the name of the attribute that contains the array of
            validation rules assignments.
        data:
          type: array
          description: Contains array of validation rules assignments.
          items:
            $ref: '#/components/schemas/BusValRuleAssignment'
        total:
          type: integer
          minimum: 0
          description: Total number of validation rules assignments.
      required:
        - object
        - data_ref
        - data
        - total
    AccessSettingsCampaignAssignmentsList:
      title: Access Settings Campaign Assignments List
      type: object
      description: >-
        Lists all assignments of the campaign to areas and stores. For [GET List
        Campaigns](/api-reference/campaigns/list-campaigns), this is returned if
        the `expand=access_settings_assignments` query parameter is passed in
        the request. This object is not returned for the [GET Campaign summary
        endpoint](/api-reference/campaigns/get-campaign-summary).


        **NOTE**: This object is returned only if the Areas and Stores
        enterprise feature is enabled. Contact [Voucherify
        Sales](https://www.voucherify.io/contact-sales) to learn more.
      properties:
        object:
          type: string
          default: list
          description: >-
            The type of the object represented by JSON. Default is `list`. This
            object stores information about campaign assignments to areas and
            stores
          enum:
            - list
        data_ref:
          type: string
          default: data
          description: >-
            Identifies the name of the attribute that contains the array of
            campaign assignments.
          enum:
            - data
        data:
          type: array
          description: Contains an array of campaign assignments.
          items:
            $ref: '#/components/schemas/AreaStoreCampaignAssignment'
        total:
          type: integer
          description: Total number of areas and stores to which the campaign is assigned.
          minimum: 0
      required:
        - object
        - data_ref
        - data
        - total
    AccessSettings:
      type: object
      title: Access Settings
      description: >-
        Assigns or unassigns an area or store to the campaign.


        **NOTE**: this object can be sent if the Areas and Stores enterprise
        feature is enabled. Contact [Voucherify
        Sales](https://www.voucherify.io/contact-sales) to learn more.
      properties:
        assign:
          type: object
          description: >-
            Assigns the campaign to an area or a store. Provide the area and/or
            store IDs in the respective arrays. If a campaign changes
            assignments between areas or stores, unassign it from the area. For
            example, if a campaign is assigned to Area-01, but it must be now
            assigned to Store-01 within this area, you have to unassign the
            campaign from Area-01 and assign to Store-01 only.


            If you want to assign the campaign to stores only, you do not have
            to send the area ID.
          properties:
            areas_ids:
              type: array
              description: List all area IDs to which the campaign will be assigned.
              items:
                type: string
            area_stores_ids:
              type: array
              description: List all store IDs to which the campaign will be assigned.
              items:
                type: string
            area_all_stores_ids:
              type: array
              description: >-
                List all area IDs where the campaign is assigned to all stores
                in the area. This assignment is not equal to the assignment to
                all `area_stores_ids` listed separately.
              items:
                type: string
        unassign:
          type: object
          description: >-
            Unassigns the campaign from an area or a store. Provide the area
            and/or store IDs in the respective arrays. If a campaign changes
            assignments between areas or stores, unassign it first. For example,
            if a campaign is assigned to Area-01, but it must be now assigned to
            Store-01 within this area, you have to unassign the campaign from
            Area-01 and assigned to Store-01 only.


            If you want to assign the campaign to stores only, you do not have
            to send the area ID.
          properties:
            areas_ids:
              type: array
              description: List all area IDs from which the campaign will be unassigned.
              items:
                type: string
            area_stores_ids:
              type: array
              description: List all store IDs from which the campaign will be unassigned.
              items:
                type: string
            area_all_stores_ids:
              type: array
              description: >-
                List all area IDs where the campaign will be unassigned from all
                stores in the area. This unassignment is not equal to the
                unassignment from all `area_stores_ids` listed separately.
              items:
                type: string
    CampaignLoyaltyCard:
      type: object
      description: Schema model for a campaign loyalty card.
      title: Campaign Loyalty Card
      properties:
        points:
          type: integer
          description: >-
            The initial number of points to assign to the loyalty card. This is
            the current loyalty card score i.e. the number of loyalty points on
            the card.
        expiration_rules:
          type: object
          description: >-
            Defines the loyalty point expiration rule. This expiration rule
            applies when there are no `expiration_rules` defined for an earning
            rule.
          properties:
            period_type:
              type: string
              description: >-
                Type of period. Can be set for `MONTH` or `FIXED_DAY_OF_YEAR`.
                `MONTH` requires the `period_value` field. `FIXED_DAY_OF_YEAR`
                requires the `fixed_month` and `fixed_day` fields.
              enum:
                - FIXED_DAY_OF_YEAR
                - MONTH
            period_value:
              type: integer
              description: 'Value of the period. Required for the `period_type: MONTH`.'
            rounding_type:
              type: string
              description: >-
                Type of rounding of the expiration period. Optional for the
                `period_type: MONTH`.
              enum:
                - END_OF_MONTH
                - END_OF_QUARTER
                - END_OF_HALF_YEAR
                - END_OF_YEAR
                - PARTICULAR_MONTH
            rounding_value:
              type: integer
              description: >-
                Value of rounding of the expiration period. Required for the
                `rounding_type`.
            fixed_month:
              type: integer
              description: >-
                Determines the month when the points expire; `1` is January, `2`
                is February, and so on. Required for the `period_type:
                FIXED_DAY_OF_YEAR`.
              minimum: 1
              maximum: 12
            fixed_day:
              type: integer
              description: >-
                Determines the day of the month when the points expire. Required
                for the `period_type: FIXED_DAY_OF_YEAR`.
              minimum: 1
              maximum: 31
          required:
            - period_type
      required:
        - points
    CodeConfig:
      title: Code Config
      type: object
      description: >-
        Contains information about the config used for the voucher code. Defines
        the code's pattern (prefix, postfix, length, charset, etc).
      properties:
        length:
          type: number
          description: >-
            Number of characters in a generated code (excluding prefix and
            postfix).
        charset:
          type: string
          description: >-
            Characters that can appear in the code.  


            Examples:


            - Alphanumeric:
            `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` 

            - Alphabetic:
            `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` 

            - Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` 

            - Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` 

            - Numbers: `0123456789`  

            - Custom: a custom character set
        prefix:
          type: string
          description: A text appended before the code.
        postfix:
          type: string
          description: A text appended after the code.
        pattern:
          type: string
          description: >-
            A pattern for codes where hashes (#) will be replaced with random
            characters. Overrides `length`.
        initial_count:
          type: integer
          description: Internal value, does not change anything if provided.
    BusValRuleAssignment:
      title: Business Validation Rule Assignment
      description: Assignments of business validation rule
      example:
        id: asgm_LnY1g7UNFA9KyDrD
        rule_id: val_3gPNA6SnH4ae
        related_object_id: camp_CZOnEGiZfwIKWmSjhIoIT7Ol
        related_object_type: campaign
        object: validation_rules_assignment
        validation_status: PARTIALLY_VALID
        validation_omitted_rules:
          - '1'
      properties:
        id:
          type: string
          description: The unique identifier for a assignment
        rule_id:
          type: string
          description: The unique identifier for a rule
        related_object_id:
          type: string
          description: The unique identifier for a related object
        related_object_type:
          type: string
          description: The type of related object
        created_at:
          type: string
          description: >-
            Timestamp representing the date and time when the object was
            created. The value is shown in the ISO 8601 format.
          example: '2022-03-09T11:19:04.819Z'
          format: date-time
        updated_at:
          type: string
          description: >-
            Timestamp representing the date and time when the object was last
            updated in ISO 8601 format.
          example: '2022-03-09T11:19:04.819Z'
          format: date-time
        object:
          type: string
          description: The type of the object represented by JSON.
          default: validation_rules_assignment
          enum:
            - validation_rules_assignment
        validation_status:
          type: string
          description: The validation status of the assignment
          enum:
            - VALID
            - PARTIALLY_VALID
            - INVALID
        validation_omitted_rules:
          type: array
          description: The list of omitted rules
          items:
            type: string
      required:
        - id
        - rule_id
        - related_object_id
        - related_object_type
        - object
    AreaStoreCampaignAssignment:
      title: Areas and Stores Campain Assignment
      type: object
      description: An object representing an assignment of a campaign to an area or store.
      properties:
        id:
          type: string
          description: Unique identifier of the campaign assignment.
          example: arsca_0ef5ee192117ae2416
        area_id:
          type: string
          description: Unique identifier of the area to which the campaign is assigned.
          example: ar_0ea6cd7b781b8f857f
        all_stores:
          type: boolean
          description: >-
            Determines if the campaign is assigned to all of the stores in the
            area, i.e. if an area ID is passed in the
            `access_settings.assign.area_all_stores_ids` in the request.
        area_store_id:
          type: string
          description: Unique identifier of the store to which the campaign is assigned.
          example: ars_0ec347e2016bed85f4
        created_at:
          type: string
          description: >-
            Date and time when the assignment was made. The value is shown in
            the ISO 8601 format.
          format: date-time
          example: '2024-06-25T19:04:16.260Z'
        object:
          type: string
          description: >-
            The type of the object represented by JSON. This object stores
            information about the campaign assignment to areas or stores.
          default: area_store_campaign_assignment
          enum:
            - area_store_campaign_assignment
      required:
        - id
        - area_id
        - created_at
        - object
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    X-Voucherify-OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://api.voucherify.io/v1/oauth/token
          scopes:
            api: Gives access to whole server-side API.
            vouchers: >-
              Gives access to all endpoints and methods starting with
              `v1/vouchers`.
            client_api: Gives access to whole client-side API.
            client_vouchers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/vouchers`.
            promotions: >-
              Gives access to all endpoints and methods starting with
              `/v1/promotions`.
            client_promotions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/promotions`
            campaigns: >-
              Gives access to all endpoints and methods starting with
              `v1/campaigns`.
            client_publish: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/publish`.
            exports: >-
              Gives access to all endpoints and methods starting with
              `/v1/exports`.
            publications: >-
              Gives access to all endpoints and methods starting with
              `/v1/publications`.
            client_validate: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validate`.
            validations: >-
              Gives access to all endpoints and methods starting with
              `/v1/validations`.
            client_validations: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validations`.
            qualifications: >-
              Gives access to all endpoints and methods starting with
              `/v1/qualifications`.
            client_qualifications: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/qualifications`.
            client_redeem: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redeem
            redemptions: >-
              Gives access to all endpoints and methods starting with
              `/v1/redemptions`.
            client_redemptions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redemptions`
            customers: >-
              Gives access to all endpoints and methods starting with
              `/v1/customers`.
            client_customers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/customers`.
            orders: >-
              Gives access to all endpoints and methods starting with
              `/v1/orders`.
            products: >-
              Gives access to all endpoints and methods starting with
              `/v1/products`.
            skus: >-
              Gives access to all endpoints and methods starting with
              `/v1/SKUs`.
            validation-rules: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules`.
            validation-rules-assignments: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules-assignments
            segments: >-
              Gives access to all endpoints and methods starting with
              `/v1/segments`.
            events: >-
              Gives access to all endpoints and methods starting with
              `/v1/events`.
            client_events: >-
              Gives access to all endpoints and methods starting with
              `client/v1/events`.
            rewards: >-
              Gives access to all endpoints and methods starting with
              `/v1/rewards`.
            assets: >-
              Gives access to all endpoints and methods starting with
              `/v1/assets`.
            task-results: >-
              Gives access to all endpoints and methods starting with
              `/v1/task-results`.
            loyalties: >-
              Gives access to all endpoints and methods starting with
              `/v1/loyalties`.
            client_consents: >-
              Gives access to all endpoints and methods starting with
              `client/v1/consents`.
            consents: >-
              Gives access to all endpoints and methods starting with
              `/v1/consents`.
            async-actions: >-
              Gives access to all endpoints and methods starting with
              `/v1/async-actions`.
            product-collections: >-
              Gives access to all endpoints and methods starting with
              `/v1/product-collections`.
            categories: >-
              Gives access to all endpoints and methods starting with
              `/v1/categories`.
            metadata-schemas: >-
              Gives access to all endpoints and methods starting with
              `/v1/metadata-schemas`.
            locations: >-
              Gives access to all endpoints and methods starting with
              `/v1/locations`.
            referrals: >-
              Gives access to all endpoints and methods starting with
              `/v1/referrals`.
            trash-bin: >-
              Gives access to all endpoints and methods starting with
              `/v1/trash-bin`.
            templates: >-
              Gives access to all endpoints and methods starting with
              `/v1/templates`.

````