Skip to main content
POST
/
v2
/
loyalties
/
examine
/
earning-rules
Examine earning rules
curl --request POST \
  --url {protocol}://{host}/v2/loyalties/examine/earning-rules \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-App-Id: <api-key>' \
  --header 'X-App-Token: <api-key>' \
  --data '
{
  "trigger": {
    "specific": {}
  },
  "customer_identification": {
    "customer_id": "<string>",
    "customer_source_id": "<string>",
    "member_id": "<string>"
  },
  "customer_order_paid": {
    "customer": {
      "metadata": {}
    },
    "member": {
      "metadata": {}
    },
    "order": {
      "amount": "<string>",
      "initial_amount": "<string>",
      "discount_amount": "<string>",
      "items": [
        {
          "id": "<string>",
          "source_id": "<string>",
          "product_id": "<string>",
          "sku_id": "<string>",
          "amount": "<string>",
          "discount_amount": "<string>",
          "quantity": "<string>",
          "price": "<string>",
          "product": {
            "id": "<string>",
            "source_id": "<string>",
            "price": "<string>"
          },
          "sku": {
            "id": "<string>",
            "source_id": "<string>",
            "price": "<string>"
          },
          "metadata": {}
        }
      ],
      "metadata": {}
    }
  },
  "customer_segment_entered": {
    "customer": {
      "metadata": {}
    },
    "member": {
      "metadata": {}
    }
  }
}
'
{
  "event": "<string>",
  "customer": {
    "id": "<string>",
    "source_id": "<string>",
    "metadata": {},
    "object": "<string>"
  },
  "earning_rules": [
    {
      "id": "<string>",
      "name": "<string>",
      "metadata": {},
      "object": "<string>"
    }
  ],
  "memberships": [
    {
      "member": {
        "id": "<string>",
        "customer_id": "<string>",
        "program_id": "<string>",
        "metadata": {},
        "object": "<string>"
      },
      "program": {
        "id": "<string>",
        "name": "<string>",
        "metadata": {},
        "object": "<string>"
      },
      "cards": [
        {
          "card": {
            "id": "<string>",
            "card_definition_id": "<string>",
            "card_type": "INDIVIDUAL",
            "code": "<string>",
            "object": "<string>"
          },
          "points_estimation": 123,
          "earning_rules": [
            {
              "earning_rule": {
                "id": "<string>",
                "object": "<string>"
              },
              "points_estimation": 123,
              "object": "<string>"
            }
          ],
          "object": "<string>"
        }
      ],
      "benefits": [
        {
          "benefit": {
            "id": "<string>",
            "name": "<string>",
            "object": "<string>"
          },
          "earning_rules": [
            {
              "earning_rule": {
                "id": "<string>",
                "object": "<string>"
              },
              "object": "<string>"
            }
          ],
          "object": "<string>"
        }
      ],
      "object": "<string>"
    }
  ],
  "object": "<string>"
}
{
  "code": 123,
  "key": "<string>",
  "message": "<string>",
  "details": "<string>",
  "request_id": "<string>"
}
{
  "code": 123,
  "key": "<string>",
  "message": "<string>",
  "details": "<string>",
  "request_id": "<string>"
}
{
  "code": 123,
  "key": "<string>",
  "message": "<string>",
  "details": "<string>",
  "request_id": "<string>"
}
{
  "code": 123,
  "key": "<string>",
  "message": "<string>",
  "details": "<string>",
  "request_id": "<string>"
}

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 examining earning rules. When trigger.type is SPECIFIC, the context object matching the specific event is required and the other context objects must not be present: customer.order.paid -> customer_order_paid, customer.segment.entered -> customer_segment_entered, customer.custom_event -> customer_custom_event.

trigger
object
required

Which trigger events to examine. With ALL, all trigger events are examined and specific must be null/absent. With SPECIFIC, specific is required.

customer_identification
object
required

How the examined customer is identified. Depending on type, exactly one of customer_id, customer_source_id or member_id is required; the other two must not be present.

customer_order_paid
object

Context for examining customer.order.paid earning rules.

customer_segment_entered
object

Context for examining customer.segment.entered earning rules.

customer_custom_event
object

Context for examining customer.custom_event earning rules. With type = ALL, all is required and specific must be null/absent. With SPECIFIC, specific is required and all must be null/absent.

Response

Earning rules examination result

Earning rules examination result.

event
string

Examined trigger event (e.g. customer.order.paid, customer.segment.entered, customer.custom_event).

customer
object

Customer reference in examine results.

earning_rules
object[]

All earning rules that matched during examination (deduplicated).

memberships
object[]

Earning opportunities per program membership.

object
string

Object type marker. Always earnings_examine_result.

Allowed value: "earnings_examine_result"
Last modified on July 9, 2026