Skip to content

Creating Promotions

Promotions let you create targeted offers to drive customer engagement.

  1. Define the promotion

    Terminal window
    curl -X POST https://api.storelayer.io/v1/promotions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
    "name": "10% Off First Purchase",
    "type": "discount",
    "discountType": "percentage",
    "discountValue": 10,
    "conditions": {
    "newCustomersOnly": true
    }
    }'
  2. Add a coupon code (optional)

    Terminal window
    curl -X POST https://api.storelayer.io/v1/promotions/{id}/coupons \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
    "code": "WELCOME10",
    "maxUsesPerCustomer": 1
    }'
  3. Validate at checkout

    Terminal window
    curl -X POST https://api.storelayer.io/v1/coupons/validate \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -d '{
    "code": "WELCOME10",
    "customerId": "cust_abc123"
    }'
{
"name": "VIP Summer Sale",
"type": "discount",
"discountType": "fixed",
"discountValue": 2000,
"conditions": {
"startDate": "2025-06-01",
"endDate": "2025-08-31",
"minSpend": 5000,
"customerMetadata": {
"tier": "gold"
}
},
"maxRedemptions": 500
}

Double or triple points for specific actions:

{
"name": "Weekend 3x Points",
"type": "points_multiplier",
"multiplier": 3,
"conditions": {
"dayOfWeek": ["saturday", "sunday"],
"minSpend": 1000
}
}