Loyalty history

POST /loyalty-history

Write a member's loyalty history from the platform you are leaving: earns, spends and adjustments, each filed under the time it happened. Rolling tier windows and monthly activity then see real history instead of starting from zero. Entries may arrive in any order and may predate the member joining; the balance and every entry's running total are put back in order before the call returns. Sending an externalId again writes nothing a second time. A member who already has an opening balance from a member import has it reduced by what the history explains, so nothing is counted twice.

Requires the loyalty:write permission.

Costs 10 rate limit tokens instead of the usual one. See Rate limits.

Body Parameters

dataobjectrequired

The member's history to write.

Request
curl \
  -X POST \
  "https://api.cascade.dev/loyalty-history" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "customerEmail": "[email protected]",
    "loyaltyProgramId": "550e8400-e29b-41d4-a716-446655440000",
    "entries": [
      {
        "externalId": "...",
        "occurredAt": "...",
        "amount": "...",
        "kind": "...",
        "reason": "..."
      }
    ]
  }
}'
Response
{
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "loyaltyProgramId": "550e8400-e29b-41d4-a716-446655440000",
  "loyaltyMembershipId": "550e8400-e29b-41d4-a716-446655440000",
  "createdCount": 0,
  "duplicateCount": 0,
  "balance": 0,
  "loyaltyTierId": "550e8400-e29b-41d4-a716-446655440000",
  "openingAdjustment": {
    "status": "none",
    "amount": 0
  },
  "entries": [
    {
      "externalId": "string",
      "status": "created",
      "loyaltyTransactionId": "550e8400-e29b-41d4-a716-446655440000",
      "occurredAt": "2025-01-15T09:30:00Z",
      "amount": 0,
      "balanceAfter": 0
    }
  ]
}