curl --request GET \
--url https://api.scrip.dev/v1/rules/{id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.scrip.dev/v1/rules/{id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.scrip.dev/v1/rules/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrip.dev/v1/rules/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scrip.dev/v1/rules/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrip.dev/v1/rules/{id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/rules/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"actions": [
{
"amount": "${{ event.amount * 10 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440002",
"type": "CREDIT"
}
],
"active_from": "2024-01-01T00:00:00Z",
"active_to": "2024-12-31T23:59:59Z",
"budgets": [
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"consumed": "4500.00",
"cron_expression": "0 0 1 * *",
"interval": "720h",
"limit": "10000.00",
"next_reset_at": "2026-03-01T00:00:00Z",
"schedule_type": "CRON",
"scope": "PROGRAM"
}
],
"condition": "event.type == 'purchase' && event.amount > 0",
"created_at": "2024-01-15T10:30:00Z",
"deleted_at": "2024-06-01T00:00:00Z",
"description": "Awards 10 points per dollar spent",
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Purchase Reward",
"order": 1,
"program_id": "550e8400-e29b-41d4-a716-446655440001",
"rule_configuration_version": 4,
"rule_set_id": "550e8400-e29b-41d4-a716-446655440002",
"status": "ACTIVE",
"stop_after_match": false,
"updated_at": "2024-01-15T10:30:00Z",
"warnings": [
{
"client_ref": "<string>",
"code": "unknown_state_key",
"key": "purchaseCnt",
"kind": "counter",
"message": "unknown counter \"purchaseCnt\" — no rule in this program writes it; did you mean \"purchase_count\"?",
"rule_id": "<string>",
"rule_set_id": "<string>",
"scope": "participant",
"suggestion": "purchase_count"
}
]
}{
"code": "bad_request",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Missing or invalid credentials"
}{
"code": "forbidden",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Insufficient permissions for this action"
}{
"code": "not_found",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource not found"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Get a rule
Retrieve a rule by ID.
curl --request GET \
--url https://api.scrip.dev/v1/rules/{id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.scrip.dev/v1/rules/{id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.scrip.dev/v1/rules/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrip.dev/v1/rules/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scrip.dev/v1/rules/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrip.dev/v1/rules/{id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/rules/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"actions": [
{
"amount": "${{ event.amount * 10 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440002",
"type": "CREDIT"
}
],
"active_from": "2024-01-01T00:00:00Z",
"active_to": "2024-12-31T23:59:59Z",
"budgets": [
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"consumed": "4500.00",
"cron_expression": "0 0 1 * *",
"interval": "720h",
"limit": "10000.00",
"next_reset_at": "2026-03-01T00:00:00Z",
"schedule_type": "CRON",
"scope": "PROGRAM"
}
],
"condition": "event.type == 'purchase' && event.amount > 0",
"created_at": "2024-01-15T10:30:00Z",
"deleted_at": "2024-06-01T00:00:00Z",
"description": "Awards 10 points per dollar spent",
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Purchase Reward",
"order": 1,
"program_id": "550e8400-e29b-41d4-a716-446655440001",
"rule_configuration_version": 4,
"rule_set_id": "550e8400-e29b-41d4-a716-446655440002",
"status": "ACTIVE",
"stop_after_match": false,
"updated_at": "2024-01-15T10:30:00Z",
"warnings": [
{
"client_ref": "<string>",
"code": "unknown_state_key",
"key": "purchaseCnt",
"kind": "counter",
"message": "unknown counter \"purchaseCnt\" — no rule in this program writes it; did you mean \"purchase_count\"?",
"rule_id": "<string>",
"rule_set_id": "<string>",
"scope": "participant",
"suggestion": "purchase_count"
}
]
}{
"code": "bad_request",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Missing or invalid credentials"
}{
"code": "forbidden",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Insufficient permissions for this action"
}{
"code": "not_found",
"details": {
"expected": "<string>",
"field": "<string>",
"fields": [
{
"expected": "<unknown>",
"field": "<string>",
"message": "This field is required",
"reason": "required",
"received": "<string>"
}
],
"reason": "invalid",
"received": "<string>"
},
"message": "Resource not found"
}{
"code": "internal_error",
"message": "An internal error occurred"
}rule_set_id, its position in that set (order), condition, actions, description, stop_after_match, time window settings, and status.
If the rule has budgets configured, each budget reports its scope. Program-wide (PROGRAM) budgets also report the consumed amount and, when scheduled, the next_reset_at timestamp. This is the primary way to check how much of a program-wide budget has been spent. Per-participant (PARTICIPANT) budgets omit both fields because usage differs for each participant. To reset a program-wide budget manually, use the reset budget endpoint.
Authorizations
API key passed in the X-API-Key header.
Path Parameters
Rule ID
Response
Rule details
Actions to execute when the condition matches
[
{
"amount": "${{ event.amount * 10 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440002",
"type": "CREDIT"
}
]
Start of the rule's active window (RFC 3339, null if always active). Checked against the event's event_timestamp, inclusive.
"2024-01-01T00:00:00Z"
End of the rule's active window (RFC 3339, null if no end date). Checked against the event's event_timestamp, exclusive.
"2024-12-31T23:59:59Z"
Budget constraints applied to this rule
Show child attributes
Show child attributes
CEL expression that determines when the rule fires
"event.type == 'purchase' && event.amount > 0"
When this rule was created (RFC 3339)
"2024-01-15T10:30:00Z"
When this rule was archived (null if not archived)
"2024-06-01T00:00:00Z"
Human-readable summary of what this rule does
"Awards 10 points per dollar spent"
Unique identifier for this rule
"550e8400-e29b-41d4-a716-446655440000"
Display name
"Purchase Reward"
Evaluation position within the containing rule set (lower = first; ACTIVE and SUSPENDED rules occupy unique positions)
1
Program this rule belongs to
"550e8400-e29b-41d4-a716-446655440001"
Resulting program rule-configuration revision. Present on mutation responses.
4
Rule set that contains this rule and scopes its order and stop_after_match behavior
"550e8400-e29b-41d4-a716-446655440002"
Lifecycle status: ACTIVE, SUSPENDED, or ARCHIVED
"ACTIVE"
When true, no subsequent rules in this set evaluate after this one matches; other sets continue
false
When this rule was last modified (RFC 3339)
"2024-01-15T10:30:00Z"
Non-blocking advisories about the rule's condition or action expressions, such as unknown state-key typos or deprecated CEL aliases. Present on create/update only; never blocks the save.
Show child attributes
Show child attributes