For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a discount

Create a discount for a store.

Create a discount

post

Create a discount for a store. Fixed discounts take an amount in the smallest currency unit (e.g. $10 is 1000); percentage discounts take a whole-number value between 1 and 100. Free-shipping discounts ignore value. Returns the created discount.

Authorizations
AuthorizationstringRequired

API Token authentication

Path parameters
store_idstringRequired

The ID of the store to create the discount for.

Example: store_01J8Z5F8W9K8M4A7B3C2D1E0FG
Body
codestring · min: 1 · max: 255Required

The discount code customers enter at checkout.

Example: BLACKFRIDAY
namestring · min: 1 · max: 255Optional

A human-friendly discount name.

Example: Black Friday
typestring · enumRequired

The discount type.

Example: percentagePossible values:
valueintegerRequired

For percentage discounts a whole number 1-100; for fixed discounts an amount in the smallest currency unit (e.g. $10 is 1000). Ignored for free_shipping.

Example: 20
allocationstring · enumOptional

Whether the discount applies to the cart total or to each eligible item.

Example: totalPossible values:
starts_atstring · date-timeOptional

When the discount becomes active. A bare date (2026-11-27) anchors to time_zone. Defaults to now when omitted.

Example: 2026-01-21T07:35:04.000000Z
ends_atstring · date-timeOptional

When the discount expires. A bare date runs to the end of that day in time_zone. Never expires when omitted.

Example: 2026-02-21T07:35:04.000000Z
usage_limitinteger · min: 1Optional

Maximum number of times the discount can be redeemed.

Example: 100
min_cart_valueinteger · min: 1Optional

Minimum cart value in the smallest currency unit required for the discount to apply.

Example: 5000
time_zonestringOptional

IANA time zone used to interpret starts_at and ends_at.

Example: Europe/Vilnius
Responses
201

Created response

application/json
post/api/ecommerce/v1/stores/{store_id}/discounts
POST /api/ecommerce/v1/stores/{store_id}/discounts HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 247

{
  "code": "BLACKFRIDAY",
  "name": "Black Friday",
  "type": "percentage",
  "value": 20,
  "allocation": "total",
  "starts_at": "2026-01-21T07:35:04.000000Z",
  "ends_at": "2026-02-21T07:35:04.000000Z",
  "usage_limit": 100,
  "min_cart_value": 5000,
  "time_zone": "Europe/Vilnius"
}
{
  "data": {
    "id": "disc_01J8Z5F8W9K8M4A7B3C2D1E0FG",
    "code": "BLACKFRIDAY",
    "name": "Black Friday",
    "type": "percentage",
    "value": 20,
    "allocation": "total",
    "is_disabled": false,
    "starts_at": "2026-01-21T07:35:04.000000Z",
    "ends_at": null,
    "usage_limit": null,
    "usage_count": 0
  }
}

Last updated

Was this helpful?