curl --request PUT \
--url https://{cluster}.voucherify.io/v2/loyalties/earning-rules/{earningRuleId} \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"name": "Updated earning rule",
"earnings": [
{
"id": "lernei_133a941c42006594cd",
"name": "Existing earning 01",
"rules": {
"1": {
"name": "customer.segment",
"conditions": {
"$is": [
"seg_AOmoT5hwNqBl7tJsHh26CBUH"
]
}
},
"logic": "1"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 30,
"card_definition_id": "lcdef_1329efb2af8ba6486f"
}
}
],
"tier_rules": {
"type": "NO_REQUIREMENTS"
}
},
{
"name": "New earning 01",
"rules": {
"1": {
"name": "order.items.any",
"conditions": {
"$is": [
{
"id": "prod_12b4cecb4fd5a6402f",
"type": "products_or_skus",
"object": "product",
"source_id": "refreshing_soda"
}
]
}
},
"logic": "1"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 300,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
],
"tier_rules": {
"type": "ANY_OF",
"any_of": [
{
"tier_ids": [
"lt_12afe9efd24e603ac0"
],
"tier_structure_id": "lts_12afe9ef956906b3b7"
}
]
}
},
{
"name": "New earning 02",
"effects": [
{
"type": "POINTS",
"points": {
"value": 100,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
]
}
],
"trigger": {
"event": "customer.order.paid"
},
"validity_hours": {
"type": "ANY_TIME"
},
"end_date": "2026-12-31T00:00:00.000Z",
"earning_limits": {
"global": {
"type": "NO_LIMIT",
"limits": []
}
},
"metadata": {
"temporary_earning_rule": true
}
}
'{
"id": "lern_133a941c44c06594cf",
"name": "Updated earning rule",
"status": "DRAFT",
"earnings": [
{
"id": "lernei_133a941c42006594cd",
"name": "Existing earning 01",
"rules": {
"1": {
"name": "customer.segment",
"conditions": {
"$is": [
"seg_AOmoT5hwNqBl7tJsHh26CBUH"
]
}
},
"logic": "1"
},
"tier_rules": {
"type": "NO_REQUIREMENTS"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 30,
"card_definition_id": "lcdef_1329efb2af8ba6486f"
}
}
]
},
{
"id": "lernei_134cd9949f093ff081",
"name": "New earning 01",
"rules": {
"1": {
"name": "order.items.any",
"conditions": {
"$is": [
{
"id": "prod_12b4cecb4fd5a6402f",
"type": "products_or_skus",
"object": "product",
"source_id": "refreshing_soda"
}
]
}
},
"logic": "1"
},
"tier_rules": {
"type": "ANY_OF",
"any_of": [
{
"tier_structure_id": "lts_12afe9ef956906b3b7",
"tier_ids": [
"lt_12afe9efd24e603ac0"
]
}
]
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 300,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
]
},
{
"id": "lernei_134cd9949f093ff082",
"name": "New earning 02",
"tier_rules": {
"type": "NO_REQUIREMENTS"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 100,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
]
}
],
"trigger": {
"event": "customer.order.paid"
},
"validity_hours": {
"type": "ANY_TIME"
},
"start_date": null,
"end_date": "2026-12-31T00:00:00.000Z",
"trigger_limits": {
"cooldown": {
"type": "NO_COOLDOWN"
},
"frequency": {
"type": "NO_LIMIT",
"limits": []
}
},
"earning_limits": {
"global": {
"type": "NO_LIMIT",
"limits": []
}
},
"metadata": {
"temporary_earning_rule": true
},
"created_at": "2026-10-22T11:30:54.857Z",
"updated_at": "2026-11-05T16:07:05.583Z",
"object": "earning_rule"
}Update earning rule
Updates an earning rule. Each field is optional, and the body must include at least one field. status cannot be changed here. Use Activate earning rule, Deactivate earning rule, or Move earning rule to draft. Sending status returns 400.
When the earning rule is ACTIVE or INACTIVE, only name, earnings, error, validity_hours, start_date, end_date, trigger_limits, earning_limits, and metadata can change. A DRAFT rule can also change trigger.
earnings replaces the earning list. An item whose id matches a stored lernei_ id replaces that item. An omitted id, or an id that is not on this rule, creates an item and the server assigns the ID. Items left out of the array are removed. On an ACTIVE rule, the earnings that will be stored are checked for inactive or unassigned related resources and can return 423.
A successful call records vl.earning_rule.updated.
curl --request PUT \
--url https://{cluster}.voucherify.io/v2/loyalties/earning-rules/{earningRuleId} \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"name": "Updated earning rule",
"earnings": [
{
"id": "lernei_133a941c42006594cd",
"name": "Existing earning 01",
"rules": {
"1": {
"name": "customer.segment",
"conditions": {
"$is": [
"seg_AOmoT5hwNqBl7tJsHh26CBUH"
]
}
},
"logic": "1"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 30,
"card_definition_id": "lcdef_1329efb2af8ba6486f"
}
}
],
"tier_rules": {
"type": "NO_REQUIREMENTS"
}
},
{
"name": "New earning 01",
"rules": {
"1": {
"name": "order.items.any",
"conditions": {
"$is": [
{
"id": "prod_12b4cecb4fd5a6402f",
"type": "products_or_skus",
"object": "product",
"source_id": "refreshing_soda"
}
]
}
},
"logic": "1"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 300,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
],
"tier_rules": {
"type": "ANY_OF",
"any_of": [
{
"tier_ids": [
"lt_12afe9efd24e603ac0"
],
"tier_structure_id": "lts_12afe9ef956906b3b7"
}
]
}
},
{
"name": "New earning 02",
"effects": [
{
"type": "POINTS",
"points": {
"value": 100,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
]
}
],
"trigger": {
"event": "customer.order.paid"
},
"validity_hours": {
"type": "ANY_TIME"
},
"end_date": "2026-12-31T00:00:00.000Z",
"earning_limits": {
"global": {
"type": "NO_LIMIT",
"limits": []
}
},
"metadata": {
"temporary_earning_rule": true
}
}
'{
"id": "lern_133a941c44c06594cf",
"name": "Updated earning rule",
"status": "DRAFT",
"earnings": [
{
"id": "lernei_133a941c42006594cd",
"name": "Existing earning 01",
"rules": {
"1": {
"name": "customer.segment",
"conditions": {
"$is": [
"seg_AOmoT5hwNqBl7tJsHh26CBUH"
]
}
},
"logic": "1"
},
"tier_rules": {
"type": "NO_REQUIREMENTS"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 30,
"card_definition_id": "lcdef_1329efb2af8ba6486f"
}
}
]
},
{
"id": "lernei_134cd9949f093ff081",
"name": "New earning 01",
"rules": {
"1": {
"name": "order.items.any",
"conditions": {
"$is": [
{
"id": "prod_12b4cecb4fd5a6402f",
"type": "products_or_skus",
"object": "product",
"source_id": "refreshing_soda"
}
]
}
},
"logic": "1"
},
"tier_rules": {
"type": "ANY_OF",
"any_of": [
{
"tier_structure_id": "lts_12afe9ef956906b3b7",
"tier_ids": [
"lt_12afe9efd24e603ac0"
]
}
]
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 300,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
]
},
{
"id": "lernei_134cd9949f093ff082",
"name": "New earning 02",
"tier_rules": {
"type": "NO_REQUIREMENTS"
},
"effects": [
{
"type": "POINTS",
"points": {
"value": 100,
"card_definition_id": "lcdef_1331564fab0b1ce713"
}
}
]
}
],
"trigger": {
"event": "customer.order.paid"
},
"validity_hours": {
"type": "ANY_TIME"
},
"start_date": null,
"end_date": "2026-12-31T00:00:00.000Z",
"trigger_limits": {
"cooldown": {
"type": "NO_COOLDOWN"
},
"frequency": {
"type": "NO_LIMIT",
"limits": []
}
},
"earning_limits": {
"global": {
"type": "NO_LIMIT",
"limits": []
}
},
"metadata": {
"temporary_earning_rule": true
},
"created_at": "2026-10-22T11:30:54.857Z",
"updated_at": "2026-11-05T16:07:05.583Z",
"object": "earning_rule"
}Authorizations
Path Parameters
Identifies the earning rule. Format lern_[a-f0-9]+.
^lern_[a-f0-9]+$Body
Request body schema for PUT /v2/loyalties/earning-rules/{earningRuleId}.
Default error returned when rule validation fails. On create, omit the field or set it to null to store no error. On update, omit the field or set it to null to keep the stored error. The response omits error when none is stored.
Show child attributes
Show child attributes
Sets the date-time from which the rule is active. A calendar date (YYYY-MM-DD) is accepted and stored as midnight UTC. Set to null to clear the start. start_date must be earlier than end_date. On update, an omitted date keeps the stored value and is included in that comparison.
Sets the date-time until which the rule is active. A calendar date (YYYY-MM-DD) is accepted and stored as midnight UTC. Set to null to clear the end. On update, an omitted date keeps the stored value.
Arbitrary key-value metadata. The response always returns an object. On create, omit the field or set it to null to store {}. On update, omit the field to keep stored keys, set null to clear them, or send an object to merge those keys into the stored object.
Sets the earning rule name.
1 - 200Event that triggers the earning rule. Depending on event, either custom_event or segment is required and the other trigger contexts must be null/absent.
Show child attributes
Show child attributes
Replaces the earning list. An item whose id matches a stored lernei_ id replaces that item. An omitted id, or an id that is not on this rule, creates an item and the server assigns the id. Items left out of the array are removed. At least one item.
1Show child attributes
Show child attributes
Sets the hours during which the rule is active. Omit the field or set it to null to keep the stored value. The response always returns validity_hours.
Show child attributes
Show child attributes
Sets the cooldown and frequency limits for the trigger. Omit the field or set it to null to keep the stored value. The response always returns trigger_limits.
Show child attributes
Show child attributes
Sets how many points this rule can award. Omit the field or set it to null to keep the stored value. The response always returns earning_limits.
Show child attributes
Show child attributes
Response
Updated earning rule
Response body schema for PUT /v2/loyalties/earning-rules/{earningRuleId}.
Earning rule ID (lern_...).
^lern_[a-f0-9]+$Earning rule name.
200Current status. DELETED also exists internally but deleted rules are excluded from API reads.
DRAFT, ACTIVE, INACTIVE Earning definitions of the rule. Contains at least one earning.
1Show child attributes
Show child attributes
Event that triggers the earning rule. Depending on event, either custom_event or segment is required and the other trigger contexts must be null/absent.
Show child attributes
Show child attributes
Validity hours. Always present; defaults to { "type": "ANY_TIME" }.
Show child attributes
Show child attributes
Date-time from which the rule is active. Can be null.
Date-time until which the rule is active. Can be null.
Cooldown and frequency limits. Always present. cooldown and frequency are always objects. frequency.limits is always an array and is empty when frequency.type is NO_LIMIT.
Show child attributes
Show child attributes
Limits how many points this rule can award. Always present. Defaults to no global limit (global.type NO_LIMIT and global.limits []).
Show child attributes
Show child attributes
Arbitrary key-value metadata. Always present (empty object when unset).
Creation timestamp (ISO 8601).
Last update timestamp (ISO 8601). null when never updated.
Object type marker. Always earning_rule.
"earning_rule"Default error configuration. Absent when not configured.
Show child attributes
Show child attributes

