Rules
Apply an atomic rule-configuration change set
Apply the changes from one preview together, increasing rule_configuration_version by one.
post/v1/programs/{program_id}/rule-configuration/apply
Request
- Base URL: https://api.scrip.dev
- URL: https://api.scrip.dev/v1/programs/{program_id}/rule-configuration/apply
- Auth: HTTP bearer
Path parameters
program_idstring uuid required
The program's id.
Headers
Idempotency-Keystring
A key you choose to make this request safe to retry: 1 to 255 printable ASCII characters. Send the same key with the same request to get the first response again, marked Idempotent-Replayed: true. Routes that return a secret once, and claim links, do not replay a response. Event ingest uses the key as the event's identity.
Request body
Example request
{
"preview_token": "ahSToYq-OEn3S2Q1-qOP7iebMf_xahN0KciKUSygcKs",
"request_hash": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b"
}Response
The rule configuration after the change
Example response
{
"rule_configuration": {
"program_id": "8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01",
"rule_configuration_version": 4,
"rule_sets": [
{
"rule_set": {
"created_at": "2027-01-15T10:30:00Z",
"id": "d4735e3a-265e-4f16-b1a5-4c8e9d6f0a04",
"key": "holiday-promo",
"name": "Holiday Promotion",
"order": 1,
"program_id": "8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01",
"rule_configuration_version": 4,
"updated_at": "2027-01-15T10:30:00Z"
},
"rules": [
{
"actions": [
{
"amount": "${{ event.amount * 10 }}",
"asset_id": "a3bb189e-8bf9-4c8b-9be0-6b5d2f4e7a02",
"type": "CREDIT"
}
],
"active_from": "2027-01-01T00:00:00Z",
"active_to": "2027-12-31T23:59:59Z",
"budgets": [
{
"asset_id": "a3bb189e-8bf9-4c8b-9be0-6b5d2f4e7a02",
"consumed": "4500.00",
"cron_expression": "0 0 1 * *",
"interval": "720h",
"limit": "10000.00",
"next_reset_at": "2027-12-31T23:59:59Z",
"schedule_type": "CRON",
"scope": "PROGRAM"
}
],
"condition": "event.type == 'purchase' && event.amount > 0",
"created_at": "2027-01-15T10:30:00Z",
"deleted_at": "2027-01-15T10:30:00Z",
"description": "Awards 10 points per dollar spent",
"id": "c9f0f895-fb98-4b39-9f86-1e5a0d3e2b03",
"name": "Purchase Reward",
"order": 1,
"program_id": "8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01",
"rule_configuration_version": 4,
"rule_set_id": "d4735e3a-265e-4f16-b1a5-4c8e9d6f0a04",
"status": "ACTIVE",
"updated_at": "2027-01-15T10:30:00Z",
"warnings": [
{
"code": "unknown_state_key",
"key": "purchaseCnt",
"kind": "counter",
"message": "unknown counter \"purchaseCnt\" on participant: no rule in this program writes it; did you mean \"purchase_count\"?",
"scope": "participant",
"suggestion": "purchase_count"
}
]
}
]
}
]
}
}Changes
No recorded changes to this operation across all 1 revision of this API.