Tamio

Create a product discount

POST https://api.tamio.com/v2/discounts/product-discount/create

Creates a new product discount with configurable conditions, amounts, and targeting rules. Supports coupons, vouchers, automatic conditions, and quantity/subtotal thresholds.

Note: At least one of amount_off, percent_off, shipping_amount_off, or shipping_percent_off must be greater than zero.

Body Parameters

type string*
product_discount
label string*

Display name for the discount

condition string*

Condition required to activate the discount

all_ordersitem_subtotalitem_quantitycouponvouchers
applies_to string*

What products this discount applies to

selected_productsselected_categoriesall_products
currency string*

Currency code for amount-based discounts (e.g. EUR, USD)

amount_off integer*

Fixed amount discount on product price in smallest currency unit

percent_off number*

Percentage discount on product price (0-100)

shipping_percent_off number*

Percentage discount on shipping cost (0-100)

shipping_amount_off integer*

Fixed amount discount on shipping cost in smallest currency unit

active boolean

Whether the discount is currently active

coupon string

Coupon code (required when condition is "coupon")

coupon_max_redemptions integer

Maximum number of times this coupon can be redeemed (0 for unlimited)

block_affiliates boolean

Whether to block affiliate commissions when this discount is used

voucher_method string

Method for creating vouchers (required when condition is "vouchers")

autogeneratedlist
number_of_vouchers integer

Number of vouchers to auto-generate (required when voucher_method is "autogenerated")

voucher_prefix string

Prefix for auto-generated voucher codes

vouchers array of string

Voucher codes (required when voucher_method is "list")

rule_amount integer

Minimum amount for item/order conditions (required when condition is "item_subtotal" or "item_quantity")

order_condition string

Additional order-level condition

order_subtotalorder_shippingorder_quantity
expiry_date string

Date when the discount expires (null for no expiry)

subscription_discount_duration string

How long the discount applies to subscriptions

onceforeverrepeating
number_of_months integer

Number of months for repeating subscription discounts (required when subscription_discount_duration is "repeating")

duration integer

Duration in months for recurring discounts

products array of string

Product UUIDs (required when applies_to is "selected_products")

categories object

Product categories (required when applies_to is "selected_categories")

JSON
{ "categories": { "physical": [], "digital": [], "services": [], "billing_plans": [] } }
physical array of string
digital array of string
services array of string
billing_plans array of string
destinations array of string

Countries this discount applies to

payments array of string

Payment methods this discount applies to

Example
{
  "type": "product_discount",
  "label": "Summer Sale 10% Off",
  "condition": "coupon",
  "coupon": "SUMMER10",
  "coupon_max_redemptions": 100,
  "applies_to": "all_products",
  "currency": "EUR",
  "amount_off": 0,
  "percent_off": 10,
  "shipping_percent_off": 0,
  "shipping_amount_off": 0
}

Responses

200 Product discount created successfully

Product discount created successfully

status integer
discount Discount
400 Validation or business-logic error.
401 Unauthorized – invalid or missing Bearer token
/discounts/product-discount/create
1const response = await fetch("https://api.tamio.com/v2/discounts/product-discount/create", {
2 method: "POST",
3 headers: {
4 "Authorization": "Bearer YOUR_API_KEY",
5 "Content-Type": "application/json"
6 },
7 body: JSON.stringify({
8 "type": "product_discount",
9 "label": "Summer Sale 10% Off",
10 "condition": "coupon",
11 "coupon": "SUMMER10",
12 "coupon_max_redemptions": 100,
13 "applies_to": "all_products",
14 "currency": "EUR",
15 "amount_off": 0,
16 "percent_off": 10,
17 "shipping_percent_off": 0,
18 "shipping_amount_off": 0
19 })
20});
21const data = await response.json();
Responses
{
  "status": 200,
  "discount": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "object": "discount",
    "label": "Summer Sale 10% Off",
    "currency": "EUR",
    "percent_off": 10,
    "amount_off": 0,
    "shipping_percent_off": 0,
    "shipping_amount_off": 0,
    "active": true,
    "type": "product_discount",
    "condition": "coupon",
    "applies_to": "all_products",
    "rule_amount": 5000,
    "order_condition": "order_subtotal",
    "block_affiliates": false,
    "destinations": [
      "worldwide"
    ],
    "payments": [
      "all"
    ],
    "expiry_date": 1735689600,
    "subscription_discount_duration": "once",
    "number_of_months": 3,
    "domain": 12,
    "customer": "660e8400-e29b-41d4-a716-446655440001",
    "products": [
      "770e8400-e29b-41d4-a716-446655440002"
    ],
    "categories": {
      "physical": [
        "clothing",
        "accessories"
      ],
      "digital": [],
      "services": [],
      "billing_plans": []
    },
    "coupon": "SUMMER10",
    "coupon_max_redemptions": 100,
    "coupon_times_redeemed": 45,
    "vouchers": [],
    "voucher_method": "autogenerated",
    "voucher_prefix": "SALE_",
    "number_of_vouchers": 100,
    "created_at": 1700000000
  }
}