curl --request POST \
--url https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"expected_rule_configuration_version": 8
}
'import requests
url = "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview"
payload = { "expected_rule_configuration_version": 8 }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_rule_configuration_version: 8})
};
fetch('https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview', 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/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expected_rule_configuration_version' => 8
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview"
payload := strings.NewReader("{\n \"expected_rule_configuration_version\": 8\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expected_rule_configuration_version\": 8\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_rule_configuration_version\": 8\n}"
response = http.request(request)
puts response.read_body{
"base_rule_configuration_version": 123,
"change_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"diff": {
"rule_sets": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
],
"rules": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
]
},
"expires_at": "2023-11-07T05:31:56Z",
"local_references": {},
"preview_token": "<string>",
"proposed_rule_configuration": {
"base_rule_configuration_version": 123,
"program_id": "<string>",
"rule_sets": [
{
"client_ref": "<string>",
"existing": true,
"id": "<string>",
"key": "<string>",
"name": "<string>",
"order": 123,
"rules": [
{
"actions": [
{
"amount": "${{ event.amount * 0.03 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Purchase reward",
"expires_at": "365d",
"matures_at": "30d",
"type": "CREDIT"
}
],
"active_from": "2023-11-07T05:31:56Z",
"active_to": "2023-11-07T05:31:56Z",
"budgets": [
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"limit": "10000.00"
}
],
"client_ref": "<string>",
"condition": "<string>",
"description": "<string>",
"existing": true,
"id": "<string>",
"name": "<string>",
"order": 123,
"restore_archived": true,
"rule_set_id": "<string>",
"status": "<string>",
"stop_after_match": true
}
]
}
]
},
"request_hash": "<string>",
"source": {
"reference": "<string>",
"source_revision": 123,
"type": "<string>"
},
"warnings": [
{
"client_ref": "<string>",
"code": "<string>",
"key": "<string>",
"kind": "<string>",
"message": "<string>",
"rule_id": "<string>",
"rule_set_id": "<string>",
"scope": "<string>",
"suggestion": "<string>"
}
]
}{
"code": "bad_request",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Missing or invalid credentials"
}{
"code": "forbidden",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Insufficient permissions for this action"
}{
"code": "not_found",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource not found"
}{
"code": "rule_configuration_version_conflict",
"details": {
"current_rule_configuration_version": 4,
"expected_rule_configuration_version": 3,
"instruction": "Refetch the rule configuration and replan the mutation."
},
"message": "Rule configuration changed since this mutation was planned"
}{
"code": "unsupported_media_type",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Content-Type must be application/json"
}{
"code": "unprocessable",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Business rule violation"
}{
"code": "internal_error",
"message": "An internal error occurred"
}Preview a rule-configuration rollback
Reconstruct a historical revision, preserve stable identities, retain later-created sets empty with warnings, and return a normal short-lived atomic preview. Apply it through the standard rule-configuration apply endpoint.
curl --request POST \
--url https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"expected_rule_configuration_version": 8
}
'import requests
url = "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview"
payload = { "expected_rule_configuration_version": 8 }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_rule_configuration_version: 8})
};
fetch('https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview', 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/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expected_rule_configuration_version' => 8
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview"
payload := strings.NewReader("{\n \"expected_rule_configuration_version\": 8\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expected_rule_configuration_version\": 8\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrip.dev/v1/programs/{programId}/rule-configuration/revisions/{version}/rollback/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_rule_configuration_version\": 8\n}"
response = http.request(request)
puts response.read_body{
"base_rule_configuration_version": 123,
"change_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"diff": {
"rule_sets": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
],
"rules": [
{
"after": "<unknown>",
"before": "<unknown>",
"change_type": "create",
"client_ref": "<string>",
"fields": [
"<string>"
],
"id": "<string>"
}
]
},
"expires_at": "2023-11-07T05:31:56Z",
"local_references": {},
"preview_token": "<string>",
"proposed_rule_configuration": {
"base_rule_configuration_version": 123,
"program_id": "<string>",
"rule_sets": [
{
"client_ref": "<string>",
"existing": true,
"id": "<string>",
"key": "<string>",
"name": "<string>",
"order": 123,
"rules": [
{
"actions": [
{
"amount": "${{ event.amount * 0.03 }}",
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Purchase reward",
"expires_at": "365d",
"matures_at": "30d",
"type": "CREDIT"
}
],
"active_from": "2023-11-07T05:31:56Z",
"active_to": "2023-11-07T05:31:56Z",
"budgets": [
{
"asset_id": "550e8400-e29b-41d4-a716-446655440000",
"limit": "10000.00"
}
],
"client_ref": "<string>",
"condition": "<string>",
"description": "<string>",
"existing": true,
"id": "<string>",
"name": "<string>",
"order": 123,
"restore_archived": true,
"rule_set_id": "<string>",
"status": "<string>",
"stop_after_match": true
}
]
}
]
},
"request_hash": "<string>",
"source": {
"reference": "<string>",
"source_revision": 123,
"type": "<string>"
},
"warnings": [
{
"client_ref": "<string>",
"code": "<string>",
"key": "<string>",
"kind": "<string>",
"message": "<string>",
"rule_id": "<string>",
"rule_set_id": "<string>",
"scope": "<string>",
"suggestion": "<string>"
}
]
}{
"code": "bad_request",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Invalid request parameters"
}{
"code": "unauthorized",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Missing or invalid credentials"
}{
"code": "forbidden",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Insufficient permissions for this action"
}{
"code": "not_found",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource not found"
}{
"code": "rule_configuration_version_conflict",
"details": {
"current_rule_configuration_version": 4,
"expected_rule_configuration_version": 3,
"instruction": "Refetch the rule configuration and replan the mutation."
},
"message": "Rule configuration changed since this mutation was planned"
}{
"code": "unsupported_media_type",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Content-Type must be application/json"
}{
"code": "unprocessable",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Business rule violation"
}{
"code": "internal_error",
"message": "An internal error occurred"
}expected_rule_configuration_version.
Rule sets created after the target revision are retained empty and reported in warnings. Rules created after the target are archived. Stable resource IDs are preserved.
Review the returned plan and inverse diff, then apply its preview_token and request_hash through the standard apply endpoint.Authorizations
API key passed in the X-API-Key header.
Path Parameters
Program ID
Historical target configuration version
Body
Current revision guard and optional source metadata
Response
OK
Configuration version the preview was planned from.
Stable preview/change identifier.
Resource-level changes between the base and proposed configurations.
Show child attributes
Show child attributes
Preview capability expiry time.
Mapping from each client_ref to its preview-allocated stable UUID.
Show child attributes
Show child attributes
Short-lived actor-bound capability consumed by apply.
Exact server-computed configuration that apply will commit.
Show child attributes
Show child attributes
SHA-256 request hash that must accompany apply.
Audit source recorded with the preview.
Show child attributes
Show child attributes
Non-blocking advisories found while validating the proposed configuration.
Show child attributes
Show child attributes