# Quantity discount insertion

Endpoint: POST /api/quantity-discounts
Version: 1.0.0
Security: shoptetAccessToken, shoptetPrivateApiToken

## Header parameters:

  - `Content-Type` (string, required)

## Request fields (application/json):

  - `data` (object, required)

  - `data.title` (string, required)
    Discount title.

  - `data.isActive` (boolean)
    Whether or not is the discount active. If not set, default value is true.

  - `data.validFrom` (string,null)
    Date of discount validity from.

  - `data.validTo` (string,null)
    Date of discount validity to.

  - `data.displayFlag` (boolean)
    Whether or not to display flag. If not set, default value is true.

  - `data.flagColor` (string,null)
    Color of the flag. If not set, default value is D00000.

  - `data.customerGroupCodes` (array,null)
    Customer groups connected to discount.

  - `data.includeUnregisteredCustomers` (boolean)
    Defines if discount is valid for unregistered customers, default value is false.

  - `data.targetingLevel` (string, required)
    Level of targeting.
    Enum: "eshop", "product", "category", "brand"

  - `data.targeting` (object,null)
    Links the discount to the specific target/s. At least one of the parameters needs to be specified.

  - `data.targeting.productGuids` (array,null)
    Array of product guids.

  - `data.targeting.categoryGuids` (array,null)
    Array of category guids.

  - `data.targeting.brandCodes` (array,null)
    Array of brand codes.

  - `data.settings` (array, required)
    Settings of the discount.

  - `data.settings.amountFrom` (integer, required)
    Amount/quantity of items from which the discount is applied.

  - `data.settings.discountType` (string, required)
    Type of the discount.

  - `data.settings.discountValue` (any, required)

  - `data.sortBefore` (integer)
    Id of discount before which you want to move the discount from the request. Not possible to use with sortAfter.

  - `data.sortAfter` (integer)
    Id of discount after which you want to move the discount from the request. Not possible to use with sortBefore.

## Response 201 fields (application/json):

  - `data` (object, required)

  - `data.discount` (object, required)

  - `data.discount.id` (integer, required)
    discount ID

  - `data.discount.title` (string, required)
    discount title

  - `data.discount.validFrom` (string,null, required)
    date of discount validity from

  - `data.discount.validTo` (string,null, required)
    date of discount validity to

  - `data.discount.timeUnlimited` (boolean, required)
    flag whether the discount is time unlimited

  - `data.discount.customerGroups` (array,null, required)
    customer groups connected to discount

  - `data.discount.customerGroups.code` (string, required)
    customer group code

  - `data.discount.customerGroups.name` (string, required)
    customer group name

  - `data.discount.displayFlag` (boolean, required)
    whether the flag is displayed

  - `data.discount.flagColor` (string,null, required)
    color of the flag

  - `data.discount.priority` (integer,null, required)
    priority of the discount

  - `data.discount.isActive` (boolean, required)
    flag whether the discount is active

  - `data.discount.status` (string, required)
    status of the discount
    Enum: "available", "unavailable", "expired", "planned"

  - `data.discount.targetingLevel` (string, required)
    targeting level of the discount
    Enum: "eshop", "product", "category", "brand"

  - `data.discount.targeting` (object,null, required)
    definition of products needed to get discount

  - `data.discount.targeting.productGuids` (array,null, required)
    array of product guids

  - `data.discount.targeting.categoryGuids` (array,null, required)
    array of page guids (categories)

  - `data.discount.targeting.brandCodes` (array,null, required)
    array of brand codes

  - `data.discount.includeUnregisteredCustomers` (boolean, required)
    defines if discount is valid for unregistered customers, default value is false

  - `data.discount.settings` (array,null, required)
    settings of the discount

  - `data.discount.settings.amountFrom` (integer, required)
    amount from of products needed to get discount

  - `data.discount.settings.discountType` (string, required)
    type of discount

  - `data.discount.settings.discountValue` (object, required)

  - `data.discount.settings.discountValue.priceRatio` (string, required)
    price ratio of the discount. Calculate as (100 - percentage) / 100

  - `errors` (array,null, required)

  - `errors.errorCode` (string, required)
    Short text error identification

  - `errors.message` (string, required)
    Descriptive error message

  - `errors.instance` (string, required)
    Identification of the entity referenced

  - `metadata` (object, required)

  - `metadata.requestId` (string, required)
    Request identifier. Useful for logging/reporting purposes.

## Response 404 fields (application/json):

  - `data` (object,null)

  - `errors` (array,null)

  - `errors.errorCode` (string, required)
    Short text error identification

  - `errors.message` (string, required)
    Descriptive error message

  - `errors.instance` (string, required)
    Identification of the entity referenced

  - `metadata` (object)

  - `metadata.requestId` (string, required)
    Request identifier. Useful for logging/reporting purposes.


