Skip to main content
POST
Create earning rule

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

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
object | null

Default error returned when rule validation fails. Nullable.

validity_hours
object | null

Hours during which the rule is active. Defaults to { "type": "ANY_TIME" } when omitted. Nullable.

start_date
string<date-time> | null

Date-time from which the rule is active. Nullable.

end_date
string<date-time> | null

Date-time until which the rule is active. Nullable.

metadata
object | null

Arbitrary key-value metadata. Nullable.

trigger_limits
object | null

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

Response

Earning rule created

Earning rule as returned by the API.

id
string

Earning rule ID (lern_...).

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

Earning rule name.

Maximum string length: 200
status
enum<string>

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

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

Earning definitions of the rule.

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.

error
object | null

Default error configuration. Absent when not configured.

validity_hours
object

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

start_date
string<date-time> | null

Date-time from which the rule is active. Nullable.

end_date
string<date-time> | null

Date-time until which the rule is active. Nullable.

trigger_limits
object | null

Cooldown and frequency limits. In responses, frequency.limits is always an array (empty for NO_LIMIT).

metadata
object

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

created_at
string<date-time>

Creation timestamp (ISO 8601).

updated_at
string<date-time> | null

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

object
string

Object type marker. Always earning_rule.

Allowed value: "earning_rule"
Last modified on July 27, 2026