Offers User Guides
- Overview
- Pricing
- Promotions
- Coupons
- Settings
Offers API
- Offers (3.0.0)
- Developer Guide
- Real-time Pricing Engine
- Price Lists
- Prices
- Price Types
- Price Controls
- Price Methods
- Priced Products
- Add-ons
- Promotions
- Coupons
- Coupon Codes
- Redemptions
- Product Exclusion Lists
- Segments
- Imports
- Exports
- Attributes
Create coupon
Create a coupon with the requested conditions.
curl --request POST \
--url https://api.fabric.inc/v3/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '{
"name": "Christmas 2022 coupons",
"startAt": "2022-08-24T14:15:22.000Z",
"endAt": "2019-08-25T14:15:22.000Z",
"type": "PRODUCT",
"buyOperator": "OR",
"isExclusive": true,
"couponCodes": [
"XMAS2022"
],
"details": [
{
"discounts": [
{
"unit": "PERCENTAGE_OFF",
"amount": 15,
"type": "SKU",
"values": "null",
"maximumQuantity": 2,
"includeOperator": "OR",
"excludeOperator": "AND",
"discountId": "1",
"isAutoAdd": false,
"sets": [
"A"
]
}
],
"targetProducts": [
{
"type": "SKU",
"values": "*",
"operator": "IN",
"discountId": "1"
}
],
"conditions": [
{
"id": "6380e7ecb419a30009865fad",
"operator": "AND",
"includeOperator": "OR",
"excludeOperator": "AND",
"conditions": [
{
"type": "SKU",
"values": "*",
"operator": "IN"
}
],
"set": "A"
}
]
}
],
"limits": [
{
"type": "SITE_WIDE",
"quantity": 30
}
],
"termsAndConditions": [
{
"name": "Terms Applied",
"description": "Items can'\''t be exchanged"
}
],
"promotionMessages": [
{
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP",
"Cart"
],
"locales": [
"en-CA",
"fr-CA"
]
}
],
"proximityMessages": {
"threshold": 1,
"localizedMessages": [
{
"locales": [
"en-CA"
],
"message": "Buy some more to get the discount!"
}
]
},
"shipmentMethodIds": [
"1000001"
],
"eligiblePriceLists": [
10000056
],
"additionalAttributes": [
{
"name": "eventName",
"values": "Store sale"
}
],
"note": "Independence day sale!",
"level": 3,
"stackingType": "STACKABLE",
"isStackable": false,
"isAlwaysApplied": false,
"singleMultiUse": "MULTI_USE"
}'
{
"id": "6380e7ecb419a30009865fad",
"name": "Christmas 2022 coupons",
"status": "SCHEDULED",
"startAt": "2022-08-24T14:15:22.000Z",
"endAt": "2019-08-25T14:15:22.000Z",
"type": "PRODUCT",
"couponCodesCount": 100,
"createdAt": "2019-08-20T14:15:22.000Z",
"updatedAt": "2019-08-20T14:15:22.000Z",
"level": 3,
"stackingType": "STACKABLE",
"isStackable": false,
"isAlwaysApplied": false,
"singleMultiUse": "MULTI_USE",
"couponCodes": [
"SUMMER1000001"
],
"promotionMessages": [
{
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP",
"Cart"
],
"locales": [
"en-CA",
"fr-CA"
]
}
],
"additionalAttributes": [
{
"name": "type",
"values": "Birthday",
"attributeId": 100000
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Headers
A header used by fabric to identify the tenant making the request. You must include tenant id in the authentication header for an API request to access any of fabric’s endpoints. You can retrieve the tenant id , which is also called account id, from Copilot. This header is required.
24
x-fabric-channel-id identifies the sales channel where the API request is being made; primarily for multichannel use cases. The channel ids are 12 corresponding to US and 13 corresponding to Canada. The default channel id is 12. This field is required.
"12"
A unique request ID.
"263e731c-45c8-11ed-b878-0242ac120002"
Body
Coupon record detail
Response
Created
The coupon details.
Was this page helpful?
curl --request POST \
--url https://api.fabric.inc/v3/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '{
"name": "Christmas 2022 coupons",
"startAt": "2022-08-24T14:15:22.000Z",
"endAt": "2019-08-25T14:15:22.000Z",
"type": "PRODUCT",
"buyOperator": "OR",
"isExclusive": true,
"couponCodes": [
"XMAS2022"
],
"details": [
{
"discounts": [
{
"unit": "PERCENTAGE_OFF",
"amount": 15,
"type": "SKU",
"values": "null",
"maximumQuantity": 2,
"includeOperator": "OR",
"excludeOperator": "AND",
"discountId": "1",
"isAutoAdd": false,
"sets": [
"A"
]
}
],
"targetProducts": [
{
"type": "SKU",
"values": "*",
"operator": "IN",
"discountId": "1"
}
],
"conditions": [
{
"id": "6380e7ecb419a30009865fad",
"operator": "AND",
"includeOperator": "OR",
"excludeOperator": "AND",
"conditions": [
{
"type": "SKU",
"values": "*",
"operator": "IN"
}
],
"set": "A"
}
]
}
],
"limits": [
{
"type": "SITE_WIDE",
"quantity": 30
}
],
"termsAndConditions": [
{
"name": "Terms Applied",
"description": "Items can'\''t be exchanged"
}
],
"promotionMessages": [
{
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP",
"Cart"
],
"locales": [
"en-CA",
"fr-CA"
]
}
],
"proximityMessages": {
"threshold": 1,
"localizedMessages": [
{
"locales": [
"en-CA"
],
"message": "Buy some more to get the discount!"
}
]
},
"shipmentMethodIds": [
"1000001"
],
"eligiblePriceLists": [
10000056
],
"additionalAttributes": [
{
"name": "eventName",
"values": "Store sale"
}
],
"note": "Independence day sale!",
"level": 3,
"stackingType": "STACKABLE",
"isStackable": false,
"isAlwaysApplied": false,
"singleMultiUse": "MULTI_USE"
}'
{
"id": "6380e7ecb419a30009865fad",
"name": "Christmas 2022 coupons",
"status": "SCHEDULED",
"startAt": "2022-08-24T14:15:22.000Z",
"endAt": "2019-08-25T14:15:22.000Z",
"type": "PRODUCT",
"couponCodesCount": 100,
"createdAt": "2019-08-20T14:15:22.000Z",
"updatedAt": "2019-08-20T14:15:22.000Z",
"level": 3,
"stackingType": "STACKABLE",
"isStackable": false,
"isAlwaysApplied": false,
"singleMultiUse": "MULTI_USE",
"couponCodes": [
"SUMMER1000001"
],
"promotionMessages": [
{
"title": "Buy 2 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP",
"Cart"
],
"locales": [
"en-CA",
"fr-CA"
]
}
],
"additionalAttributes": [
{
"name": "type",
"values": "Birthday",
"attributeId": 100000
}
]
}