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

> Creates loyalty tiers for desired campaign.



## OpenAPI

````yaml /openapi/loyalties.json post /v1/loyalties/{campaignId}/tiers
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/{campaignId}/tiers:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterCampaignId'
        name: campaignId
        in: path
        required: true
        description: Unique loyalty campaign ID or name.
    post:
      tags:
        - Loyalties
      summary: Create loyalty tiers
      description: Creates loyalty tiers for desired campaign.
      operationId: create-in-bulk-loyalty-tiers
      parameters: []
      requestBody:
        description: Provide tier definitions you want to add to existing loyalty campaign.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoyaltiesTiersCreateInBulkRequestBody'
        required: true
      responses:
        '200':
          description: Returns created loyalty tiers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoyaltiesTiersCreateInBulkResponseBody'
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - loyalties
components:
  schemas:
    ParameterCampaignId:
      type: string
      example: camp_rRsfatlwN7unSeUIJDCYedal
    LoyaltiesTiersCreateInBulkRequestBody:
      title: Loyalties Tiers Create Request Body
      description: Request body schema for **POST** `v1/loyalties/{campaignId}/tiers`
      type: array
      items:
        title: Loyalties Tiers Create In Bulk Request Body Item
        allOf:
          - $ref: '#/components/schemas/LoyaltyTierBase'
          - type: object
            properties:
              metadata:
                description: >-
                  The metadata object stores all custom attributes assigned to
                  the loyalty tier. A set of key/value pairs that you can attach
                  to a loyalty tier object. It can be useful for storing
                  additional information about the loyalty tier in a structured
                  format.
                type: object
    LoyaltiesTiersCreateInBulkResponseBody:
      title: Loyalties Tiers Create Response Body
      type: array
      description: Response body schema for **POST** `v1/loyalties/{campaignId}/tiers`.
      items:
        $ref: '#/components/schemas/LoyaltyTier'
    LoyaltyTierBase:
      title: Loyalty Tier Base
      type: object
      properties:
        name:
          type: string
          description: Loyalty Tier name.
        earning_rules:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/MappingPoints'
          description: >-
            Contains a list of earning rule IDs and their points mapping for the
            given earning rule.
        rewards:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/MappingPoints'
          description: >-
            Contains a list of reward IDs and their points mapping for the given
            reward.
        points:
          type: object
          description: Defines range of loyalty tier in points.
          properties:
            from:
              type: integer
              description: Bottom points threshold value.
            to:
              type: integer
              description: Top points threshold value.
      required:
        - name
        - points
    LoyaltyTier:
      title: Loyalty Tier
      allOf:
        - $ref: '#/components/schemas/LoyaltyTierBase'
        - type: object
          properties:
            id:
              type: string
              description: Unique loyalty tier ID.
            campaign_id:
              type: string
              description: Unique parent campaign ID.
            metadata:
              type: object
              nullable: true
              description: >-
                The metadata object stores all custom attributes assigned to the
                loyalty tier. A set of key/value pairs that you can attach to a
                loyalty tier object. It can be useful for storing additional
                information about the loyalty tier in a structured format.
            created_at:
              type: string
              format: date-time
              description: >-
                Timestamp representing the date and time when the loyalty tier
                was created. The value is shown in the ISO 8601 format.
            updated_at:
              type: string
              nullable: true
              format: date-time
              description: >-
                Timestamp representing the date and time when the loyalty tier
                was updated. The value is shown in the ISO 8601 format.
            config:
              type: object
              description: Defines loyalty tier range in points.
              required:
                - points
              properties:
                points:
                  type: object
                  description: Defines range of loyalty tier in points.
                  properties:
                    from:
                      type: integer
                      description: Bottom points threshold value.
                    to:
                      type: integer
                      description: Top points threshold value.
            expiration:
              $ref: '#/components/schemas/LoyaltyTierExpiration'
            object:
              type: string
              default: loyalty_tier
              enum:
                - loyalty_tier
              description: >-
                The type of the object represented by JSON. This object stores
                information about the loyalty.
          required:
            - id
            - campaign_id
            - metadata
            - created_at
            - config
            - object
    MappingPoints:
      title: MappingPoints
      type: object
      oneOf:
        - $ref: '#/components/schemas/MappingMultiply'
        - $ref: '#/components/schemas/MappingFixed'
    LoyaltyTierExpiration:
      title: Loyalty Tier Expiration
      description: Defines loyalty tier expiration date.
      type: object
      properties:
        customer_id:
          type: string
          description: >-
            Unique customer identifier of the customer making the purchase. The
            ID is assigned by Voucherify.
          example: cust_7iUa6ICKyU6gH40dBU25kQU1
        campaign_id:
          type: string
          description: Unique campaign ID, assigned by Voucherify.
          example: camp_rRsfatlwN7unSeUIJDCYedal
        tier_id:
          type: string
          description: Unique tier ID, assigned by Voucherify.
        start_date:
          type: string
          description: >-
            Activation timestamp defines when the loyalty tier starts to be
            active in ISO 8601 format. Loyalty tier is inactive before this
            date.
        expiration_date:
          type: string
          description: >-
            Expiration timestamp defines when the loyalty tier expires in ISO
            8601 format. Loyalty tier is inactive after this date.
        created_at:
          type: string
          example: '2021-12-22T10:13:06.487Z'
          description: >-
            Timestamp representing the date and time when the loyalty tier was
            created. The value is shown in the ISO 8601 format.
          format: date-time
        updated_at:
          type: string
          example: '2021-12-22T10:13:06.487Z'
          description: >-
            Timestamp representing the date and time when the loyalty tier was
            updated. The value is shown in the ISO 8601 format.
          format: date-time
      required:
        - customer_id
        - campaign_id
        - tier_id
        - created_at
    MappingMultiply:
      title: MappingMultiply
      type: object
      properties:
        type:
          type: string
          default: MULTIPLY
          enum:
            - MULTIPLY
          description: Type of calculation.
        multiplier:
          type: number
          description: >-
            Multiplication factor used to multiply the points to obtain the
            mapped points.
    MappingFixed:
      title: MappingFixed
      type: object
      properties:
        type:
          type: string
          default: CUSTOM
          enum:
            - CUSTOM
          description: Type of calculation.
        points:
          type: integer
          description: Fixed number of points to be applied.
  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`.

````