post https://{host}/v3/targetGroups
A streak refers to a consecutive series of actions or engagements by a customer, based on which loyalty benefits are provided.
You can create a streak using the Create target group API.
NoteFor 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 .
Example request
curl --location 'https://eu.api.capillarytech.com/v3/targetGroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic dGlsbE3NQ==' \
--header 'Cookie: _cfuvid=PZ2Qs9Lv6_ngy2fSsa2ZHebqE7qq7WrhJNpax_n8cXA-1759145375283-0.0.1.1-604800000; _cfuvid=CCFoTqaqTX8iFIzzOLUOiMlxUTMwr9RGpHz89bJUbxs-1759743580547-0.0.1.1-604800000' \
--data '{
"active": true,
"description": "Opp2",
"name": "Opp4",
"preferredTillId": 75050875,
"trackingType": "STREAKS",
"targetEvaluationType": "FIXED_CALENDAR_WINDOW",
"totalPeriods": 4,
"frequencyType": "DAILY",
"frequency": 0,
"recurringCycles": 0,
"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,
"targetMilestoneTriggers": [],
"description": "Opp3",
"expression": "true",
"expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
"filters": [],
"name": "Opp4",
"targetEntity": "EVENT",
"targetType": "EVENT_ATTRIBUTE",
"eventName": "spinTheWheel",
"extendedFieldInfo": {
"name": "points",
"aggregateFunction": "SUM"
},
"defaultValues": [
{
"defaultValue": 1
},
{
"defaultValue": 1
},
{
"defaultValue": 1
},
{
"defaultValue": 1
}
]
}
],
"streaks": [
{
"name": "Opp4_1",
"targetCountOfSequence": 2
},
{
"name": "Opp4_2",
"targetCountOfSequence": 4
}
]
}'Prerequisites
- Authentication: Basic/OAuth authentication
- Default access group
Resource information
| URI | v3/targetGroups |
| HTTP method | POST |
| Pagination | NA |
| Rate limit | NA |
| Batch support | NA |
Request body parameters
| Parameter Name | Data Type | Description |
|---|---|---|
| active | Boolean | Indicates if the tracking is active or not. |
| description | String | A brief description of the target group. |
| name* | String | The name identifier for the target group. The character limit for the name is 200 characters. |
| preferredTillId | Number | Identifier for a preferred till. |
| trackingType* | String | The type of tracking the milestone is created for. Supported values: - Default (single target tracking) - Unified (tracking multiple targets as a unit) - Streaks (continuous tracking across cycles) - Capping (track and cap points over a period). To create a streak, use STREAKS. |
| targetEvaluationType | String | The evaluation strategy for the targets. Supported values: - FIXED_CALENDAR_WINDOW: Runs for a defined period from the start date- CYCLIC_WINDOW: Starts after user's first transaction- PERIOD_AGNOSTIC_WINDOW: Continues until the user meets the target. |
| totalPeriods | Number | The total number of periods over which the tracking is evaluated. |
| frequencyType | Enum | The frequency of each cycle. Supported values: Monthly, Quarterly, Half-yearly, Yearly, Weekly. |
| userCreated | Boolean | If true, a user-created target group is created. This allows customers to set and be rewarded for their own goals. |
| frequency | Number | The frequency count, relevant to the frequencyType. |
| recurringCycles | Number | The number of cycles for which the tracking recurs. |
| periods | Object | An array of period objects containing details about individual tracking periods. |
| periods.active | Boolean | Indicates if the period is active. |
| periods.description | String | A brief description of the period. |
| periods.endDate | Date Time | The end date and time of the period. |
| periods.periodStatus | String | Indicates if the cycle of the milestone is active/inactive. |
| periods.refCode | String | A reference code for the period. |
| periods.startDate | Date Time | The start date and time of the period. |
| targets | Object | An array of target objects outlining each target in the tracking. |
| targets.active | Boolean | Indicates if the target is active. |
| targets.description | String | A brief description of the target. |
| targets.expression | String | A string representing the condition to meet the target. |
| targets.expressionJson | String | A JSON expression specifying the conditions required to achieve the target. |
| targets.filters | Object | Defines the entity to which the target expressions apply. |
| targets.filters.entityType | Enum | Entity to which expressions apply. Must satisfy the target condition. Supported values: STORE, ZONE, CONCEPT. |
| targets.filters.entityIds | Array | The IDs of the entities to which the filter is applied. |
| targets.name | String | The name identifier for the target. |
| targets.targetEntity | Enum | The KPI being tracked. Supported values: TRANSACTION, LINEITEM, EVENT, REWARDS. Use TRANSACTION or LINEITEM for transactional KPIs. Use EVENT for behavioural/EMF events. Use REWARDS for tracking reward-based KPIs like points. |
| targets.eventName | String | The name of the behavioural event that triggers the target. |
| targets.targetType* | Enum | Type of target. Supported values: QUANTITY, SALES, COUNT, VISIT, GROSS_SALES, REGULAR_POINTS, PROMOTIONAL_POINTS, ALL_POINTS, EXTENDED_FIELD, EVENT_ATTRIBUTE. To use SUM for behavioural events, set to EVENT_ATTRIBUTE and define it using extendedFieldInfo. |
| extendedFieldInfo | Object | Details of the event attribute being tracked. Applicable when targetType is SUM. |
| extendedFieldInfo.name* | String | Event on which the sum calculation is performed. E.g., number of 'add to cart' events. |
| extendedFieldInfo.aggregateFunction | Enum | Aggregate function used to evaluate behavioural events. Supported: SUM. E.g., use SUM to track total cart value and validate against target. |
| defaultValues | Object | An array of objects defining default values for the target. |
| defaultValues.defaultValue | Integer | A default value used during target evaluation. |
| streaks* | Object | An array containing streak information. Required when trackingType is STREAKS. |
| streaks.name* | String | Name of the streak. |
| streaks.targetCountOfSequence* | Integer | Number of times a user must meet the target to earn the reward. |
Example response
{
"data": {
"id": 15404,
"name": "Opp4",
"active": true,
"preferredTillId": 75050875,
"periods": [
{
"id": 115289,
"attribution": {
"createdOn": "2025-10-06T09:39:40.000+0000",
"lastUpdatedOn": "2025-10-06T09:39:40.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": 15404,
"description": "",
"active": true
},
{
"id": 115290,
"attribution": {
"createdOn": "2025-10-06T09:39:40.000+0000",
"lastUpdatedOn": "2025-10-06T09:39:40.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": "ENDED",
"targetGroupId": 15404,
"description": "",
"active": true
},
{
"id": 115291,
"attribution": {
"createdOn": "2025-10-06T09:39:40.000+0000",
"lastUpdatedOn": "2025-10-06T09:39:40.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": "ENDED",
"targetGroupId": 15404,
"description": "",
"active": true
},
{
"id": 115292,
"attribution": {
"createdOn": "2025-10-06T09:39:40.000+0000",
"lastUpdatedOn": "2025-10-06T09:39:40.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": "ENDED",
"targetGroupId": 15404,
"description": "",
"active": true
}
],
"streaks": [
{
"id": 17680,
"attribution": {
"createdOn": "2025-10-06T09:39:39.742+0000",
"lastUpdatedOn": "2025-10-06T09:39:39.742+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"
}
},
"targetGroupId": 15404,
"name": "Opp4_1",
"targetCountOfSequence": 2
},
{
"id": 17681,
"attribution": {
"createdOn": "2025-10-06T09:39:39.742+0000",
"lastUpdatedOn": "2025-10-06T09:39:39.742+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"
}
},
"targetGroupId": 15404,
"name": "Opp4_2",
"targetCountOfSequence": 4
}
],
"totalPeriods": 4,
"description": "Opp2",
"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": "STREAKS",
"targets": [
{
"id": 19772,
"attribution": {
"createdOn": "2025-10-06T09:39:39.984+0000",
"lastUpdatedOn": "2025-10-06T09:39:39.984+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": "Opp4",
"emfRuleSetId": 126442726,
"targetType": "EVENT_ATTRIBUTE",
"targetEntity": "EVENT",
"eventName": "spinTheWheel",
"targetGroupId": 15404,
"description": "Opp3",
"active": true,
"expression": "true",
"expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
"filters": [],
"enrolmentMethod": "IMPORT",
"defaultValues": [
{
"id": 122365,
"periodId": 115289,
"defaultValue": 1.000
},
{
"id": 122366,
"periodId": 115290,
"defaultValue": 1.000
},
{
"id": 122367,
"periodId": 115291,
"defaultValue": 1.000
},
{
"id": 122368,
"periodId": 115292,
"defaultValue": 1.000
}
],
"targetPeriodDefaultValuesMap": {
"115289": {
"id": 122365,
"periodId": 115289,
"defaultValue": 1.000
},
"115291": {
"id": 122367,
"periodId": 115291,
"defaultValue": 1.000
},
"115290": {
"id": 122366,
"periodId": 115290,
"defaultValue": 1.000
},
"115292": {
"id": 122368,
"periodId": 115292,
"defaultValue": 1.000
}
},
"extendedFieldInfo": {
"name": "points",
"aggregateFunction": "SUM"
}
}
],
"leaderboardEnabled": false,
"userCreated": false
},
"errors": null,
"warnings": null
}Response parameters
| Field | Datatype | Description |
|---|---|---|
| id | integer | Unique identifier for the group. |
| name | string | Name of the group. |
| active | boolean | Indicates if the group is active. |
| preferredTillId | integer | Preferred till ID, indicating no specific preference with 0. |
| totalPeriods | integer | Total number of periods specified. |
| description | string | Description of the /roup. |
| targetEvaluationType | string | Type of target evaluation, e.g., "FIXED_CALENDAR_WINDOW". |
| targetCycleStartDate | string (date-time) | Start date and time for the target cycle. |
| targetCycleEndDate | string (date-time) | End date and time for the target cycle (if applicable). |
| frequencyType | string | Frequency type, e.g., "CUSTOM" (if applicable). |
| trackingType | string | Type of tracking, e.g., "STREAKS" (if applicable). |
| fromDate | string (date) | Start date for the setting (if applicable). |
| toDate | string (date) | End date for the setting (if applicable). |
| recurringCycles | integer | Number of recurring cycles specified (if applicable). |
| frequency | integer | Frequency value set for the setting (if applicable). |
| id | integer | Unique identifier for each period. |
| startDate | string (date) | Start date for each period. |
| endDate | string (date) | End date for each period. |
| refCode | string | Reference code for each period. |
| periodStatus | string | Status of each period, e.g., "RUNNING", "NOT_STARTED". |
| targetGroupId | integer | Identifier linking each period to a target group. |
| description | string | Description of each period. |
| active | boolean | Indicates if each period is active. |
| id | integer | Unique identifier for each streak. |
| name | string | Name of each streak. |
| targetCountOfSequence | integer | Target count of sequence for each streak. |
| id | integer | Unique identifier for each target. |
| name | string | Name of each target. |
| targetType | string | Type of each target, e.g., "SALES". |
| targetEntity | string | Type of entity targeted by each target, e.g. |
| eventName | string | Name of the event associated with each target. |
| description | string | Description of each target. |
| active | boolean | Indicates if each target is active. |
| expression | string | Expression defining the criteria for each target. |
| expressionJson | string (JSON) | Target expression in JSON format for each target. |
| entityType | string | Type of entity for the filter of each target. |
| entityIds | array of integers | IDs of entities for the filter of each target. |
| enrolmentMethod | string | Method of enrolment for each target. |
| defaultValue | float | Specifies a default value for the target criteria for each target. |
API error codes
| Code | Description |
|---|---|
| 310069 | Target group name already exists |
| 300004 | Invalid input, check all values and ensure they are correct. |
| 310008 | Length of Target rule name cannot exceed 200 |
| 310101 | At least one streak should be present for streaks target group |
| 310106 | Streak count is mandatory |
