> ## Documentation Index
> Fetch the complete documentation index at: https://developers.mageloyalty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Earning rule object

> The earning rule object defines how customers earn points.

Earning rules define the actions customers can take to earn points. Rules are categorized by type — purchase, social, engagement, birthday, anniversary, etc.

## Attributes

| Field                   | Type           | Description                                                                                              |
| ----------------------- | -------------- | -------------------------------------------------------------------------------------------------------- |
| `name`                  | string         | Rule display name                                                                                        |
| `description`           | string \| null | Optional description                                                                                     |
| `action`                | string         | The action type (e.g. `purchase`, `follow_on_instagram`, `signup`, `birthday`)                           |
| `category`              | string         | Rule category: `purchase`, `social`, `engagement`, `birthday`, `anniversary`, `signup`, `referral`       |
| `is_active`             | boolean        | Whether the rule is currently active                                                                     |
| `points_to_give`        | integer        | Base points awarded when the rule is completed                                                           |
| `customer_facing_label` | string \| null | Label shown to customers (e.g. "Earn 10 points per £1 spent")                                            |
| `call_to_action_url`    | string \| null | URL for the action (e.g. Instagram profile link)                                                         |
| `created_at`            | string         | ISO 8601 timestamp                                                                                       |
| `updated_at`            | string         | ISO 8601 timestamp                                                                                       |
| `points`                | integer        | Final points awarded, pre-calculated with any applicable VIP tier and bonus campaign multipliers applied |
| `base_points`           | integer        | The rule's base points before any multipliers                                                            |
| `tier_boost`            | number \| null | The VIP tier multiplier applied to `points`, or `null` when no tier boost applies                        |
| `campaign_boost`        | number \| null | The bonus campaign multiplier applied to `points`, or `null` when no active campaign boosts this rule    |

<Note>
  `points` is pre-calculated: it reflects `base_points` with the VIP tier and bonus campaign multipliers already applied where they qualify. Tier boosts only appear when a customer identifier is supplied (see [List earning rules](/api-reference/earning-rules/list)).
</Note>

## Example

```json theme={null}
{
  "type": "earning_rule",
  "id": "rule_abc",
  "attributes": {
    "name": "Points for purchase",
    "description": null,
    "action": "purchase",
    "category": "purchase",
    "is_active": true,
    "points_to_give": 10,
    "customer_facing_label": "Earn 10 points per £1 spent",
    "call_to_action_url": null,
    "created_at": "2024-01-01T00:00:00.000Z",
    "updated_at": "2024-01-01T00:00:00.000Z",
    "points": 10,
    "base_points": 10,
    "tier_boost": null,
    "campaign_boost": null
  }
}
```
