Unidy Docs

Loyalty

Integrate seasonal points, membership, award ingestion and change notifications.

Loyalty tracks program participation separately from points and levels in each season. API v2 and Loyalty must be enabled on the instance. Obtain the program UUID and the required Loyalty read/write permissions from an administrator.

All routes below start with /api/v2/data/loyalty_programs/{program_id}. Program, season, level and user identifiers are UUIDs. Actions additionally have a readable action_key, which your integration uses when submitting activity.

Discover the catalogue and account

Method and suffixPurpose
GET /seasonsDiscover season UUIDs and date ranges.
GET /levelsRead level names and thresholds.
GET /actionsRead action keys, scoring, caps and availability.
GET /seasons/{season_id}/accounts/{user_id}Read participation, points, current/next level and progress.
GET /seasons/{season_id}/accounts/{user_id}/awardsRead the customer's activity history.

Use current instead of a season UUID to select the season covering the request time. Between seasons it returns 404 with no_season; it does not select the latest historical season.

Catalogue records include default name and translated name_t values. Revalidate cached catalogues with ETag and If-None-Match; a 304 has no replacement response body.

Account state includes nullable created_at and updated_at. Creation refers to the program account; update time reflects the later account or season-balance change. Both are null when no account exists. They are freshness indicators, not a complete event history.

Record participation

Send PATCH /accounts/{user_id}/membership:

json
{
  "payload": {
    "data": { "state": "joined" }
  }
}

Use this only after the agreed customer participation or consent flow.

Current stateAllowed transition
not_joinedjoined or declined
declinedjoined
joinedwithdrawn
withdrawnjoined

Repeating the current state is a no-op. Withdrawal stops earning and preserves history and used allowances. Rejoining sets a new join time; activity before that latest join is ineligible.

If configured and eligible, joining issues the loyalty_joined welcome award in the same commit. Its lifetime cap prevents repeat welcome points after rejoin or a new season. Integrators cannot submit that reserved action directly.

Submit verified activity

Verify the activity on your backend before submitting it. Send POST /accounts/{user_id}/awards with a stable Idempotency-Key header and this body:

json
{
  "payload": {
    "data": {
      "action_key": "quiz_completed",
      "occurred_at": "2026-10-25T09:30:00Z",
      "context": { "quiz_id": "quiz-42" }
    }
  }
}

The action key, occurrence time and any required context must match the configured action. The example timestamp is illustrative: submit the real occurrence within the program's reporting window.

A new award returns 201 with the accepted award and account state. Repeating the same key for the account and action source returns 409 conflict with idempotency_replay; it does not create another award or return a second 201.

Persist the key and original submission together. After a timeout, network failure, 429 or retryable server failure, retain the original key. A fresh key changes the request into another activity submission.

Response detailMeaning
idempotency_replayThat account/source key was already used. Reconcile the original submission and account/history.
cap_already_claimedThe action's earning allowance is exhausted.
membership_inactive, program_inactiveJoin/rejoin is required or the program is paused.
action_unavailableThe action is archived or outside its availability window.
outside_occurrence_window, no_seasonThe supplied occurrence is not eligible for scoring.
invalid_contextA grouping value is missing or invalid.
temporarily_unavailableA concurrent write held the account; retry after Retry-After with the same key.

Inspect both the top-level identifier and detail code. A different 409 is not proof that your original award succeeded.

Check availability

POST /accounts/{user_id}/availability accepts payload.data.items, with one to 50 action_key and optional context pairs. It reports whether activities can currently earn and their remaining allowances.

Availability is advisory; it reserves no points or allowance. Ingestion remains authoritative if configuration, time or another submission changes the result.

Daily, weekly, monthly and yearly caps use the program brand's timezone. Season changes reset allowances except ever, which spans seasons. A voided award retains its allowance claim; administrative deletion can free it. Do not use void/delete interchangeably.

Consume changes

Use a v2-signed registration; legacy registrations cannot subscribe to Loyalty events. The standard webhook delivery contract applies to:

  • loyalty_account.points_change
  • loyalty_account.level_change
  • loyalty_account.membership_change
  • loyalty_account.deleted
  • loyalty_season.started
  • loyalty_season.ended

Account events include change correlation and per-account sequencing. Deduplicate by event ID, retain sequence information for reconciliation, and tolerate delivery retries or reordering. A points change and its resulting level change can belong to one operation.

Brand-restricted callers can read an accessible global program, but writes to a global program require unrestricted brand access and the relevant global permission. A brand-only write role is insufficient.

Migrate the earlier route

The former /api/v2/loyalty/programs/{program_id} prefix remains a deprecated compatibility route. Move to /api/v2/data/loyalty_programs/{program_id}; responses on the old route provide Deprecation and a successor Link. No removal deadline is announced here.

Was this page helpful?