Skip to main content
PUT
Update earning rule

Authorizations

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

Path Parameters

earningRuleId
string
required

Earning rule ID.

Pattern: ^lern_[a-f0-9]+$

Body

application/json

Request body schema for PUT /v2/loyalties/earning-rules/{earningRuleId}.

error
Custom error message configuration · object | null

Default error returned when rule validation fails. Can be null.

start_date
string<date-time> | null

Date-time from which the rule is active. Can be null.

end_date
string<date-time> | null

Date-time until which the rule is active. Can be null.

metadata
object | null

Arbitrary key-value metadata. Can be null.

name
string

Earning rule name.

Required string length: 1 - 200
trigger
object

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.

earnings
object[]

Earning definitions. Items with an id update existing earning items; items without an id are created. Omitted existing items are removed.

Minimum array length: 1
validity_hours
object | null

Hours during which the rule is active. Can be null.

trigger_limits
object | null

Cooldown and frequency limits for the trigger. Can be null.

Response

Updated earning rule

Response body schema for PUT /v2/loyalties/earning-rules/{earningRuleId}.

id
string
required

Earning rule ID (lern_...).

Pattern: ^lern_[a-f0-9]+$
name
string
required

Earning rule name.

Maximum string length: 200
status
enum<string>
required

Current status. DELETED also exists internally but deleted rules are excluded from API reads.

Available options:
DRAFT,
ACTIVE,
INACTIVE
earnings
object[]
required

Earning definitions of the rule. Contains at least one earning.

Minimum array length: 1
trigger
object
required

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.

validity_hours
object
required

Validity hours. Always present; defaults to { "type": "ANY_TIME" }.

start_date
string<date-time> | null
required

Date-time from which the rule is active. Can be null.

end_date
string<date-time> | null
required

Date-time until which the rule is active. Can be null.

trigger_limits
object
required

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.

earning_limits
object
required

Limits how many points this rule can award. Always present. Defaults to no global limit (global.type NO_LIMIT and global.limits []).

metadata
object
required

Arbitrary key-value metadata. Always present (empty object when unset).

created_at
string<date-time>
required

Creation timestamp (ISO 8601).

updated_at
string<date-time> | null
required

Last update timestamp (ISO 8601). null when never updated.

object
string
required

Object type marker. Always earning_rule.

Allowed value: "earning_rule"
error
Custom error message configuration · object

Default error configuration. Absent when not configured.