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 -L 'https://eu.api.capillarytech.com/v3/targetGroups' \
-H 'Content-Type: application/json' \
-H 'Cookie: _cfuvid=aidEostKQWmdskBHmh1pchvz2wSoA1O27JghNUFOpHw-1728306311172-0.0.1.1-604800000; _cfuvid=2ieM2eqBqFdNAAdfQMYR0zNvTd6WWmQxVVyU.OyFiEw-1728475108732-0.0.1.1-604800000; _cfuvid=2G0CzMo50ZKNrUvAmW0geVydLM0NOFZKEj.drnbKFus-1763644069670-0.0.1.1-604800000' \
-H 'Authorization: Basic ZmM2YjZlY2I2MmEy' \
-d '{
"active": true,
"description": "Target group number hundered and one",
"name": "uatTargetGroup101",
"trackingType": "DEFAULT",
"targetEvaluationType": "FIXED_CALENDAR_WINDOW",
"totalPeriods": 1,
"frequencyType": "DAILY",
"frequency": 1,
"timeZoneName":"Asia/Kolkata",
"recurringCycles": 1,
"preferredTillId": 751552970000,
"userCreated": false,
"periods": [
{
"active": true,
"description": "",
"endDate": "2025-06-11T23:59:59.999Z",
"periodStatus": "RUNNING",
"refCode": "Cycle_1",
"startDate": "2025-06-11T00:00:00.000Z"
},
{
"active": true,
"description": "",
"endDate": "2025-05-11T23:59:59.999Z",
"periodStatus": "NOT_STARTED",
"refCode": "Cycle_2",
"startDate": "2025-05-11T00:00:00.000Z"
}
],
"targets": [
{
"active": true,
"description": "",
"expression": true,
"expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
"filters": [],
"name": "uat_target_group_101",
"targetEntity": "EVENT",
"targetType": "COUNT",
"extendedFieldInfo": {
"name": "points",
"aggregateFunction": "SUM"
},
"defaultValues": [
{
"defaultValue": "1.00"
},
{
"defaultValue": "1.00"
}
]
}
]
}'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. |
preferredTillId | Number | Identifier for a preferred till. |
timeZoneName | String | IANA time zone name for |
trackingType* | String | The type of tracking the milestone is created for. Supported values: |
targetEvaluationType | String | The evaluation strategy for the targets. Supported values: |
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 |
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. |
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. |
extendedFieldInfo | Object | Details of the event attribute being tracked. Applicable when |
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: |
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 |
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": 2771,
"name": "uatTargetGroup101",
"active": true,
"preferredTillId": 751552970000,
"periods": [
{
"id": 30160,
"attribution": {
"createdOn": "2025-11-20T13:07:49.000+0000",
"createdOnISO": "2025-11-20T13:07:49Z",
"lastUpdatedOn": "2025-11-20T13:07:49.000+0000",
"lastUpdatedOnISO": "2025-11-20T13:07:49Z",
"lastUpdatedBy": {
"id": 75152721,
"code": "naman_doc",
"description": "",
"name": "naman",
"type": "TILL"
},
"createdBy": {
"id": 75152721,
"code": "naman_doc",
"description": "",
"name": "naman",
"type": "TILL"
}
},
"startDate": "2025-06-11",
"endDate": "2025-06-11",
"refCode": "Cycle_1",
"periodStatus": "ENDED",
"targetGroupId": 2771,
"description": "",
"active": true
},
{
"id": 30161,
"attribution": {
"createdOn": "2025-11-20T13:07:49.000+0000",
"createdOnISO": "2025-11-20T13:07:49Z",
"lastUpdatedOn": "2025-11-20T13:07:49.000+0000",
"lastUpdatedOnISO": "2025-11-20T13:07:49Z",
"lastUpdatedBy": {
"id": 75152721,
"code": "naman_doc",
"description": "",
"name": "naman",
"type": "TILL"
},
"createdBy": {
"id": 75152721,
"code": "naman_doc",
"description": "",
"name": "naman",
"type": "TILL"
}
},
"startDate": "2025-05-11",
"endDate": "2025-05-11",
"refCode": "Cycle_2",
"periodStatus": "ENDED",
"targetGroupId": 2771,
"description": "",
"active": true
}
],
"totalPeriods": 1,
"description": "UAT target group number hundered and one",
"targetEvaluationType": "FIXED_CALENDAR_WINDOW",
"recurringCycles": 1,
"frequency": 1,
"targetCycleStartDate": "2025-05-11T00:00:00.000Z",
"targetCycleEndDate": "2025-06-11T23:59:59.000Z",
"targetCycleStartDateISO": "2025-05-11T00:00:00Z",
"targetCycleEndDateISO": "2025-06-11T23:59:59Z",
"frequencyType": "DAILY",
"trackingType": "DEFAULT",
"targets": [
{
"id": 3017,
"attribution": {
"createdOn": "2025-11-20T13:07:49.173+0000",
"createdOnISO": "2025-11-20T13:07:49Z",
"lastUpdatedOn": "2025-11-20T13:07:49.173+0000",
"lastUpdatedOnISO": "2025-11-20T13:07:49Z",
"lastUpdatedBy": {
"id": 75152721,
"code": "naman_doc",
"description": "",
"name": "naman",
"type": "TILL"
},
"createdBy": {
"id": 75152721,
"code": "naman_doc",
"description": "",
"name": "naman",
"type": "TILL"
}
},
"name": "uat_target_group_101",
"emfRuleSetId": 126455464,
"targetType": "COUNT",
"targetEntity": "EVENT",
"eventName": "TransactionAdd",
"targetGroupId": 2771,
"description": "",
"active": true,
"expression": "true",
"expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
"filters": [],
"enrolmentMethod": "IMPORT",
"defaultValues": [
{
"id": 127067,
"periodId": 30160,
"defaultValue": 1.000
},
{
"id": 127068,
"periodId": 30161,
"defaultValue": 1.000
}
],
"targetPeriodDefaultValuesMap": {
"30160": {
"id": 127067,
"periodId": 30160,
"defaultValue": 1.000
},
"30161": {
"id": 127068,
"periodId": 30161,
"defaultValue": 1.000
}
},
"extendedFieldInfo": {
"name": "points",
"aggregateFunction": "SUM"
}
}
],
"leaderboardEnabled": false,
"userCreated": false,
"timeZoneName": "Asia/Kolkata"
},
"errors": null,
"warnings": null
}Response parameters
| Field | Datatype | Description |
|---|---|---|
| object | object | Root response object. |
| .data | object | Target group details. |
| ..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. |
| ..periods | array of objects | List of periods specified for the group. |
| ...id | integer | Unique identifier for each period. |
| ...attribution | object | Audit information for each period. |
| ....createdOn | string (date-time) | Creation date and time of the period in ISO 8601 extended format. |
| ....createdOnISO | string (date-time) | Creation date and time of the period in ISO 8601 extended format with timezone included. |
| ....lastUpdatedOn | string (date-time) | Date and time when the period was last updated in ISO 8601 extended format. |
| ....lastUpdatedOnISO | string (date-time) | Date and time when the period was last updated in ISO 8601 extended format with timezone included. |
| ....lastUpdatedBy | object | User who last updated the period. |
| .....id | integer | Unique identifier of the user who last updated the period. |
| .....code | string | Code of the user who last updated the period. |
| .....description | string | Description of the user who last updated the period. |
| .....name | string | Name of the user who last updated the period. |
| .....type | string | Type of updater, e.g., "TILL". |
| ....createdBy | object | User who created the period. |
| .....id | integer | Unique identifier of the user who created the period. |
| .....code | string | Code of the user who created the period. |
| .....description | string | Description of the user who created the period. |
| .....name | string | Name of the user who created the period. |
| .....type | string | Type of creator, e.g., "TILL". |
| ...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", "ENDED". |
| ...targetGroupId | integer | Identifier linking each period to a target group. |
| ...description | string | Description of each period. |
| ...active | boolean | Indicates if each period is active. |
| ..totalPeriods | integer | Total number of periods specified. |
| ..description | string | Description of the group. |
| ..targetEvaluationType | string | Type of target evaluation, e.g., "FIXED_CALENDAR_WINDOW". |
| ..recurringCycles | integer | Number of recurring cycles specified (if applicable). |
| ..frequency | integer | Frequency value set for the setting (if applicable). |
| ..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). |
| ..targetCycleStartDateISO | string (date-time) | Start date and time for the target cycle in ISO 8601 YYYY-MM-DDTHH:mm:ssZ format (UTC). |
| ..targetCycleEndDateISO | string (date-time) | End date and time for the target cycle in ISO 8601 YYYY-MM-DDTHH:mm:ssZ format with timezone included. |
| ..frequencyType | string | Frequency type, e.g., "CUSTOM", "DAILY" (if applicable). |
| ..trackingType | string | Type of tracking, e.g., "STREAKS", "DEFAULT" (if applicable). |
| ..targets | array of objects | List of targets configured for the group. |
| ...id | integer | Unique identifier for each target. |
| ...attribution | object | Audit information for each target. |
| ....createdOn | string (date-time) | Creation date and time of the target in ISO 8601 extended format. |
| ....createdOnISO | string (date-time) | Creation date and time of the target in ISO 8601 extended format with the timezone included. |
| ....lastUpdatedOn | string (date-time) | Date and time when the target was last updated in ISO 8601 extended format. |
| ....lastUpdatedOnISO | string (date-time) | Date and time when the target was last updated in ISO 8601 extended format with the timezone included. |
| ....lastUpdatedBy | object | User who last updated the target. |
| .....id | integer | Unique identifier of the user who last updated the target. |
| .....code | string | Code of the user who last updated the target. |
| .....description | string | Description of the user who last updated the target. |
| .....name | string | Name of the user who last updated the target. |
| .....type | string | Type of updater, e.g., "TILL". |
| ....createdBy | object | User who created the target. |
| .....id | integer | Unique identifier of the user who created the target. |
| .....code | string | Code of the user who created the target. |
| .....description | string | Description of the user who created the target. |
| .....name | string | Name of the user who created the target. |
| .....type | string | Type of creator, e.g., "TILL". |
| ...name | string | Name of each target. |
| ...emfRuleSetId | integer | Identifier of the rule set used for evaluating the target. |
| ...targetType | string | Type of each target, e.g., "SALES", "COUNT". |
| ...targetEntity | string | Type of entity targeted by each target, e.g., "EVENT". |
| ...eventName | string | Name of the event associated with each target. |
| ...targetGroupId | integer | Identifier linking each target to a target group. |
| ...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. |
| ...filters | array | Filters applied to the target (if any). |
| ...enrolmentMethod | string | Method of enrolment for each target. |
| ...defaultValues | array of objects | Default values configured per period for the target. |
| ....id | integer | Unique identifier for each default value configuration. |
| ....periodId | integer | Identifier of the period the default value applies to. |
| ....defaultValue | float | Specifies a default value for the target criteria for each target. |
| ...targetPeriodDefaultValuesMap | object | Map of period IDs to their default value configuration for the target. |
| ....30160 | object | Default value configuration for period ID 30160. |
| .....id | integer | Unique identifier for the default value configuration for period ID 30160. |
| .....periodId | integer | Period ID (30160) that this default value configuration applies to. |
| .....defaultValue | float | Default value configured for period ID 30160. |
| ....30161 | object | Default value configuration for period ID 30161. |
| .....id | integer | Unique identifier for the default value configuration for period ID 30161. |
| .....periodId | integer | Period ID (30161) that this default value configuration applies to. |
| .....defaultValue | float | Default value configured for period ID 30161. |
| ...extendedFieldInfo | object | Additional configuration for the aggregation field used by the target. |
| ....name | string | Name of the extended field used for aggregation. |
| ....aggregateFunction | string | Aggregate function applied on the extended field, e.g., "SUM". |
| ..leaderboardEnabled | boolean | Indicates if leaderboard is enabled for this target group. |
| ..userCreated | boolean | Indicates if the target group was created by a user. |
| ..timeZoneName | string | Time zone used for date and time evaluation, e.g., "Asia/Kolkata". |
| .errors | array of objects or null | List of errors, if any. |
| .warnings | array of objects or null | List of warnings, if any. |
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 |
