Skip to main content
POST
Create earning rule

Authorizations

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

Body

application/json

Request body for creating an earning rule.

name
string
required

Earning rule name.

Required string length: 1 - 200
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.

earnings
object[]
required

Earning definitions (rules and effects) evaluated when the trigger fires.

Minimum array length: 1
status
enum<string>

Initial status. Only DRAFT and ACTIVE are allowed at creation. Defaults to DRAFT.

Available options:
DRAFT,
ACTIVE
error
Custom error message configuration · object | null

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

validity_hours
object | null

Hours during which the rule is active. Defaults to { "type": "ANY_TIME" } when omitted. 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.

trigger_limits
object | null

Cooldown and frequency limits for the trigger. Defaults to { "cooldown": { "type": "NO_COOLDOWN" }, "frequency": { "type": "NO_LIMIT" } } when omitted. Can be null.

Response

Earning rule created

Earning rule as returned by the API.

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.

Last modified on October 13, 2026