Skip to main content
GET
/
v1
/
rules
/
{id}
Get a rule
curl --request GET \
  --url https://api.scrip.dev/v1/rules/{id} \
  --header 'X-API-Key: <api-key>'
{
  "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"
    }
  ],
  "condition": "event.type == 'purchase' && event.amount > 0",
  "created_at": "2024-01-15T10:30:00Z",
  "deleted_at": "2023-11-07T05:31:56Z",
  "description": "Awards 10 points per dollar spent",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Purchase Reward",
  "order": 100,
  "program_id": "550e8400-e29b-41d4-a716-446655440001",
  "status": "ACTIVE",
  "stop_after_match": false,
  "updated_at": "2024-01-15T10:30:00Z"
}
Returns a single rule by ID, including its full configuration: condition, actions, order, stop_after_match, time window settings, and status. If the rule has budgets configured, the response includes the current budget state for each asset, showing the consumed amount and the next_reset_at timestamp. This is the primary way to check how much of a rule’s budget has been spent. To reset a budget manually, use the reset budget endpoint.
For usage patterns and examples, see the Writing Rules guide.

Authorizations

X-API-Key
string
header
required

API key passed in the X-API-Key header.

Path Parameters

id
string<uuid>
required

Rule ID

Response

Rule details

actions
object[]

Actions to execute when the condition matches

Example:
[
  {
    "amount": "event.amount * 10",
    "asset_id": "550e8400-e29b-41d4-a716-446655440002",
    "type": "CREDIT"
  }
]
active_from
string<date-time>

Start of the rule's active window (RFC 3339, null if always active)

Example:

"2024-01-01T00:00:00Z"

active_to
string<date-time>

End of the rule's active window (RFC 3339, null if no end date)

Example:

"2024-12-31T23:59:59Z"

budgets
object[]

Budget constraints applied to this rule

condition
string

CEL expression that determines when the rule fires

Example:

"event.type == 'purchase' && event.amount > 0"

created_at
string<date-time>

When this rule was created (RFC 3339)

Example:

"2024-01-15T10:30:00Z"

deleted_at
string<date-time>

When this rule was archived (null if not archived)

description
string

Human-readable summary of what this rule does

Example:

"Awards 10 points per dollar spent"

id
string<uuid>

Unique identifier for this rule

Example:

"550e8400-e29b-41d4-a716-446655440000"

name
string

Display name

Example:

"Purchase Reward"

order
integer

Evaluation sequence (lower = first, must be unique per program)

Example:

100

program_id
string<uuid>

Program this rule belongs to

Example:

"550e8400-e29b-41d4-a716-446655440001"

status
string

Lifecycle status: ACTIVE, SUSPENDED, or ARCHIVED

Example:

"ACTIVE"

stop_after_match
boolean

When true, no subsequent rules evaluate after this one matches

Example:

false

updated_at
string<date-time>

When this rule was last modified (RFC 3339)

Example:

"2024-01-15T10:30:00Z"