Skip to main content
GET
/
v1
/
loyalties
/
{campaignId}
/
earning-rules
List Earning Rules
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
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

campaignId
string
required

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.

Example:

"camp_rRsfatlwN7unSeUIJDCYedal"

Query Parameters

limit
integer

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.

Required range: 1 <= x <= 100
page
integer

Which page of results to return. The lowest value is 1.

Required range: 1 <= x <= 100
order
enum<string>

Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.

Available options:
created_at,
-created_at,
updated_at,
-updated_at

Response

200 - application/json

Returns a list of earning rules.

Response body schema for listing earning rules using GET v1/loyalties/{campaignId}/earning-rules endpoint.

object
enum<string>
default:list

The type of the object represented by JSON. This object stores information about earning rules in a dictionary.

Available options:
list
data_ref
string
default:data

Identifies the name of the attribute that contains the array of earning rule objects.

data
Earning Rule Β· object[]

Contains array of earning rule objects.

total
integer

Total number of earning rule objects.

⌘I