program_id when adjusting), but the group itself can participate across programs.
Creating a group
201 Created with the group:
In a request body,
participant_id is the participant’s Scrip id, a UUID. Bodies do not accept ext:. To find the id for an external_id, read GET /v1/participants/ext:user_123. Paths are different: a {participant_id} in a group path accepts ext: plus an external_id, like every participant path.
Membership
Adding members
200 with {"message": "Member(s) added to group"}. To add one participant, you can send participant_id and role at the top level instead of members.
A participant who left the group can be added again. Adding an active member again also returns 200.
To change only a member’s role, use Update group member role with
{"role": "ADMIN"} or {"role": "MEMBER"}. A CLOSED participant’s role cannot change.
List members with GET /v1/groups/{group_id}/members. Each entry has participant_id, external_id, role, status, and joined_at. To go the other way, GET /v1/groups?participant_id={participant_id} lists the groups one participant is an active member of, most recently joined first. Each group then carries the participant’s role and joined_at, the group’s member_count, and its balances. The list’s search and include_archived still apply. sort_by and sort_dir return 400 with participant_id.
Removing members
204 with no body. The member’s status becomes LEFT and the record stays, with a left_at time. Add include_former=true when you list members to see former members. Removing a member does not move or change any of the group’s balance.
Roles
Scrip stores each member’s role but does not check roles on any request. Your application decides what each role may do, such as who may spend the group’s balance.
Removing a group’s last
ADMIN, or changing their role to MEMBER with PATCH, returns 409 with code last_admin_cannot_be_removed. Make another member an ADMIN first. Suspending or closing a participant who is the last active ADMIN of a group with other members returns 409 last_admin_status_change_forbidden; see Update a participant for the force option.
Group balances
Adjust a group’s balance directly with a balance operation of typeADJUST:
200 with the journal_entry_id that records the adjustment.
Group balances use the same three-bucket model as participants. GET /v1/groups/{group_id}/balances returns one entry per asset in data, each with asset_id, available, held, and deferred. Add program_id to list only the assets linked to that program. Each amount is still the group’s whole balance in that asset, not the part earned in that program.
The same endpoint takes HOLD, RELEASE, and FORFEIT, with the same fields as on a participant; see Balance operations. Groups take no VOID_PENDING or MATURE.
Spend a group balance
A group cannot redeem. Redemptions belong to participants. To spend from a group’s balance:
Transfers and balance operations do not check roles or membership.
Crediting groups from rules
Rules can credit a group’s balance instead of the participant’s by adding atarget to the action. This rule pools purchase points into a family group:
FAILED with none of its changes applied. See Failure is all-or-nothing.
The same targeting works for state actions. For example, tracking how many purchases the group has made:
Groups in CEL conditions
When a rule evaluates, thegroups variable contains a list of groups the participant belongs to. Each entry has:
groups is a list because a participant can belong to multiple groups. Prefer groups.exists(g, ...) over assuming a specific list position.Group state
Groups hold tags, counters, and attributes, the same way participants do. A group can also hold tier levels, set by aSET_TIER action with a group target; see Tiers for how a group moves up. Rules read a group’s tiers from the tiers field of each groups entry, as in groups.exists(g, g.tiers.loyalty.level == "gold"). GET /v1/groups/{group_id} does not include tiers. A group’s tier changes appear in its state history, GET /v1/groups/{group_id}/activity/state-history?state_type=TIER.
Change group state with one PATCH, the same way as for a participant:
tags replaces the whole tag list, attributes is a merge patch where null removes a key, and each counter takes {"increment": n}, {"set": n}, {"reset_after": "30d"}, {"reset_period": {"type": "MONTH"}}, or null to remove it. Scrip applies every change in the request together or none of them. The response is 200 with the group and its updated state. tags, attributes, counters, and counter_settings are always on GET /v1/groups/{group_id}. See State management.
Group state is available in CEL via the groups variable and can be updated from rule actions using "target": {"type": "GROUP", "id": "0b9e7d3c-5a41-4f68-a2c7-81e4d6b3f907"}.
Archiving groups
include_archived=true is set. A rename, state change, or member change on an archived group returns 400. A balance adjust, hold, release, or forfeit returns 422 archived_resource. Restore the group with {"status": "ACTIVE"}; that request can change its other fields at the same time.
Transfers
Move value from a group to a member.
Ledger
How group balances are recorded.
Balance operations
Hold, release, and forfeit request bodies.