curl --request GET \
--url https://{cluster}.voucherify.io/v1/loyalties/{campaignId}/earning-rules \
--header 'Authorization: Bearer <token>' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>'{
"object": "list",
"data_ref": "data",
"data": [
{
"id": "ern_HnRXyJHoj3E79r3KUWhgMgtD",
"created_at": "2022-11-10T12:25:12.927Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 100,
"type": "FIXED"
},
"segment": {
"id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5"
},
"event": "customer.segment.entered",
"source": {
"banner": "New Customers",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap",
"metadata": {}
},
{
"id": "ern_raVUcdXruvXGuzm682ESrAzt",
"created_at": "2022-11-24T09:03:14.534Z",
"updated_at": "2022-11-25T07:31:42.778Z",
"validation_rule_id": "val_7SxpdhPeBngA",
"loyalty": {
"points": 20,
"type": "FIXED"
},
"event": "order.paid",
"source": {
"banner": "Order has been paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"start_date": "2022-11-23T00:00:00.000Z",
"expiration_date": "2022-11-30T00:00:00.000Z",
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"object": "earning_rule",
"automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L",
"metadata": {
"Type": "Order has been paid - Fixed"
}
},
{
"id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR",
"created_at": "2022-11-24T14:48:36.567Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_AMOUNT",
"order": {
"amount": {
"every": 1000,
"points": 1
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz",
"metadata": {
"Type": "Order has been paid - Proportional - 1"
}
},
{
"id": "ern_jwtacKdEEHoc85QbouRw3CR8",
"created_at": "2022-11-24T15:17:11.539Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_TOTAL_AMOUNT",
"order": {
"total_amount": {
"every": 1100,
"points": 1
}
}
},
"event": "order.paid",
"source": {
"banner": "Order has been paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK",
"metadata": {
"Type": "Order has been paid - Proportional - 2"
}
},
{
"id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ",
"created_at": "2022-11-24T15:20:04.392Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_METADATA",
"order": {
"metadata": {
"every": 10,
"points": 2,
"property": "number_of_store_visits"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z",
"metadata": {
"Type": "Order has been paid - Proportional - 3 - Metadata"
}
},
{
"id": "ern_Aop1wTrmPv4yBntDcvXNTCWR",
"created_at": "2022-11-24T15:23:44.514Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_ITEMS_AMOUNT",
"order_items": {
"amount": {
"every": 1000,
"points": 3,
"object": "products_collection",
"id": "pc_75U0dHlr7u75BJodrW1AE3t6"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg",
"metadata": {
"Type": "Order has been paid - Proportional - 4"
}
},
{
"id": "ern_4qSQVjfGEH7OmXKMzotS0juY",
"created_at": "2022-11-24T15:44:45.301Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT",
"order_items": {
"subtotal_amount": {
"every": 1000,
"points": 4,
"object": "sku",
"id": "sku_0b7d7dfb090be5c619"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW",
"metadata": {
"Type": "Order has been paid - Proportional - 5 - Items"
}
},
{
"id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP",
"created_at": "2022-11-24T15:56:58.710Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_ITEMS_AMOUNT",
"order_items": {
"amount": {
"every": 10000,
"points": 1,
"object": "product",
"id": "prod_0bae32322150fd0546"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e",
"metadata": {}
},
{
"id": "ern_v4Blmh9hA3gpnjo93cMAgvHr",
"created_at": "2022-11-24T16:19:20.571Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 1,
"points": 5,
"property": "customer_life_time_value"
}
}
},
"segment": {
"id": "seg_OlE7DmfzMI5pHyD5VAv512r1"
},
"event": "customer.segment.entered",
"source": {
"banner": "Entered Segment",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_wMMDJ86iHKkznz9x0506e30E",
"metadata": {}
},
{
"id": "ern_L8dFanPxJzhw0f5voTwPurGP",
"created_at": "2022-11-24T16:27:13.917Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 3,
"type": "FIXED"
},
"custom_event": {
"schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13"
},
"event": "page_view",
"source": {
"banner": "Custom Event",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b",
"metadata": {
"Type": "Fixed"
}
},
{
"id": "ern_ngdugZ2hzg35hGASFF8nDjUO",
"created_at": "2022-11-24T16:41:48.830Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOM_EVENT_METADATA",
"custom_event": {
"metadata": {
"every": 2,
"points": 2,
"property": "volume_number"
}
}
},
"custom_event": {
"schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au"
},
"event": "user_subscribed",
"source": {
"banner": "Custom Event",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh",
"metadata": {
"Type": "Event"
}
},
{
"id": "ern_afo3Ea760hAKv07JYpycnhiE",
"created_at": "2022-11-24T16:50:12.945Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 3,
"points": 3,
"property": "customer_life_time_value"
}
}
},
"custom_event": {
"schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma"
},
"event": "cart_abandoned",
"source": {
"banner": "Custom Event",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP",
"metadata": {}
},
{
"id": "ern_chdlG14W8Sdcq3d6jJQQgRMT",
"created_at": "2022-11-24T16:51:31.595Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 1,
"type": "FIXED"
},
"event": "customer.loyalty.tier.joined",
"loyalty_tier": {
"id": "__ANY__"
},
"source": {
"banner": "Tier joined - Any",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW",
"metadata": {
"Type": "Tier joined - any - fixed"
}
},
{
"id": "ern_gVo6CHBduFPoh1hctASfXHLT",
"created_at": "2022-11-24T17:01:42.809Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 4,
"points": 4,
"property": "customer_life_time_value"
}
}
},
"event": "customer.loyalty.tier.joined",
"loyalty_tier": {
"id": "ltr_pudTGWasuIqxdiDM0go31OV1"
},
"source": {
"banner": "Tier joined",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7",
"metadata": {
"Type": "Tier joined - customer metadata - proportional"
}
},
{
"id": "ern_66OdCyLADv5IGFoQe18vGUwa",
"created_at": "2022-11-24T17:03:59.414Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 2,
"points": 2,
"property": "customer_life_time_value"
}
}
},
"event": "customer.loyalty.tier.left",
"loyalty_tier": {
"id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2"
},
"source": {
"banner": "Tier left",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq",
"metadata": {
"Type": "Tier left"
}
},
{
"id": "ern_YR3fDfCjAmz9a5D68nk0i4dm",
"created_at": "2022-11-25T07:29:38.961Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 3,
"points": 4,
"property": "customer_life_time_value"
}
}
},
"event": "customer.loyalty.tier.upgraded",
"loyalty_tier": {
"id": "ltr_30KHciA0UG8B71Fo51GZqwgN"
},
"source": {
"banner": "Tier upgraded",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv",
"metadata": {
"Type": "Upgraded"
}
},
{
"id": "ern_A2RArBE30Tkt56utVLrRv7rZ",
"created_at": "2022-11-25T07:31:05.866Z",
"updated_at": "2022-11-25T07:31:43.029Z",
"validation_rule_id": "val_kfmWpfXMI9P1",
"loyalty": {
"points": 1,
"type": "FIXED"
},
"event": "customer.loyalty.tier.downgraded",
"loyalty_tier": {
"id": "__ANY__"
},
"source": {
"banner": "Tier Downgraded",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW",
"metadata": {
"Type": "Tier"
}
},
{
"id": "ern_AdlWO2yt6b6llWsibIdiRXVE",
"created_at": "2022-11-25T07:31:42.767Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 5,
"type": "FIXED"
},
"event": "customer.loyalty.tier.prolonged",
"loyalty_tier": {
"id": "__ANY__"
},
"source": {
"banner": "Prolonged",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb",
"metadata": {}
}
],
"total": 18
}Returns a list of all earning rules within a given campaign.
curl --request GET \
--url https://{cluster}.voucherify.io/v1/loyalties/{campaignId}/earning-rules \
--header 'Authorization: Bearer <token>' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>'{
"object": "list",
"data_ref": "data",
"data": [
{
"id": "ern_HnRXyJHoj3E79r3KUWhgMgtD",
"created_at": "2022-11-10T12:25:12.927Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 100,
"type": "FIXED"
},
"segment": {
"id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5"
},
"event": "customer.segment.entered",
"source": {
"banner": "New Customers",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap",
"metadata": {}
},
{
"id": "ern_raVUcdXruvXGuzm682ESrAzt",
"created_at": "2022-11-24T09:03:14.534Z",
"updated_at": "2022-11-25T07:31:42.778Z",
"validation_rule_id": "val_7SxpdhPeBngA",
"loyalty": {
"points": 20,
"type": "FIXED"
},
"event": "order.paid",
"source": {
"banner": "Order has been paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"start_date": "2022-11-23T00:00:00.000Z",
"expiration_date": "2022-11-30T00:00:00.000Z",
"validity_day_of_week": [
1,
2,
3,
4,
5
],
"object": "earning_rule",
"automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L",
"metadata": {
"Type": "Order has been paid - Fixed"
}
},
{
"id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR",
"created_at": "2022-11-24T14:48:36.567Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_AMOUNT",
"order": {
"amount": {
"every": 1000,
"points": 1
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz",
"metadata": {
"Type": "Order has been paid - Proportional - 1"
}
},
{
"id": "ern_jwtacKdEEHoc85QbouRw3CR8",
"created_at": "2022-11-24T15:17:11.539Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_TOTAL_AMOUNT",
"order": {
"total_amount": {
"every": 1100,
"points": 1
}
}
},
"event": "order.paid",
"source": {
"banner": "Order has been paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK",
"metadata": {
"Type": "Order has been paid - Proportional - 2"
}
},
{
"id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ",
"created_at": "2022-11-24T15:20:04.392Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_METADATA",
"order": {
"metadata": {
"every": 10,
"points": 2,
"property": "number_of_store_visits"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z",
"metadata": {
"Type": "Order has been paid - Proportional - 3 - Metadata"
}
},
{
"id": "ern_Aop1wTrmPv4yBntDcvXNTCWR",
"created_at": "2022-11-24T15:23:44.514Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_ITEMS_AMOUNT",
"order_items": {
"amount": {
"every": 1000,
"points": 3,
"object": "products_collection",
"id": "pc_75U0dHlr7u75BJodrW1AE3t6"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg",
"metadata": {
"Type": "Order has been paid - Proportional - 4"
}
},
{
"id": "ern_4qSQVjfGEH7OmXKMzotS0juY",
"created_at": "2022-11-24T15:44:45.301Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT",
"order_items": {
"subtotal_amount": {
"every": 1000,
"points": 4,
"object": "sku",
"id": "sku_0b7d7dfb090be5c619"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW",
"metadata": {
"Type": "Order has been paid - Proportional - 5 - Items"
}
},
{
"id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP",
"created_at": "2022-11-24T15:56:58.710Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "ORDER_ITEMS_AMOUNT",
"order_items": {
"amount": {
"every": 10000,
"points": 1,
"object": "product",
"id": "prod_0bae32322150fd0546"
}
}
},
"event": "order.paid",
"source": {
"banner": "Order paid",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e",
"metadata": {}
},
{
"id": "ern_v4Blmh9hA3gpnjo93cMAgvHr",
"created_at": "2022-11-24T16:19:20.571Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 1,
"points": 5,
"property": "customer_life_time_value"
}
}
},
"segment": {
"id": "seg_OlE7DmfzMI5pHyD5VAv512r1"
},
"event": "customer.segment.entered",
"source": {
"banner": "Entered Segment",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_wMMDJ86iHKkznz9x0506e30E",
"metadata": {}
},
{
"id": "ern_L8dFanPxJzhw0f5voTwPurGP",
"created_at": "2022-11-24T16:27:13.917Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 3,
"type": "FIXED"
},
"custom_event": {
"schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13"
},
"event": "page_view",
"source": {
"banner": "Custom Event",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b",
"metadata": {
"Type": "Fixed"
}
},
{
"id": "ern_ngdugZ2hzg35hGASFF8nDjUO",
"created_at": "2022-11-24T16:41:48.830Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOM_EVENT_METADATA",
"custom_event": {
"metadata": {
"every": 2,
"points": 2,
"property": "volume_number"
}
}
},
"custom_event": {
"schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au"
},
"event": "user_subscribed",
"source": {
"banner": "Custom Event",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh",
"metadata": {
"Type": "Event"
}
},
{
"id": "ern_afo3Ea760hAKv07JYpycnhiE",
"created_at": "2022-11-24T16:50:12.945Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 3,
"points": 3,
"property": "customer_life_time_value"
}
}
},
"custom_event": {
"schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma"
},
"event": "cart_abandoned",
"source": {
"banner": "Custom Event",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP",
"metadata": {}
},
{
"id": "ern_chdlG14W8Sdcq3d6jJQQgRMT",
"created_at": "2022-11-24T16:51:31.595Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 1,
"type": "FIXED"
},
"event": "customer.loyalty.tier.joined",
"loyalty_tier": {
"id": "__ANY__"
},
"source": {
"banner": "Tier joined - Any",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW",
"metadata": {
"Type": "Tier joined - any - fixed"
}
},
{
"id": "ern_gVo6CHBduFPoh1hctASfXHLT",
"created_at": "2022-11-24T17:01:42.809Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 4,
"points": 4,
"property": "customer_life_time_value"
}
}
},
"event": "customer.loyalty.tier.joined",
"loyalty_tier": {
"id": "ltr_pudTGWasuIqxdiDM0go31OV1"
},
"source": {
"banner": "Tier joined",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7",
"metadata": {
"Type": "Tier joined - customer metadata - proportional"
}
},
{
"id": "ern_66OdCyLADv5IGFoQe18vGUwa",
"created_at": "2022-11-24T17:03:59.414Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 2,
"points": 2,
"property": "customer_life_time_value"
}
}
},
"event": "customer.loyalty.tier.left",
"loyalty_tier": {
"id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2"
},
"source": {
"banner": "Tier left",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq",
"metadata": {
"Type": "Tier left"
}
},
{
"id": "ern_YR3fDfCjAmz9a5D68nk0i4dm",
"created_at": "2022-11-25T07:29:38.961Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"type": "PROPORTIONAL",
"calculation_type": "CUSTOMER_METADATA",
"customer": {
"metadata": {
"every": 3,
"points": 4,
"property": "customer_life_time_value"
}
}
},
"event": "customer.loyalty.tier.upgraded",
"loyalty_tier": {
"id": "ltr_30KHciA0UG8B71Fo51GZqwgN"
},
"source": {
"banner": "Tier upgraded",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv",
"metadata": {
"Type": "Upgraded"
}
},
{
"id": "ern_A2RArBE30Tkt56utVLrRv7rZ",
"created_at": "2022-11-25T07:31:05.866Z",
"updated_at": "2022-11-25T07:31:43.029Z",
"validation_rule_id": "val_kfmWpfXMI9P1",
"loyalty": {
"points": 1,
"type": "FIXED"
},
"event": "customer.loyalty.tier.downgraded",
"loyalty_tier": {
"id": "__ANY__"
},
"source": {
"banner": "Tier Downgraded",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW",
"metadata": {
"Type": "Tier"
}
},
{
"id": "ern_AdlWO2yt6b6llWsibIdiRXVE",
"created_at": "2022-11-25T07:31:42.767Z",
"updated_at": null,
"validation_rule_id": null,
"loyalty": {
"points": 5,
"type": "FIXED"
},
"event": "customer.loyalty.tier.prolonged",
"loyalty_tier": {
"id": "__ANY__"
},
"source": {
"banner": "Prolonged",
"object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
"object_type": "campaign"
},
"active": true,
"object": "earning_rule",
"automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb",
"metadata": {}
}
],
"total": 18
}The access token received from the authorization server in the OAuth 2.0 flow.
The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.
"camp_rRsfatlwN7unSeUIJDCYedal"
Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items.
1 <= x <= 100Which page of results to return. The lowest value is 1.
1 <= x <= 100Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.
created_at, -created_at, updated_at, -updated_at Returns a list of earning rules.
Response body schema for listing earning rules using GET v1/loyalties/{campaignId}/earning-rules endpoint.
The type of the object represented by JSON. This object stores information about earning rules in a dictionary.
list Identifies the name of the attribute that contains the array of earning rule objects.
Contains array of earning rule objects.
Show child attributes
Assigned by the Voucherify API, identifies the earning rule object.
Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format.
Show child attributes
The number of points to be added to the loyalty card.
FIXED Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points.
Formula used to dynamically calculate the rewarded points.
Contains the custom earning rule name and parent campaign.
Show child attributes
A unique campaign identifier assigned by the Voucherify API.
Defines the object associated with the earning rule. Defaults to campaign.
campaign Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard.
The type of the object represented by JSON. Default is earning_rule.
earning_rule For internal use by Voucherify.
The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format.
A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.
Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.
A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.
true indicates an active earning rulefalse indicates an inactive earning ruleDefines the event which triggers the earning rule to add points to a loyalty card.
"order.paid,customer.segment.entered,customer.loyalty.tier.upgraded,customer.loyalty.tier.downgraded,customer.loyalty.tier.prolonged,customer.loyalty.tier.joined,customer.loyalty.tier.left"
Defines the configuration for pending points. Pending points can be used only with the order.paid event.
Show child attributes
Defines the type of the period during which the points are in the pending state. Currently, only DAY value is accepted.
DAY Defines for how long the points are in the pending state. The minimum value is 1, maximum is 90.
1 <= x <= 90Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default.
Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default.
Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.
Show child attributes
Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour.
"PT1H"
Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day.
"P2D"
Integer array corresponding to the particular days of the week in which the voucher is valid.
0 Sunday1 Monday2 Tuesday3 Wednesday4 Thursday5 Friday6 Saturday0, 1, 2, 3, 4, 5, 6 Determines the hours of validity, e.g. to create a happy hours scenario.
Show child attributes
Defines the recurring period(s) when the resource is active. The periods should not overlap.
Show child attributes
Defines the starting hour of validity in the HH:mm format. The resource is inactive before this time.
"12:00"
Integer array corresponding to the particular days of the week in which the resource is valid.
0 Sunday1 Monday2 Tuesday3 Wednesday4 Thursday5 Friday6 Saturday0, 1, 2, 3, 4, 5, 6 Defines the ending hour of validity in the HH:mm format. The resource is inactive after this time.
"14:00"
Defines the loyalty point expiration rule. This expiration rule applies only to this earning rule and supersedes expiration_rules defined in the voucher.loyalty_card object.
Show child attributes
Type of period. Can be set for MONTH or FIXED_DAY_OF_YEAR. MONTH requires the period_value field. FIXED_DAY_OF_YEAR requires the fixed_month and fixed_day fields.
FIXED_DAY_OF_YEAR, MONTH Value of the period. Required for the period_type: MONTH.
Type of rounding of the expiration period. Optional for the period_type: MONTH.
END_OF_MONTH, END_OF_QUARTER, END_OF_HALF_YEAR, END_OF_YEAR, PARTICULAR_MONTH Value of rounding of the expiration period. Required for the rounding_type.
Determines the month when the points expire; 1 is January, 2 is February, and so on. Required for the period_type: FIXED_DAY_OF_YEAR.
1 <= x <= 12Determines the day of the month when the points expire. Required for the period_type: FIXED_DAY_OF_YEAR.
1 <= x <= 31Total number of earning rule objects.
Was this page helpful?