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

# Validate Promotions

> Enables you to validate a cart's promotions - coupon codes and implicit promotions - for specified item IDs.



## OpenAPI

````yaml offers_v1 post /api-price/promo/validate
openapi: 3.0.0
info:
  description: >-
    fabric e-commerce Offers APIs allow you to to set up and manage stock
    keeping unit (SKU) prices. Its wide range of coupon and promotion features
    let you design deals ranging from single-use, customer-specific coupons to
    site-wide promotions.
  version: 1.0.0
  title: Offers v1
  contact:
    email: support@fabric.inc
  license:
    name: fabric API license
    url: https://fabric.inc/api-license
servers:
  - url: https://prod01-apigw.{customer_name}.fabric.zone
    description: Production
    variables:
      customer_name:
        default: yourcompany
        description: Customer name, provided by support team
security: []
tags:
  - name: Pricing
    description: Pricing APIs enable you to add price details for one or many items.
  - name: Promotions
    description: >-
      Promotion APIs enable you to apply and verify promotions and discount
      coupons.
  - name: Login API
    description: >-
      Login endpoint generates an authorization token for local users that they
      can use to log into fabric copilot application. <br /><br /> **Note:** A
      local user is someone who has an active account with fabric Inc
externalDocs:
  description: Learn more about Offers
  url: https://fabric.inc/knowledgebase/offers
paths:
  /api-price/promo/validate:
    post:
      tags:
        - Promotions
      summary: Validate Promotions
      description: >-
        Enables you to validate a cart's promotions - coupon codes and implicit
        promotions - for specified item IDs.
      operationId: validatePromo
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
      requestBody:
        description: >-
          A JSON object containing information to apply eligible promotions to
          cart items.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/validate-promo'
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cart-validation'
        '400':
          description: Client Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '406':
          description: Promo is Expired
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
components:
  parameters:
    xSiteContent:
      name: x-site-context
      in: header
      description: >-
        The `x-site-context` header is a JSON object that contains information
        about the source you wish to pull from. The mandatory `account` is the
        24 character identifier found in Copilot. The `channel` (Sales channel
        ID), `stage` (environment name), and `date` attributes can be used to
        further narrow the scope of your data source.
      required: true
      schema:
        type: string
        example: >-
          {"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account":
          "1234abcd5678efgh9ijklmno","stage":"production"}
  schemas:
    validate-promo:
      type: object
      required:
        - items
      properties:
        isLoggedIn:
          type: boolean
          description: '`True` indicates a logged in user and `False` indicates guest user.'
          example: false
        userId:
          type: string
          description: >-
            The 24 character system-generated ID of the logged-in user. This is
            auto-generated based on the Authorization Token (JWT token from the
            Login API) specified in the Headers.
          example: 5e2cfb9b45570b000864c4b5
        promoCodes:
          description: The coupon codes applied by the user.
          example:
            - 300DOFF
          type: array
          items:
            type: string
        items:
          description: The item details. At least one item must be specified.
          type: array
          items:
            $ref: '#/components/schemas/items'
    cart-validation:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: >-
            True indicates the cart validation is successful and false indicates
            otherwise.
          example: true
        items:
          description: The item details.
          type: array
          items:
            $ref: '#/components/schemas/items-response'
        appliedDiscounts:
          description: >-
            The basic details (such as promoId, promoTitle, and type) of all the
            discounts applied to the cart.
          type: array
          items:
            $ref: '#/components/schemas/applied-discounts'
        discounts:
          description: >-
            The additional attributes of the discounts applied to the cart such
            as discount ID, unit, and value of discount, along with the basic
            details.
          type: array
          items:
            $ref: '#/components/schemas/discounts'
    clientError:
      type: object
      properties:
        code:
          description: The error code, meant for machine consumption.
          type: string
          example: 400
        message:
          description: A human-readable description of the error that occurred.
          type: string
          example: SKU cannot be empty
    serverError:
      type: object
      properties:
        code:
          description: The error code, meant for machine consumption.
          type: string
          example: 500
        message:
          description: A human-readable description of the error that occurred.
          type: string
          example: >-
            An internal error occurred. If the issue persists please contact
            support@fabric.inc.
    items:
      type: object
      required:
        - itemId
        - group
        - quantity
        - price
      properties:
        lineItemId:
          type: number
          description: The number corresponding to the item in the cart.
          example: 1
        sku:
          type: string
          description: >-
            The Stock Keeping Unit (SKU) ID of the item to track in the
            inventory.
          example: SKU0001
        itemId:
          type: number
          description: The unique ID of the item.
          example: 1000000119
        group:
          description: The ID of the group to which the item belongs.
          example:
            - 5e2cfb9b45570b000863c4b5
          type: array
          items:
            type: string
        quantity:
          type: number
          description: The quantity of the item in the cart.
          example: 3
        price:
          $ref: '#/components/schemas/price'
          description: The price details of the item.
    items-response:
      type: object
      properties:
        lineItemId:
          type: number
          description: The number corresponding to the item in the cart.
          example: 1
        sku:
          type: string
          description: >-
            The Stock Keeping Unit (SKU) ID of the item to track in the
            inventory.
          example: SKU0001
        itemId:
          type: number
          description: The unique ID of the item.
          example: 1000000119
        group:
          description: The ID of the group to which the item belongs.
          example:
            - 5e2cfb9b45570b000863c4b5
          type: array
          items:
            type: string
        quantity:
          type: number
          description: The quantity of items.
          example: 3
        price:
          $ref: '#/components/schemas/price-details'
          description: The price details
        discount:
          description: The details of the discount applied.
          type: array
          items:
            $ref: '#/components/schemas/discount'
        discountQuantity:
          type: number
          description: The discount quantity.
          example: 3
        discountAmount:
          type: number
          description: The discount value.
          example: 5070
    applied-discounts:
      type: object
      properties:
        promoId:
          type: string
          description: The 24 character system-generated ID for a set of promotion codes.
          example: 5faaac2dd49ffe00071e4f8d
        promoTitle:
          type: string
          description: The name or label of the promo.
          example: 'inclsion promo 99 P off '
        type:
          type: string
          description: The type of promotion.
          example: PROMOTION-SKU
          enum:
            - PROMOTION-SKU
            - PROMOTION-SHIPPING
            - PROMOTION-CART
            - PROMOTION-QUANTITY
            - COUPON
    discounts:
      type: object
      properties:
        _id:
          type: string
          description: The 24-character system-generated ID of the discount.
          example: 5faaac2dd49ffe00071e4f8e
        unit:
          type: string
          description: >-
            The unit of discount. Represents whether the discount is in
            percentage or dollar value.
          example: '%OFF'
          enum:
            - '%OFF'
            - AMOUNT_OFF
        value:
          type: number
          description: The discount value.
          example: 99
        'ON':
          $ref: '#/components/schemas/ON'
          description: >-
            For internal use only. Represents the promotion type (SKU, CART, or
            QUANTITY) that was applied.
        id:
          type: string
          description: The 24 character system-generated discount ID.
          example: 5faaac2dd49ffe00071e4f8e
        type:
          type: string
          description: The type or kind of promotion.
          example: PROMOTION-SKU
          enum:
            - PROMOTION-SKU
            - PROMOTION-SHIPPING
            - PROMOTION-CART
            - PROMOTION-QUANTITY
            - COUPON
        promoId:
          type: string
          description: The system-generated ID for a set of promotion codes.
          example: 5faaac2dd49ffe00071e4f8d
        promoTitle:
          type: string
          description: The name or label of the promo.
          example: inclsion promo 99 P off.
    price:
      type: object
      properties:
        base:
          type: number
          description: The base price.
          example: 1000
        sale:
          type: number
          description: The sale price.
          example: 0
        currency:
          type: string
          description: The three character unit of currency.
          example: USD
    price-details:
      type: object
      properties:
        sale:
          type: number
          description: The sale price.
          example: 1000
        cost:
          type: string
          description: The cost of the item as provided by the merchant.
          example: 0
        currency:
          type: string
          description: The three character unit of currency.
          example: USD
        base:
          type: number
          description: The base price.
          example: 5000
        kind:
          type: string
          description: The price type currently active.
          example: Promotion
          enum:
            - Clearance
            - Promotion
        discount:
          type: number
          description: The discount value.
          example: 0
    discount:
      type: object
      properties:
        _id:
          type: string
          description: The system-generated ID (for internal use only).
          example: 5f9be340dde1cd0008f96035
        unit:
          type: string
          description: >-
            The unit of discount. Represents whether the discount is in
            percentage or dollar value.
          example: AMOUNT_OFF
          enum:
            - '%OFF'
            - AMOUNT_OFF
        value:
          type: number
          description: The discount value.
          example: 300
        'ON':
          $ref: '#/components/schemas/ON'
          description: >-
            For internal use only. Represents the promotion type (SKU, CART, or
            QUANTITY) that was applied.
        id:
          type: string
          description: The ID of the discount.
          example: 5f9be340dde1cd0008f96035
        promoId:
          type: string
          description: The 24 character system-generated ID for a set of promotion codes.
          example: 5f9be340dde1cd0008f96034
        promoCode:
          type: string
          description: The promo code (for customer use).
          example: 300DOFF
        promoTitle:
          type: string
          description: The title of the promotions.
          example: SKU 300 D off all skus
        type:
          type: string
          description: The type of promotions.
          example: COUPON
          enum:
            - PROMOTION-SKU
            - PROMOTION-SHIPPING
            - PROMOTION-CART
            - PROMOTION-QUANTITY
            - COUPON
    'ON':
      type: object
      properties:
        kind:
          type: string
          description: The kind or type to which the promotion is applied.
          example: SKU
          enum:
            - SKU
            - CATEGORY
            - ATTRIBUTE
        value:
          type: string
          description: The value of promotion.
          example: null

````