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

# Create Promotion

> Create a promotion with rules, tiers, and discount templates.



## OpenAPI

````yaml post /billing/promotions
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /billing/promotions:
    post:
      tags:
        - Promotions
      summary: Create Promotion
      description: Create a promotion with rules, tiers, and discount templates.
      operationId: create_promotion_billing_promotions_post
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromotionCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromotionDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PromotionCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        startDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Startdate
        endDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Enddate
        rrule:
          anyOf:
            - type: string
            - type: 'null'
          title: Rrule
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
        maxRedemptions:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Maxredemptions
        maxPerPatient:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Maxperpatient
        autoApply:
          type: boolean
          title: Autoapply
          default: true
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        creditAmount:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Creditamount
        creditExpiryDays:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Creditexpirydays
        loyaltyPointsBonus:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Loyaltypointsbonus
        loyaltyPointsExpiryDays:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Loyaltypointsexpirydays
        providerIds:
          items:
            type: string
          type: array
          title: Providerids
        teamIds:
          items:
            type: string
          type: array
          title: Teamids
        rules:
          items:
            $ref: '#/components/schemas/PromotionRuleCreate'
          type: array
          title: Rules
        discountTemplates:
          items:
            $ref: '#/components/schemas/PromotionDiscountTemplateCreate'
          type: array
          title: Discounttemplates
      type: object
      required:
        - name
      title: PromotionCreate
    PromotionDetail:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        isActive:
          type: boolean
          title: Isactive
        startDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Startdate
        endDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Enddate
        rrule:
          anyOf:
            - type: string
            - type: 'null'
          title: Rrule
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
        maxRedemptions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Maxredemptions
        maxPerPatient:
          anyOf:
            - type: integer
            - type: 'null'
          title: Maxperpatient
        redemptionsCount:
          type: integer
          title: Redemptionscount
          default: 0
        autoApply:
          type: boolean
          title: Autoapply
          default: true
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        creditAmount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Creditamount
        creditExpiryDays:
          anyOf:
            - type: integer
            - type: 'null'
          title: Creditexpirydays
        loyaltyPointsBonus:
          anyOf:
            - type: integer
            - type: 'null'
          title: Loyaltypointsbonus
        loyaltyPointsExpiryDays:
          anyOf:
            - type: integer
            - type: 'null'
          title: Loyaltypointsexpirydays
        providerIds:
          items:
            type: string
          type: array
          title: Providerids
        teamIds:
          items:
            type: string
          type: array
          title: Teamids
        createdDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Createddate
        updatedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updateddate
        rules:
          items:
            $ref: '#/components/schemas/PromotionRuleSummary'
          type: array
          title: Rules
        discountTemplates:
          items:
            $ref: '#/components/schemas/PromotionDiscountTemplateSummary'
          type: array
          title: Discounttemplates
      type: object
      required:
        - id
        - name
        - isActive
      title: PromotionDetail
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PromotionRuleCreate:
      properties:
        ruleType:
          $ref: '#/components/schemas/PromotionRuleType'
        operator:
          $ref: '#/components/schemas/PromotionRuleOperator'
          default: IS
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        itemType:
          anyOf:
            - $ref: '#/components/schemas/ItemType'
            - type: 'null'
        minQuantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Minquantity
        minSubtotalCents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Minsubtotalcents
        cohortId:
          anyOf:
            - type: string
            - type: 'null'
          title: Cohortid
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
        group:
          type: integer
          title: Group
          default: 0
      type: object
      required:
        - ruleType
      title: PromotionRuleCreate
    PromotionDiscountTemplateCreate:
      properties:
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        itemType:
          anyOf:
            - $ref: '#/components/schemas/ItemType'
            - type: 'null'
        type:
          $ref: '#/components/schemas/DiscountType'
          default: PROMOTION
        percentage:
          anyOf:
            - type: number
              maximum: 100
              minimum: 0
            - type: 'null'
          title: Percentage
        amount:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Amount
        quantity:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Quantity
        expiryTimeDays:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Expirytimedays
        isStackable:
          type: boolean
          title: Isstackable
          default: false
        isPrepayment:
          type: boolean
          title: Isprepayment
          default: false
      type: object
      title: PromotionDiscountTemplateCreate
      description: Inline discount template definition for creating promotions.
    PromotionRuleSummary:
      properties:
        ruleType:
          $ref: '#/components/schemas/PromotionRuleType'
        operator:
          $ref: '#/components/schemas/PromotionRuleOperator'
          default: IS
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        itemType:
          anyOf:
            - $ref: '#/components/schemas/ItemType'
            - type: 'null'
        minQuantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Minquantity
        minSubtotalCents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Minsubtotalcents
        cohortId:
          anyOf:
            - type: string
            - type: 'null'
          title: Cohortid
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
        group:
          type: integer
          title: Group
          default: 0
        id:
          type: string
          title: Id
        itemName:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemname
        cohortName:
          anyOf:
            - type: string
            - type: 'null'
          title: Cohortname
        locationName:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationname
      type: object
      required:
        - ruleType
        - id
      title: PromotionRuleSummary
    PromotionDiscountTemplateSummary:
      properties:
        id:
          type: string
          title: Id
        itemId:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemid
        itemName:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemname
        category:
          anyOf:
            - type: string
            - type: 'null'
          title: Category
        itemType:
          anyOf:
            - type: string
            - type: 'null'
          title: Itemtype
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
        percentage:
          anyOf:
            - type: number
            - type: 'null'
          title: Percentage
        amount:
          anyOf:
            - type: integer
            - type: 'null'
          title: Amount
        quantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quantity
        isStackable:
          type: boolean
          title: Isstackable
          default: false
      type: object
      required:
        - id
      title: PromotionDiscountTemplateSummary
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PromotionRuleType:
      type: string
      enum:
        - ITEM_REQUIRED
        - CATEGORY_REQUIRED
        - ITEM_TYPE_REQUIRED
        - MIN_QUANTITY
        - MIN_SUBTOTAL
        - COHORT_MATCH
        - LOCATION_MATCH
      title: PromotionRuleType
    PromotionRuleOperator:
      type: string
      enum:
        - IS
        - IS_NOT
      title: PromotionRuleOperator
      description: |-
        How a rule's match condition is evaluated.

        IS: the rule passes when the cart/patient matches the target (default).
        IS_NOT: the rule passes when the cart/patient does NOT match the target.
    ItemType:
      type: string
      enum:
        - ITEM
        - SERVICE
        - PRODUCT
        - PACKAGE
        - MEMBERSHIP
        - MEDICATION
        - SERVICE_FEE
        - GIFT_CARD
      title: ItemType
    DiscountType:
      type: string
      enum:
        - GLOBAL
        - CUSTOM
        - MEMBERSHIP
        - PACKAGE
        - SAVED_ITEM
        - PROMOTION
      title: DiscountType

````