Skip to main content
PUT
/
v1
/
loyalties
/
{campaignId}
/
earning-rules
/
{earningRuleId}
Update Earning Rule
curl --request PUT \
  --url https://{cluster}.voucherify.io/v1/loyalties/{campaignId}/earning-rules/{earningRuleId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '{
  "validation_rule_id": "val_7SxpdhPeBngA",
  "loyalty": {
    "type": "FIXED",
    "points": "5"
  },
  "source": {
    "banner": "Order paid 5 points."
  },
  "active": true,
  "start_date": "2022-11-02T13:00:00.000Z",
  "expiration_date": "2023-03-03T14:30:00.000Z",
  "validity_timeframe": {
    "duration": "PT1H",
    "interval": "P1D"
  },
  "validity_day_of_week": [
    0,
    1,
    2,
    3,
    4,
    5
  ],
  "metadata": {
    "Type": "Order paid - fixed amount of points"
  }
}'
{
  "id": "ern_63g6NQgtepfXn2z0QbT2ksLf",
  "created_at": "2022-11-29T11:10:46.523Z",
  "updated_at": "2022-11-29T11:30:57.652Z",
  "validation_rule_id": "val_7SxpdhPeBngA",
  "loyalty": {
    "points": 5,
    "type": "FIXED"
  },
  "event": "order.paid",
  "source": {
    "banner": "Order paid 5 points.",
    "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N",
    "object_type": "campaign"
  },
  "active": true,
  "start_date": "2022-11-02T13:00:00.000Z",
  "expiration_date": "2023-03-03T14:30:00.000Z",
  "validity_timeframe": {
    "duration": "PT1H",
    "interval": "P1D"
  },
  "validity_day_of_week": [
    0,
    1,
    2,
    3,
    4,
    5
  ],
  "object": "earning_rule",
  "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA",
  "metadata": {
    "Type": "Order paid - fixed amount of points"
  }
}

Authorizations

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

Path Parameters

campaignId
string
required
Example:
earningRuleId
string
required
Example:

Body

application/json
validation_rule_id
string
Example:
loyalty
object
  • Define fixed amount of points
  • Order Amount
  • Order Total Amount
  • Order Metadata
  • Order Items Quantity
  • Order Items Amount
  • Order Items Subtotal Amount
  • Define amount of points proportional to customer metadata
  • Earning Rule Proportional Custom Event
source
object
active
boolean
start_date
string<date-time>
Example:
expiration_date
string<date-time>
Example:
pending_points
object | null
expiration_rules
object
validity_timeframe
object
validity_day_of_week
enum<integer>[]
validity_hours
object
metadata
object

Response

200 - application/json
id
string
required
created_at
string<date-time>
required
loyalty
object
required
  • Define fixed amount of points
  • Order Amount
  • Order Total Amount
  • Order Metadata
  • Order Items Quantity
  • Order Items Amount
  • Order Items Subtotal Amount
  • Define amount of points proportional to customer metadata
  • Earning Rule Proportional Custom Event
source
object
required
object
enum<string>
default:earning_rule
required
Available options:
earning_rule
automation_id
string
required
metadata
object
required
validation_rule_id
string | null
required
updated_at
string<date-time> | null
required
active
boolean
required
event
string
Example:
custom_event
object
segment
object
loyalty_tier
object
pending_points
object
start_date
string
expiration_date
string
validity_timeframe
object
validity_day_of_week
enum<integer>[]
validity_hours
object
expiration_rules
object