Create Loyalty Promotion for UCC

Lets you create a promotion for UCC a specific loyalty program.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
❗️

This API is being phased out and will no longer be available for creating new loyalty promotions.

To create a new loyalty promotion, use the Create a Loyalty Promotion API


This API is used to create a loyalty promotion. A loyalty promotion rewards customers for achieving a target.

Prerequisites

  • Authentication: Basic/OAuth authentication
  • Default access group

Resource information

URIv1/programs\{programId\}/createPromotion\{promotionType\}
HTTP methodPOST
PaginationNA
Batch supportNA

API endpoint example

https://eu.api.capillarytech.com/api_gateway/loyalty/v1/programs/699/createPromotion/simple

Request path parameters

ParameterData TypeDescription
programIDIntegerUnique ID of the loyalty program.
promotionTypeStringType of promotion. Supported values: SIMPLE, RANGE, KEYWORD.

Sample request body

{
    "promotion": {
        "id": -1,
        "name": "promotion_name",
        "programId": 2932,
        "startDate": "2024-08-09T12:00:00+01:00",
        "endDate": "2024-08-25T12:00:00+01:00",
        "allocatePointsOn": "BILL",
        "identifier": "promotion_identfier",
        "eventName": "TARGETCOMPLETED",
        "pointsOfferType": "LOYALTY",
        "promotionType": "BILL",
        "promotionSourceType": "USER_CREATED",
        "limits": {
            "pointsPerCustomer": -1,
            "numberOfTimesPerCustomer": -1,
            "totalPointsInPromotion": -1
        },
        "promotionRestrictions": {
            "loyaltyEarningType": "ISSUE_AND_EARN",
            "isStackable": false,
            "isExclusive": false,
            "isConsideredForRanking": false,
            "targetRuleIds": [
                123
            ],
            "targetGroupIds": [
                1234567
            ],
            "restrictions": {
                "redemptionRestrictions": [
                    {
                        "name": "MAX_ALLOWED_TIMES_PER_CUSTOMER",
                        "value": 3,
                        "type": "PERIOD_BASED",
                        "periodType": "MOVING_WINDOW",
                        "periodUnit": "WEEKLY"
                    },
                    {
                        "name": "MAX_ALLOWED_TIMES_PER_PROMOTION",
                        "value": 3,
                        "type": "NON_PERIOD_BASED"
                    }
                ],
                "issualRestrictions": [
                    {
                        "name": "MAX_NUMBER_OF_ISSUALS_PER_CUSTOMER",
                        "value": 3,
                        "type": "NON_PERIOD_BASED"
                    }
                ],
                "earnRestrictions": [
                    {
                        "name": "MAX_NUMBER_OF_EARNS_PER_CUSTOMER",
                        "value": 3
                    }
                ],
                "expiryRestrictions": [
                    {
                        "name": "ISSUAL_PROMOTION_EXPIRY_BASED_ON",
                        "type": "PROMOTION",
                        "value": 10
                    }
                ]
            }
        },
        "rulesetInfos": [
            {
                "id": -1,
                "contextID": 2932,
                "orgID": 51174,
                "contextType": "program",
                "endpointName": "POINTSENGINE_ENDPOINT",
                "name": "rulesetName_uniqueue1",
                "type": "USER_CREATED",
                "startDate": 1089532593324,
                "endDate": 33593126193324,
                "active": true,
                "rules": [
                    {
                        "id": -1,
                        "exp": "true",
                        "expJSON": "{ \"arity\": \"literal\", \"value\": \"true\", \"type\": \"boolean:primitive\" }",
                        "isActive": true,
                        "caseToActions": {
                            "true": [
                                {
                                    "id": -1,
                                    "actionName": "AWARD_TARGET_POINTS_ACTION",
                                    "mandatoryPropertiesValues": {
                                        "ProRateOnSourceValue": "EVENT_DEFAULT_VALUE",
                                        "DelayStrategy": "AS_DEFINED_IN_ALLOCATION_STRATEGY",
                                        "SourceValueRoundingStrategy": "ACTUAL",
                                        "ExpiryStrategy": "81042",
                                        "AwardStrategy": "82690",
                                        "PointsRoundingStrategy": "ACTUAL",
                                        "TargetGroupId": "1234567",
                                        "TargetRuleName": "TargetRuleName"
                                    }
                                }
                            ]
                        },
                        "filterInfo": [],
                        "description": "",
                        "expDataType": "",
                        "ruleSetId": -1,
                        "updatedViaNewUI": false
                    }
                ],
                "filterInfo": [
                    {
                        "id": -1,
                        "contextType": "RULESET",
                        "name": "LoyaltyType",
                        "description": "LoyaltyType",
                        "isInclude": true,
                        "propertyToValues": {
                            "loyaltyType": [
                                "loyalty"
                            ]
                        }
                    },
                    {
                        "id": -1,
                        "contextType": "RULESET",
                        "name": "EventSource",
                        "description": "EventSource",
                        "isInclude": true,
                        "propertyToValues": {
                            "eventSource": [
                                "INSTORE"
                            ]
                        }
                    }
                ],
                "cappingInfo": [],
                "isRulesetForGlobalPromotion": "false",
                "programIds": []
            }
        ]
    }
}

Request Parameters

Parameter (Parameters marked as * are required)Data TypeDescription
promotionObjectRoot object containing all promotion details.
  • id*
IntegerUnique ID of the promotion. Set this value to -1 while creating a new promotion.
  • name*
StringUnique name of the loyalty promotion. <br/>The character limit for the name is 255 characters.
  • programId*
IntegerUnique ID of the loyalty program to associate with the promotion. You can create multiple promotions under a single loyalty program.
  • startDate*
StringStart date of the promotion in ISO 8601 yyyy-mm-ddThh:mm:ss.s+z format.
  • endDate*
StringEnd date of the promotion in ISO 8601 yyyy-mm-ddThh:mm:ss.s+z format.
  • allocatePointsOn
EnumCategory for point allocation. Supported values: BILL, LINEITEM, CUSTOMER.
  • identifier*
StringUnique identifier for the promotion. This is an external identifier that can be used to identify the promotion. <br/>The character limit for the identifier is 255 characters.
  • eventName*
EnumName of the event to associate with the promotion. Supported values: TRANSACTIONADD, CUSTOMERUPDATE, CUSTOMERREGISTRATION, TARGETCOMPLETED.
  • pointsOfferType
EnumType of loyalty promotion. Supported values: LOYALTY and LOYALTY_EARNING. Refer to the documentation on loyalty promotions for more information.
  • promotionType
EnumType of promotion. Supported values: BILL, LINEITEM, CUSTOMER.
  • promotionSourceType
EnumSource from where the promotion is created. Supported values: PROMOTION_API, CAMPAIGN, BADGES, USER_CREATED. <br/><br/>Pass the value as USER_CREATED for creating a UCC promotion.
  • limits
ObjectPromotion limits configuration.
-- pointsPerCustomerIntegerMaximum points that can be issued per customer (set to -1 for no limit).
-- numberOfTimesPerCustomerIntegerMaximum number of times points can be issued to a customer (set to -1 for no limit).
-- totalPointsInPromotionIntegerTotal points that can be generated during the promotion (set to -1 for no limit).
  • promotionRestrictions
IntegerRestriction settings for the promotion.
-- loyaltyEarningTypeEnumType of earning. Supported values: ISSUE_AND_EARN and DIRECT_EARN. <br/>Refer to the documentation on loyalty promotions for more information.
-- isStackableBooleanIndicate if the promotion is stackable. A stackable promotion refers to the application of multiple promotions within a single transaction. <br/><br/>Refer to the documentation on promotion stacking strategies for more information.
-- isExclusiveBooleanIndicate if the promotion is exclusive. Exclusive promotions are evaluated individually and do not stack with any other promotion. <br/>For creating a UCC promotion, set this value to false. <br/><br/>Refer to the documentation on promotion stacking strategies for more information.
-- isConsideredForRankingBooleanIndicate if the promotion is considered for ranking. Rankings allow you to order promotions based on their priority. <br/>For creating a UCC promotion, set this value to false. <br/><br/>Refer to the documentation on promotion ranking for more information.
-- targetRuleIds*ArrayList of target rule IDs.
-- targetGroupIds*ArrayList of target group IDs.
-- restrictionsObjectContains details on various restrictions for redemption, issual, and earning.
--- redemptionRestrictionsObjectContains information on the redemption limits for a promotion.
---- nameEnumType of redemption restriction. Supported values: <br/>MAX_ALLOWED_POINTS_PER_EVENT: The maximum points that can be earned in a single event for a customer. <br/>MAX_ALLOWED_TIMES_PER_CUSTOMER: The maximum number of times a promotion can be issued to a customer. <br/>MAX_ALLOWED_POINTS_PER_CUSTOMER: The maximum points a customer can earn across the promotion. <br/>MAX_ALLOWED_TIMES_PER_PROMOTION: The maximum number of times a promotion can be issued. <br/>MAX_ALLOWED_POINTS_PER_PROMOTION: The maximum points that can be awarded across the promotion. <br/>MAX_REDEMPTIONS_PER_EARN_PER_CUSTOMER: The maximum number of times a customer can redeem a promotion after earning.
---- valueIntegerNumber of units corresponding to the name. Specify the value as -1 for no limit. The maximum limit supported by the system is 100.
---- typeEnumType of period for restriction. Supported values: <br/>PERIOD_BASED: Restriction is applied for a defined period of time. <br/>NON_PERIOD_BASED: Restriction is applied for the entire duration of the promotion.
---- periodTypeEnumType of period for the restriction. Supported value: MOVING_WINDOW.
---- periodUnitEnumFrequency of the period. Supported values: DAILY, WEEKLY, MONTHLY.
--- issualRestrictionsObjectContains information on the issual limits for a promotion.
---- nameEnumType of issual restriction. Supported values: <br/>MAX_NUMBER_OF_ISSUALS_PER_CUSTOMER: Maximum number of times a promotion can be issued to a customer.
---- valueIntegerNumber of units corresponding to the name. Specify the value as -1 for no limit. The maximum limit supported by the system is 100.
---- typeEnumType of period for restriction. Supported values: <br/>PERIOD_BASED: Restriction is applied for a defined period of time. <br/>NON_PERIOD_BASED: Restriction is applied for the entire duration of the promotion.
--- earnRestrictionsObjectContains information on the earn limits for a promotion. This is specific for enrol and issue type promotion.
---- nameEnumType of earn restriction. Supported values: <br/>MAX_NUMBER_OF_EARNS_PER_CUSTOMER <br/>MAX_POINTS_PER_EARN_PER_CUSTOMER
---- valueIntegerNumber of units corresponding to the name. Specify the value as -1 for no limit. The maximum limit supported by the system is 100.
--- expiryRestrictionsObjectContains information on the expiry for a promotion. This is mandatory for both enrol and issue and direct issue types of promotion.
---- name*EnumAction that is expiring. Supported values: <br/>ISSUAL_PROMOTION_EXPIRY_BASED_ON: Expiration of the promotion issue. <br/>EARN_PROMOTION_EXPIRY_BASED_ON: Expiration of the promotion earn.
---- value*IntegerNumber of days the loyalty promotion expires from the date of issual.
---- type*EnumType of expiration. Supported values: <br/>PROMOTION: The loyalty promotion expires on the date defined in endDate. <br/>CUSTOM: Define the number of days when the loyalty promotion expires from the date of issual.
  • rulesetInfos*
ObjectInformation about the ruleset associated with the promotion.
-- idIntegerUnique ID of the ruleset. Set to -1 for creating a new UCC promotion.
-- contextID*IntegerUnique ID of the program.
-- orgID*IntegerUnique ID of the organization.
-- contextType*StringType of context.
-- endpointName*StringName of the endpoint.
-- name*StringUnique name for the ruleset.
-- type*EnumType of ruleset. <br/>For creating a UCC promotion, set this value to USER_CREATED.
-- startDate*IntegerStart date of the ruleset in Epoch time format.
-- endDate*IntegerEnd date of the ruleset in Epoch time format.
-- active*BooleanStatus of the ruleset (set to true).
-- rules*ArrayList of rules applied to the promotion.
--- idIntegerUnique ID of the rule (set to -1 for creating a new rule).
--- exp*BooleanRule expression to determine if the rule is true or false.
--- expJSON*StringRule expression in JSON format.
--- isActive*BooleanStatus of the rule.
--- caseToActions*ObjectDefines actions to take when the rule is satisfied.
---- actionName*StringName of the action.
---- mandatoryPropertiesValues*ObjectDefines the mandatory properties for the action (e.g., ProRateOnSourceValue, AwardStrategy).
-- filterInfoObjectInformation on the scope filters applied to the ruleset.
--- nameStringName of the filter, e.g., LoyaltyType.
--- propertyToValuesObjectKey-value pairs for filter properties, e.g., loyaltyType: [ "loyalty" ].
-- cappingInfoObjectOptional capping information for the ruleset.
-- isRulesetForGlobalPromotionBooleanIndicates if the ruleset is for a global promotion.

Sample response

{
    "status": {
        "code": 200,
        "message": "success"
    },
    "validationErrors": null,
    "data": [
        {
            "id": 200654,
            "name": "test_promo_uniqueName10",
            "promotionStatus": "COMPLETED",
            "programId": 2822,
            "startDate": "2024-08-09T00:00:00.284Z",
            "endDate": "2024-08-10T23:59:59.285Z",
            "identifier": "test_promo_uniqueIdentifier10",
            "isActive": true,
            "eventName": "TARGETCOMPLETED",
            "allocatePointsOn": "BILL",
            "limits": {
                "pointsPerCustomer": -1,
                "numberOfTimesPerCustomer": -1,
                "totalPointsInPromotion": -1,
                "totalPointsPerEventLimit": -1
            },
            "pointsOfferType": "LOYALTY",
            "promotionRestrictions": {
                "restrictions": {
                    "redemptionRestrictions": [
                        {
                            "name": "MAX_ALLOWED_TIMES_PER_CUSTOMER",
                            "value": 3,
                            "type": "PERIOD_BASED",
                            "periodType": "MOVING_WINDOW",
                            "periodUnit": "WEEKLY"
                        },
                        {
                            "name": "MAX_ALLOWED_TIMES_PER_PROMOTION",
                            "value": 3,
                            "type": "NON_PERIOD_BASED",
                            "periodType": null,
                            "periodUnit": null
                        },
                        {
                            "name": "MAX_REDEMPTIONS_PER_EARN_PER_CUSTOMER",
                            "value": 100,
                            "type": "NON_PERIOD_BASED",
                            "periodType": null,
                            "periodUnit": null
                        }
                    ],
                    "issualRestrictions": [
                        {
                            "name": "MAX_NUMBER_OF_ISSUALS_PER_CUSTOMER",
                            "value": 3
                        }
                    ],
                    "earnRestrictions": [
                        {
                            "name": "MAX_NUMBER_OF_EARNS_PER_CUSTOMER",
                            "value": 3
                        }
                    ],
                    "expiryRestrictions": [
                        {
                            "name": "ISSUAL_PROMOTION_EXPIRY_BASED_ON",
                            "value": 10,
                            "type": "PROMOTION"
                        }
                    ]
                },
                "scope": null,
                "isStackable": false,
                "isConsideredForRanking": true,
                "loyaltyEarningType": "ISSUE_AND_EARN",
                "expiryReminder": null,
                "isExclusive": false,
                "isAlwaysApply": false,
                "targetGroupIds": [
                    1234567
                ],
                "targetRuleIds": [
                    123
                ]
            }
        }
    ]
}

Response parameters

ParameterData typeDescription
statusObjectContains the response status.
-codeIntegerStatus code of the response (e.g., 200 for success).
-messageStringStatus message (e.g., "success").
validationErrorsObjectContains validation errors, if any. Null indicates no errors.
dataArrayContains data related to the promotion.
  • id
IntegerUnique identifier for the promotion.
  • name
StringName of the promotion.
-promotionStatusStringCurrent status of the promotion (e.g., “LIVE”, "COMPLETED").
  • programId
IntegerID of the associated loyalty program.
  • startDate
StringStart date of the promotion in ISO 8601 format.
  • endDate
StringEnd date of the promotion in ISO 8601 format.
  • identifier
StringUnique identifier for the promotion.
-isActiveBooleanIndicates if the promotion is active.
  • eventName
StringEvent that triggers the promotion. An event refers to a specific action for example a store visit or transaction.
  • allocatePointsOn
StringWhere points are allocated (e.g., "BILL").
  • limits
ObjectPromotion limits.
-- pointsPerCustomerIntegerMaximum points a customer can earn.
(-1 indicates no limit).
-- numberOfTimesPerCustomerIntegerNumber of times a customer can participate.
(-1 indicates no limit).
-- totalPointsInPromotionIntegerTotal points available in the promotion.
(-1 indicates no limit).
-- totalPointsPerEventLimitIntegerTotal points limit per event.
(-1 indicates no limit).
  • pointsOfferType
StringType of points offered (e.g., "LOYALTY"). A points offer refers to loyalty points issued to customers
promotionRestrictionsObjectContains the restrictions applicable to the promotion. Restrictions can be configured while setting up the loyalty promotion.
  • restrictions
ObjectContains various restriction types.
-- redemptionRestrictionsArrayRedemption-related restrictions. These are advanced settings for redemption.
--- nameStringName of the redemption restriction
--- valueIntegerMaximum allowed times per customer.
--- typeStringRestriction type (e.g., "PERIOD_BASED").
--- periodTypeStringPeriod type for restriction (e.g., "MOVING_WINDOW", FIXED_WINDOW).
--- periodUnitArrayPeriod unit for restriction (e.g., "WEEKLY", “MONTHLY”).
-- issualRestrictionsArrayIssual related restrictions. An “issual” refers to the issuance of a specific promotion to customers based on their behavioral events or transactions.
--- nameArrayName of the issuance restriction
--- valueIntegerMaximum issuances per customer.
-- earnRestrictionsArrayEarnrelated restrictions. “Earn" refers to the process where a customer completes the necessary activities to qualify for a promotion.
--- nameStringName of the earning restriction
--- valueIntegerMaximum earnings per customer.
-- expiryRestrictionsArrayExpiry-related restrictions.
--- nameStringName of the expiry restriction
--- valueIntegerExpiry value.
--- typeStringExpiry type (e.g., "PROMOTION").
  • scope
ObjectScope of the promotion (if applicable).
  • isStackable
BooleanIndicates if the promotion can be combined with other promotions.
  • isConsideredForRanking
BooleanIndicates if the promotion is considered for ranking.
  • loyaltyEarningType
StringType of loyalty earning.
  • expiryReminder
ObjectExpiry reminder, if any. Null indicates no reminder.
  • isExclusive
BooleanIndicates if the promotion is exclusive.
  • isAlwaysApply
BooleanIndicates if the promotion always applies.
  • targetGroupIds
IntegerList of target group IDs.
  • targetRuleIds
IntegerList of target rule IDs.

API error codes

CodeDescriptionSolution
4007Promotion identifier already exists for the programCheck the promotion id and ensure it is unique.
4003A promotion with the same name exists for the programCheck the promotion name and ensure it is unique.
4011Given start date is null or emptyCheck the promotion start date and ensure it is in the correct format
4012Given end date is null or emptyCheck the promotion end date and ensure it is in the correct format
4074For SourceType UserCreated, TargetGroupId and TargetRuleId are mandatoryEnter the TargetGroupID and TargetRuleID for the promotion
4079Promotion Source Type cannot be null or emptyEnter the promotion source type
4075UCC Promotions should always have one RuleSetEnsure that only one ruleset is passed. Add the rulesets for the promotion if not added.
4076Invalid UCC Promotions Ruleset check for ruleSetName, ContextId, OrgId, ContextType and start & End is not nullCheck if the mandatory rule set fields are passed.
4076Invalid UCC Promotions Rules passed check for expression , expressionJson and name is not nullCheck if the mandatory rule set fields are correct.
4080Invalid UCC Promotions Actions, Both key and value in cannot be null or emptyCheck if the mandatoryPropertiesValues key value is null or Empty.
4078Invalid name in Promotions RuleSet FilterCheck the filter name and ensure it is valid.
Path Params
int64
required

Unique ID of the loyalty program associated with the promotion.

string
required

Type of promotion. Supported values SIMPLE, RANGE, KEYWORD

Body Params
int32

The ID of the ruleset. Set the value to -1. This indicates that a new promotion request is being created.

string
required

Unique name for the ruleset

int32
required

Unique ID of the loyalty program to associate with the promotion. You can create multiple promotions under a single loyalty program.

date
required

Validity of the promotion. Pass the date range in startDate and endDate (ISO standard - yyyy-mm-ddThh:mm:ss.s+z).

date
required

Validity of the promotion. Pass the ISO date range in startDate and endDate (ISO standard - yyyy-mm-ddThh:mm:ss.s+z).

string

Enter event action name that generates promotional points. For example, Bill

string
required

Unique identifier of the promotion

string
enum
required

Name of the event to associate with the promotion. For example, TRANSACTIONADD, CUSTOMERUPDATE, OfferScan, spinTheWheel, and more

Allowed:
qualifyingConditions
array of strings

Array of different conditions like KPI, parameters, and more.

qualifyingConditions
string

Name of the condition that is passed in qualifyingConditions.

allocationRule
array of strings

Set the condition to generate the promotional points.

allocationRule
int32
required

Unique ID of the promotion. Refer to the documentation on promotion IDs for more information.

int32
required

Unique ID of the organization

string
required

The type of context. Set to program.

string
required

Set to POINTSENGINE_ENDPOINT

string
required

Type of ruleset.

string
required

Format in Epoch time (ex. 1726207950)

boolean
required

Status of the promotion. Set to true when creating a promotion for the first time

rules
array of strings
required

The rules defined for the promotion

rules*
int32

The unique identifier for the rule.

boolean
required

Enable rule expression. Rule expressions are conditions that determine whether a statement is true or false. Refer to rule writing for more information.

string
required

The rule expression in JSON format.

boolean
required

Indicates whether the rule is active. Set to true when creating a promotion for the first time

int32

The priority of the rule.

int32

The start date of the rule. ISO 8601 Date Format

int32

The end date of the rule. ISO 8601 Date Format

int32

The timestamp when the rule was created. ISO 8601 Date Format

string
required

Name of the action

string
required

As a set of key pair values eg: "key": "ProRateOnSourceValue", "value": "EVENT_DEFAULT_VALUE"

Response

Language
Credentials
Basic
base64
:
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json