Skip to main content
Build a purchase reward program for a fictional company, Acme Rewards. You create a program and an asset, add a rule, send one event, and read the participant’s balance. It takes about 15 minutes. Already have a program and an asset? Use their ids and start at step 3.
Run this quickstart in the sandbox using the sandbox base URL (https://api-sandbox.scrip.dev) and an sk_test_ API key so you don’t modify live production data.

1. Set up your environment

If you don’t have a Scrip account yet, request access. Select Sandbox in the dashboard’s environment menu, then open Developers > API keys to create a sandbox key (sk_test_...). Set the sandbox base URL and your key as environment variables in your terminal:
In the examples below, each curl tab is a standalone command using the IDs from the sample responses (replace them with the IDs returned by your own requests). The Node and Python tabs build a single script from top to bottom that passes the IDs automatically, starting with this helper:

2. Create a program and an asset

A program is the container for your reward logic. An asset is the unit of value you track, such as points or credits. Create the program first:
The API returns 201 Created:
Save the returned id as your program_id. Now create a points asset and link it to the program:
This asset uses whole points (scale: 0), a single running balance (SIMPLE), and unlimited issuance (UNLIMITED). Save the returned id as your asset_id. (See Asset configuration for expiring lots or prefunded budgets.)

3. Define a rule

Rules tell Scrip when to give out points. This rule gives 10 points for every event whose type is "purchase":
The condition is a CEL expression. In CEL, event.type reads the top-level event_type field, and event.<field> reads keys from event_data. Here amount is a static "10", or you can wrap a CEL expression in ${{ }} to calculate an amount from the event (like "amount": "${{ event.amount * 0.1 }}" for 10% back). Because rule_set_id is omitted, Scrip places the rule in the program’s default rule set.

4. Send an event

Send a purchase event for a user (external_id: "user_123"). You don’t need to create the participant ahead of time: Scrip creates and enrolls them automatically when their first event arrives.
The API returns 202 Accepted with a Location header that points at the event:
202 Accepted means Scrip received the event and queued it for rule evaluation. Pass a unique idempotency_key (such as an order ID) for each event so that retrying a request never credits a user twice.

5. Verify it processed

Because events process in the background, wait for the event.completed webhook or poll GET /v1/events/{event_id} until status is COMPLETED or FAILED:
A finished event looks like this:
The rule_evaluations list shows which rules matched:

6. Check the balance

Read the participant’s balances. The ext: prefix tells Scrip to look the participant up by your external_id, so you do not need Scrip’s id:
The 10 points are in available. held and deferred come into play with holds, pending rewards, and vesting. The rule matched the purchase event, credited the participant, and recorded the movement in the ledger.

Next steps

  • Common patterns: complete rules for category multipliers, sign-up bonuses, streaks, referrals, milestones, and refunds.
  • Writing rules: use CEL to build logic such as double points for VIPs.
  • Rule sets: group rules and control execution order across tracking, earning, and maintenance logic.
  • State management: use counters and tags to track progress over time.
  • Redemptions: let users spend points on rewards.
  • Gift cards: let participants spend points on gift cards.
  • API conventions: errors, pagination, and idempotency across every endpoint.