Create target groups

This API is used to create a target group. A target group is an entity under which individual targets can be created. The targets are defined under the target group.

A target group is essential for creating a target, even when defining a single target. The target group serves as a container in the backend system. When creating a target through the user interface, you may not explicitly create a target group; however, the system automatically assigns the target to a backend group.

You can also use the same API to define targets and periods under the target group.

👍

Note

For detailed information about our APIs and for hands-on testing, refer documentation in API overview and step-by-step guide on making your first API call in Make your first API call .

Prerequisites

  • Authentication: Basic/OAuth authentication
  • Default access group

Resource information

URIv3/targetGroups
HTTP methodPOST
PaginationNA
Rate limitNA
Batch supportNA

API endpoint example

https://eucrm.cc.capillarytech.com/v3/targetGroups

Request body

{
  "active": true,
  "description": "Opp",
  
  
  "name": "UCCtesttarget2",
  "preferredTillId": 75050875,
  "trackingType": "DEFAULT",
  "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
  "totalPeriods": 4,
  "frequencyType": "DAILY",
  "frequency": 0,
  "recurringCycles": 0,
  "userCreated": false,
  "periods": [
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-08T23:59:59.999Z",
      "periodStatus": "RUNNING",
      "refCode": "Cycle_1",
      "startDate": "2024-10-08T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-09T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_2",
      "startDate": "2024-10-09T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-10T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_3",
      "startDate": "2024-10-10T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-11T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_4",
      "startDate": "2024-10-11T00:00:00.000Z"
    }
  ],
  "targets": [
    {
      "active": true,
      "description": "",
      "expression": true,
      "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
      "filters": [],
      "name": "UCCtesttarget2",
      "targetEntity": "EVENT",
      "eventName": "spinTheWheel",
      
      "targetType": "EVENT_ATTRIBUTE",
      "extendedFieldInfo": {
        "name": "points",
        "aggregateFunction": "SUM"
      },
      "defaultValues": [
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        }
       
      ]
    }
  ]
}
{
  "active": true,
  "description": "Opp",
  
  
  "name": "UCCtesttarget2",
  "preferredTillId": 75050875,
  "trackingType": "DEFAULT",
  "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
  "totalPeriods": 4,
  "frequencyType": "DAILY",
  "frequency": 0,
  "recurringCycles": 0,
  "userCreated": true,
  "periods": [
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-08T23:59:59.999Z",
      "periodStatus": "RUNNING",
      "refCode": "Cycle_1",
      "startDate": "2024-10-08T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-09T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_2",
      "startDate": "2024-10-09T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-10T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_3",
      "startDate": "2024-10-10T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-11T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_4",
      "startDate": "2024-10-11T00:00:00.000Z"
    }
  ],
  "targets": [
    {
      "active": true,
      "description": "",
      "expression": true,
      "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
      "filters": [],
      "name": "UCCtesttarget2",
      "targetEntity": "EVENT",
      "eventName": "spinTheWheel",
      
      "targetType": "EVENT_ATTRIBUTE",
      "extendedFieldInfo": {
        "name": "points",
        "aggregateFunction": "SUM"
      },
      "defaultValues": [
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        }
       
      ]
    }
  ]
}

Request body parameters

Parameter NameData TypeDescription
activeBooleanIndicates if the tracking is active or not.
descriptionStringA brief description of the target group.
name*StringThe name identifier for the target group.
preferredTillIdNumberIdentifier for a preferred till.
trackingType*StringThe type of tracking the milestone is created for. Supported values:
DEFAULT: Track a single target
UNIFIED :Track multiple targets
STREAK: Track multiple targets as a streak.
CAPPING: Track the number of points a user has got over a period, so that capping can be applied.

Refer to the documentation on milestones, unified targets, streaksand capping for more information.
targetEvaluationType*StringThe evaluation strategy for the targets. Supported values:
FIXED_CALENDAR_WINDOW, CYCLIC_WINDOW, PERIOD_AGNOSTIC_WINDOW
totalPeriods*NumberThe total number of periods over which the tracking is evaluated.
frequencyType*EnumThe frequency of each cycle in which the user has to achieve the target value. Supported values: Montly, Quarterly, Half-yearly, Yearly, Weekly.
frequency*NumberThe frequency count, relevant to the frequencyType.
recurringCycles*NumberThe number of cycles for which the tracking recurs.
userCreatedBooleanIf set to true, a user-created target group is created. A user-created target is a promotion that rewards customers for achieving goals they set themselves.

By default the value is set to false and a regular target group is created.
aggregateWindow *ENUMContains information related to the aggregate window. An aggregate window is a defined time period during which you can track an extended field or behavioral event.
windowType *ENUMThe type of window period (MIN or MAX).
MIN: This function identifies the smallest value within a given time frame. For example, if you're tracking daily steps, the MIN would show you the least number of steps taken in that period.

MAX: This function finds the largest value within that same time frame. Continuing with the step count example, the MAX would reveal the highest number of steps taken during the period.
windowTimeUnit *ENUMThe timeframe for which the window will be active. Currently, DAY is supported.
windowValueStringThe time units for which the window will be active. Currently, 1 time unit is supported.
periodsObjectAn array of period objects, each containing details about the individual periods within the tracking.
activeBooleanIndicates if the period is active.
descriptionStringA brief description of the period.
endDateDate TimeThe end date and time of the period in ISO format. For example, 2024-10-09T18:29:59.999Z, 2024-10-09 etc.
periodStatusStringIndicates if the cycle of the Milestone is active/inactive.
refCodeStringA reference code for the period.
startDateDate TimeThe start date and time of the period in ISO format. For example, 2024-10-09T18:29:59.999Z, 2024-10-09 etc.
targetsObjectAn array of target objects, each outlining a target within the tracking.
activeBooleanIndicates if the target is active.
descriptionStringA brief description of the target.
expressionStringA string representing the condition to meet the target.
expressionJsonStringA JSON expression that specifies the conditions required to achieve the target.
filtersObjectAn array of filters applied to the target.
entityTypeEnumThe entity to which the specified expressions related to the target will be applied.
For example: The user has to make a purchase of shoes from ABC store. Here, purchase of shoes is the expression and the entity is ABC store.
Supported values: STORE, ZONE, CONCEPT.
entityIdsArray The IDs of the entities to which the filter applies.
nameStringThe name identifier for the target.
targetEntityEnumThe KPI on which the target is tracked.
For the transactional KPIs, the supported value for this are Transaction and Lineitem.
For the Behavioural or EMF events, the supported value is EVENT.
For the tracking based on rewards such as points, the supported value will be REWARDS.
eventNameStringThe behavioral name of the event that triggers the target.
targetTypeEnumTarget type on which the target is set.
Supported values:
QUANTITY, SALES, GROSS_SALES, REGULAR_POINTS, PROMOTIONAL_POINTS, ALL_POINTS
For information based on configuring target based on behavioural event (COUNT, VISIT, and SUM) and EMF event (COUNT and VISIT), refer to target based on behavioural event and target based on EMF event documentation.
defaultValuesObjectAn array of objects providing default values related to the target.
defaultValueIntegerA default value used in the target evaluation.

Response body

{
  "active": true,
  "description": "Opp",
  
  
  "name": "UCCtesttarget2",
  "preferredTillId": 75050875,
  "trackingType": "DEFAULT",
  "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
  "totalPeriods": 4,
  "frequencyType": "DAILY",
  "frequency": 0,
  "recurringCycles": 0,
  "userCreated": false,
  "periods": [
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-08T23:59:59.999Z",
      "periodStatus": "RUNNING",
      "refCode": "Cycle_1",
      "startDate": "2024-10-08T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-09T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_2",
      "startDate": "2024-10-09T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-10T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_3",
      "startDate": "2024-10-10T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2024-10-11T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_4",
      "startDate": "2024-10-11T00:00:00.000Z"
    }
  ],
  "targets": [
    {
      "active": true,
      "description": "",
      "expression": true,
      "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
      "filters": [],
      "name": "UCCtesttarget2",
      "targetEntity": "EVENT",
      "eventName": "spinTheWheel",
      
      "targetType": "EVENT_ATTRIBUTE",
      "extendedFieldInfo": {
        "name": "points",
        "aggregateFunction": "SUM"
      },
      "defaultValues": [
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        }
       
      ]
    }
  ]
}
{
    "data": {
        "id": 1901,
        "name": "UCCtesttarget2",
        "active": true,
        "preferredTillId": 75050875,
        "periods": [
            {
                "id": 5751,
                "attribution": {
                    "createdOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    }
                },
                "startDate": "2024-10-08",
                "endDate": "2024-10-08",
                "refCode": "Cycle_1",
                "periodStatus": "ENDED",
                "targetGroupId": 1901,
                "description": "",
                "active": true
            },
            {
                "id": 5752,
                "attribution": {
                    "createdOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    }
                },
                "startDate": "2024-10-09",
                "endDate": "2024-10-09",
                "refCode": "Cycle_2",
                "periodStatus": "RUNNING",
                "targetGroupId": 1901,
                "description": "",
                "active": true
            },
            {
                "id": 5753,
                "attribution": {
                    "createdOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    }
                },
                "startDate": "2024-10-10",
                "endDate": "2024-10-10",
                "refCode": "Cycle_3",
                "periodStatus": "NOT_STARTED",
                "targetGroupId": 1901,
                "description": "",
                "active": true
            },
            {
                "id": 5754,
                "attribution": {
                    "createdOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedOn": "2024-10-09T11:58:28.000+0000",
                    "lastUpdatedBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    }
                },
                "startDate": "2024-10-11",
                "endDate": "2024-10-11",
                "refCode": "Cycle_4",
                "periodStatus": "NOT_STARTED",
                "targetGroupId": 1901,
                "description": "",
                "active": true
            }
        ],
        "totalPeriods": 4,
        "description": "Opp",
        "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
        "recurringCycles": 0,
        "frequency": 0,
        "targetCycleStartDate": "2024-10-08T00:00:00.000Z",
        "targetCycleEndDate": "2024-10-11T23:59:59.000Z",
        "frequencyType": "DAILY",
        "trackingType": "DEFAULT",
        "targets": [
            {
                "id": 1293,
                "attribution": {
                    "createdOn": "2024-10-09T11:58:28.218+0000",
                    "lastUpdatedOn": "2024-10-09T11:58:28.218+0000",
                    "lastUpdatedBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75122513,
                        "code": "till.marketsuper",
                        "description": "",
                        "name": "till.marketsuper",
                        "type": "TILL"
                    }
                },
                "name": "UCCtesttarget2",
                "emfRuleSetId": 126337565,
                "targetType": "EVENT_ATTRIBUTE",
                "targetEntity": "EVENT",
                "eventName": "spinTheWheel",
                "targetGroupId": 1901,
                "description": "",
                "active": true,
                "expression": "true",
                "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
                "filters": [],
                "enrolmentMethod": "IMPORT",
                "defaultValues": [
                    {
                        "id": 7180,
                        "periodId": 5751,
                        "defaultValue": 1.000
                    },
                    {
                        "id": 7181,
                        "periodId": 5752,
                        "defaultValue": 1.000
                    },
                    {
                        "id": 7182,
                        "periodId": 5753,
                        "defaultValue": 1.000
                    },
                    {
                        "id": 7183,
                        "periodId": 5754,
                        "defaultValue": 1.000
                    }
                ],
                "targetPeriodDefaultValuesMap": {
                    "5751": {
                        "id": 7180,
                        "periodId": 5751,
                        "defaultValue": 1.000
                    },
                    "5752": {
                        "id": 7181,
                        "periodId": 5752,
                        "defaultValue": 1.000
                    },
                    "5753": {
                        "id": 7182,
                        "periodId": 5753,
                        "defaultValue": 1.000
                    },
                    "5754": {
                        "id": 7183,
                        "periodId": 5754,
                        "defaultValue": 1.000
                    }
                },
                "extendedFieldInfo": {
                    "name": "points",
                    "aggregateFunction": "SUM",
                    "aggregateWindow": null
                }
            }
        ],
        "leaderboardEnabled": false,
        "userCreated": true
    },
    "errors": null,
    "warnings": null
}

Response parameters

FieldData TypeDescription
activeBooleanIndicates if the tracking is active or not.
descriptionStringA brief description of the target group.
nameStringThe name identifier for the target group.
preferredTillIdNumberIdentifier for a preferred till.
trackingTypeEnumThe type of tracking the milestone is created for. Supported values: Default, Unified, Streak, Capping, Non-continuous streak.
targetEvaluationTypeEnumThe evaluation strategy for the targets. Supported values: FIXED_CALENDAR_WINDOW, CYCLIC_WINDOW, PERIOD_AGNOSTIC_WINDOW.
totalPeriodsNumberThe total number of periods over which the tracking is evaluated.
frequencyTypeEnumThe frequency of each cycle in which the user has to achieve the target value. Supported values: Monthly, Quarterly, Half-yearly, Yearly, Weekly, Daily, CUSTOM.
frequencyNumberThe frequency count, relevant to the frequencyType.
recurringCyclesNumberThe number of cycles for which the tracking recurs.
periodsObjectAn array of period objects, each containing details about the individual periods within the tracking.
-- activeBooleanIndicates if the period is active.
-- descriptionStringA brief description of the period.
-- endDateDate TimeThe end date and time of the period.
-- periodStatusEnumIndicates if the cycle of the Milestone is running or upcoming. Supported values: RUNNING, UPCOMING, NOT_STARTED.
-- refCodeStringA reference code for the period.
-- startDateDate TimeThe start date and time of the period.
targetsObjectAn array of target objects.
-- activeBooleanIndicates if the target is active.
-- descriptionStringA brief description of the target.
-- expressionStringA string representing the condition to meet the target (aka rule).
-- expressionJsonStringA JSON expression that specifies the conditions required to achieve the target.
-- filtersObjectDefines the entity to which the specified expressions related to the target will be applied.
--- entityTypeEnumThe entity type. Supported values: STORE, ZONE, CONCEPT.
--- entityIdsArrayThe IDs of the entities to which the filter is applied.
-- enrolmentMethodEnumThe method of enrolment for the target. Supported values: TRANSACTION, IMPORT.
-- defaultValuesArrayProviding default values related to the target.
--- defaultValueFloatA default value used in the target evaluation.
--- idIntegerUnique identifier for the default value.
--- periodIdIntegerIdentifier for the associated period.
-- targetPeriodDefaultValuesMapObjectMap of default values by target period ID.
--- periodIdObjectDetails of the period ID.
---- idIntegerUnique identifier for the default value.
---- periodIdIntegerIdentifier for the associated period.
---- defaultValueFloatDefault value for the period.
-- extendedFieldInfoObjectIncludes the details of the event attribute that needs to be tracked.
--- nameStringEvent on which the sum calculation is performed.
--- aggregateFunctionEnumThe aggregate function checks whether the behavioral event is satisfied based on the sum. Supported values: SUM.
leaderboardEnabledBooleanIndicates if the leaderboard feature is enabled.
userCreatedBooleanIndicates if the target is a user created target.
errorsnull or ObjectContains error details if any occurred during the API request.
warningsnull or ObjectContains warning details if any occurred during the API request.

API error codes

CodeDescription
310069Target group name already exists
300004Invalid input, check all values and ensure they are correct.
Language
Authorization
Basic
base64
:
URL
Click Try It! to start a request and see the response here!