Get target groups based on ID

This API fetches target group information. Enter a target group ID to get details of a specific target.

API endpoint example

'https://eu.api.capillarytech.com/v3/targetGroups?includeUserCreatedTargetGroups=true&includeOnlyActive=true

Prerequisites

  • Basic or OAuth authentication
  • Default access group

API Specification

URIv3/targetGroups
HTTP MethodGET
PaginationNo
Batch supportNo
Rate limit informationNone

Request path parameters

Parameter NameData
Type
Description
targetGroupIdLongGroup ID of the target to retrieve

Request query parameters

Parameter NameData
Type
Description
includePeriodsBooleanInclude the period information associated with the target.
The period object contains information on the start date, end date and current status of the target.
includeUserCreatedTargetGroupsBooleanInclude the user created target groups in the response. This value is false by default.
includeOnlyActiveBooleanInclude only targets that are currently active.

Response body

{
    "data": {
        "id": 20,
        "attribution": {
            "createdOn": "2021-11-17T06:02:54.000+0000",
            "lastUpdatedOn": "2021-11-17T06:02:54.000+0000",
            "lastUpdatedBy": {
                "id": 75047814,
                "code": "1614748040_",
                "description": "",
                "name": "Tom Sawyer",
                "type": "ADMIN_USER"
            },
            "createdBy": {
                "id": 75047814,
                "code": "1614748040_",
                "description": "",
                "name": "Tom Sawyer",
                "type": "ADMIN_USER"
            }
        },
        "name": "Demo Targets",
        "fromDate": "2021-11-18",
        "toDate": "2022-01-17",
        "active": true,
        "preferredTillId": 75043577,
        "totalPeriods": 2,
        "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
        "recurringCycles": -1,
        "frequency": 0,
        "frequencyType": "MONTHLY"
    },
    "errors": null
}
{
    "data": [
        {
            "id": 39536,
            "attribution": {
                "createdOn": "2024-08-26T13:08:58.000+0530",
                "lastUpdatedOn": "2024-08-26T13:08:58.000+0530",
                "lastUpdatedBy": {
                    "id": 50691660,
                    "code": "adm01",
                    "description": "",
                    "name": "adm01",
                    "type": "TILL"
                },
                "createdBy": {
                    "id": 50691660,
                    "code": "adm01",
                    "description": "",
                    "name": "adm01",
                    "type": "TILL"
                }
            },
            "name": "Fixed Window Milestone Group 1724657937",
            "active": true,
            "preferredTillId": 50692189,
            "activePeriod": {
                "id": 55434,
                "attribution": {
                    "createdOn": "2024-08-26T12:50:11.000+0530",
                    "lastUpdatedOn": "2024-08-26T12:50:11.000+0530",
                    "lastUpdatedBy": {
                        "id": 50691660,
                        "code": "adm01",
                        "description": "",
                        "name": "adm01",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 50691660,
                        "code": "adm01",
                        "description": "",
                        "name": "adm01",
                        "type": "TILL"
                    }
                },
                "startDate": "2024-08-20",
                "endDate": "2024-09-19",
                "refCode": "TP1",
                "periodStatus": "RUNNING",
                "targetGroupId": 39536,
                "active": true
            },
            "totalPeriods": 2,
            "description": "test via postman",
            "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
            "recurringCycles": -1,
            "frequency": 0,
            "targetCycleStartDate": "2024-08-20T08:42:01.000Z",
            "targetCycleEndDate": "2024-10-20T08:42:01.000Z",
            "frequencyType": "MONTHLY",
            "trackingType": "DEFAULT",
            "createdOn": 1724657938000,
            "targets": [
                {
                    "id": 71087,
                    "attribution": {
                        "createdOn": "2024-08-26T12:50:11.000+0530",
                        "lastUpdatedOn": "2024-08-26T12:50:11.000+0530",
                        "lastUpdatedBy": {
                            "id": 50691660,
                            "code": "adm01",
                            "description": "",
                            "name": "adm01",
                            "type": "TILL"
                        },
                        "createdBy": {
                            "id": 50691660,
                            "code": "adm01",
                            "description": "",
                            "name": "adm01",
                            "type": "TILL"
                        }
                    },
                    "name": "target-2024-08-26T07:20:09.894Z",
                    "emfRuleSetId": 1334912,
                    "targetType": "COUNT",
                    "targetEntity": "EVENT",
                    "eventName": "TransactionAdd",
                    "targetGroupId": 39536,
                    "description": "targetf",
                    "active": true,
                    "expression": "true",
                    "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
                    "enrolmentMethod": "IMPORT",
                    "defaultValues": [
                        {
                            "id": 96664,
                            "periodId": 55434,
                            "defaultValue": 500.000
                        },
                        {
                            "id": 96665,
                            "periodId": 55435,
                            "defaultValue": 500.000
                        }
                    ],
                    "targetPeriodDefaultValuesMap": {
                        "55434": {
                            "id": 96664,
                            "periodId": 55434,
                            "defaultValue": 500.000
                        },
                        "55435": {
                            "id": 96665,
                            "periodId": 55435,
                            "defaultValue": 500.000
                        }
                    },
                    "extendedFieldInfo": {
                        "name": "cartId",
                        "aggregateFunction": "SUM",
                        "aggregateWindow": null
                    },
                    "targetMilestoneTriggers": []
                }
            ],
            "userCreated": true
        }
  ],
    "errors": null,
    "warnings": null
}

Response parameters

API Documentation

FieldTypeDescription
idIntegerUnique identifier for the milestone.
createdOnStringThe creation date and time of the target group (ISO 8601 format).
lastUpdatedOnStringThe last update date and time of the target group (ISO 8601 format).
lastUpdatedByObjectDefine this object first:
  - idIntegerThe ID of the last user who updated the target group.
  - codeStringThe code associated with the user.
createdByObjectDefine this object first:
  - idIntegerThe ID of the user who created the target group.
  - codeStringThe code associated with the user
nameStringName of the target group.
fromDateDateStart date of the target group's active period (Format: yyyy-MM-dd).
toDateDateEnd date of the target group's active period (Format: yyyy-MM-dd).
activeBooleanStatus indicating if the target group is currently active.
preferredTillIdIntegerA reference ID for internal use, possibly related to prioritization.
activePeriodObjectDefine this object first:
  - idIntegerThe ID of the currently active period.
  - startDateDateStart date of the active period (Format: yyyy-MM-dd).
  - endDateDateEnd date of the active period (Format: yyyy-MM-dd).
  - createdOnStringThe creation date and time of the period (ISO 8601 format).
  - lastUpdatedOnStringThe last update date and time of the period (ISO 8601 format).
  - lastUpdatedByObjectDefine this object first:
     - idIntegerThe ID of the last user who updated the period.
     - codeStringThe code of the last user who updated the period.
  - createdByObjectDefine this object first:
     - idIntegerThe ID of the user who created the period.
     - codeStringThe code of the last user who created the period.
totalPeriodsIntegerThe total number of periods over which the tracking is evaluated.
descriptionStringDescription of the non-continuous-streaks group.
targetEvaluationTypeStringThe evaluation strategy for the targets. Supported values: FIXED_CALENDAR_WINDOW, CYCLIC_WINDOW, PERIOD_AGNOSTIC_WINDOW.
recurringCyclesIntegerNumber of recurring cycles.
frequencyIntegerThe frequency count, relevant to the frequencyType.
targetCycleStartDateDateTimeStart date and time of the target cycle (ISO 8601 format).
targetCycleEndDateDateTimeEnd date and time of the target cycle (ISO 8601 format).
frequencyTypeEnumThe frequency of each cycle in which the user has to achieve the target value. Supported values: Monthly, Quarterly, Half-yearly, Yearly, Weekly.
trackingTypeEnumThe type of tracking the milestone is created for. Supported values: Default (single target tracking), Unified (tracking multiple targets as a unit), Streak (Tracking the achievement of a user across the cycles continuously), Capping (Tracking the number of points a user has got over a period, so that capping can be applied).
targetsArrayA collection of targets within the target group.
  - idIntegerUnique identifier for each target.
  - nameStringName of the target.
  - emfRuleSetIdIntegerRule set ID associated with the target.
  - targetTypeEnumType of target (e.g., COUNT).
  - targetEntityEnumEntity of the target. Supported values: CUSTOMER, TRANSACTIONS, STORE, PRODUCT, BEHAVIOURAL EVENTS
  - eventNameStringEvent name associated with the target.
  - targetGroupIdIntegerID of the target group to which the target belongs.
  - descriptionStringDescription of the target.
  - expressionStringExpression defining the target condition.
  - expressionJsonJSONJSON format of the expression defining the target condition.
  - defaultValuesArrayDefault values associated with periods for the target.
     - idIntegerUnique identifier for each default value.
     - periodIdIntegerID of the period to which the default value belongs.
     - defaultValueDecimalDefault value of the period.
extendedFieldInfoObjectInformation related to extended fields.
userCreatedBooleanWhether the target group is user created.
errorsObjectErrors, if any.
warningsObjectWarnings, if any.
Language
Authorization
Basic
base64
:
URL
Click Try It! to start a request and see the response here!