Creating a program
A program only requires a name. You can set the enrollment policy and other options at creation or update them later.
The API returns
201 Created with the program:
id is the program_id you pass when sending events, creating rules, and querying balances. Scrip also creates an initial default rule set for the program, and rules that omit rule_set_id are assigned to it.
Enrollment
A participant who already exists in your organization is enrolled in a program automatically the first time an event for them reaches that program. Theon_unknown_participant setting controls what happens when an event arrives for a brand-new external_id:
Most programs use
CREATE for simplicity. Use REJECT when you need strict control over who can participate.
The program wallet
Every program has a wallet. How it’s used depends on the asset’s issuance policy:UNLIMITEDcredits create new value directly. The wallet is bypassed. This is what most programs use.PREFUNDEDcredits draw from the wallet. You fund it up front, and every credit to a participant debits the wallet. When the wallet is empty, credits fail. This is how you enforce a fixed budget.
PREFUNDED assets, you manage the wallet with fund and burn. This request funds a PREFUNDED asset with the symbol PROMO and scale: 2:
200 with the journal entry that recorded the funding and the wallet’s available balance after it:
PREFUNDED assets.
Linking assets
Assets exist at the organization level and must be linked to a program before rules in that program can issue them. You can link assets when creating the asset (program_id or program_ids), when creating the program (asset_ids), or afterward:
200 with the asset, where program_ids lists every program the asset is linked to:
Linking an asset to a program is permanent; there is no unlink endpoint.
Program state
Programs hold the same state types as participants: tags, counters, and attributes. Use program state for logic that is not tied to one participant, such as a bonus for only the first 1,000 claims. Rules write program state with an action whosetarget is {"type": "PROGRAM"} and read it in a condition as program.counter.<key> or program.tag.<name>. See State management for a complete example.
Program status
You can pause or retire a program by updating its status:Redemption settings
pending_redemption_ttl caps how long a pending redemption holds the participant’s points. redemption_target_type sets where redeemed value goes: SYSTEM_REDEMPTION by default, or a group or program wallet named by redemption_target_entity_id. See Pending redemptions and Redemption targets.
Automations
Programs can have automations that generate events on a schedule, at a specific time, or in response to participant state changes. Automations are scoped to a program and managed viaPOST /v1/programs/{program_id}/automations. See Automations for details.
Create an asset
Choose how the value participants earn is tracked and issued.
Add participants
Create participants and manage their status.