---
title: "Get a rule"
method: GET
path: "/v1/rules/{rule_id}"
tags: ["Rules"]
---

# Get a rule

`GET /v1/rules/{rule_id}`

## Request

- Base URL: `https://api.scrip.dev`
- URL: `https://api.scrip.dev/v1/rules/{rule_id}`
- Auth: HTTP bearer

Retrieve a rule by ID.

## Path parameters

- `rule_id` string, uuid, required

## Response `200`

Rule details

- RuleResponse: A rule: a condition and the actions Scrip takes when an event matches it.
  - `actions` object[]: Actions to execute when the condition matches
  - `active_from` string, date-time: Start of the rule's active window (RFC 3339, null if always active). Checked against the event's event_timestamp, inclusive.
  - `active_to` string, date-time: End of the rule's active window (RFC 3339, null if no end date). Checked against the event's event_timestamp, exclusive.
  - `budgets` BudgetResponse[]: Budget constraints applied to this rule
    - `asset_id` string, uuid: Asset this budget constrains
    - `consumed` string: Amount credited in the current budget period. Returned only for PROGRAM budgets; PARTICIPANT usage differs for each recipient.
    - `cron_expression` string: Cron expression for CRON-based resets, evaluated in UTC (e.g., first of every month)
    - `interval` string: Duration for INTERVAL-based resets
    - `limit` string: Maximum allowed spend for this budget period (per participant for a PARTICIPANT budget)
    - `next_reset_at` string, date-time: Next scheduled reset. Omitted for lifetime budgets and PARTICIPANT budgets.
    - `schedule_type` 'CRON' | 'INTERVAL': How the budget resets. Omitted for lifetime budgets.
    - `scope` 'PROGRAM' | 'PARTICIPANT': Whether the limit caps all credits of this asset from the rule (PROGRAM) or each recipient's credits (PARTICIPANT).
  - `condition` string: CEL expression that determines when the rule fires
  - `created_at` string, date-time: When this rule was created (RFC 3339)
  - `deleted_at` string, date-time: When this rule was archived (null if not archived)
  - `description` string: Human-readable summary of what this rule does
  - `id` string, uuid: Unique identifier for this rule
  - `name` string: The name people see for the rule.
  - `order` integer: Evaluation position within the containing rule set (lower = first; ACTIVE and SUSPENDED rules occupy unique positions)
  - `program_id` string, uuid: Program this rule belongs to
  - `rule_configuration_version` integer: Resulting program rule-configuration revision. Present on mutation responses.
  - `rule_set_id` string, uuid: Rule set that contains this rule and scopes its order and stop_after_match behavior
  - `status` 'ACTIVE' | 'SUSPENDED' | 'ARCHIVED': The rule's lifecycle state.
  - `stop_after_match` boolean: When true, no subsequent rules in this set evaluate after this one matches; other sets continue
  - `updated_at` string, date-time: When this rule was last modified (RFC 3339)
  - `warnings` RuleWarning[]: 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.
    - `client_ref` string: The `client_ref` of the rule, when the rule is new.
    - `code` string: What the warning is about. On a rule: `unknown_state_key` (a key no rule writes), `deprecated_alias`, or `possible_unmarked_expression` (a literal that looks like CEL without `${{ }}`). On a simulation: `missing_participant_context`. On a configuration preview, also `stop_after_match_has_no_following_rule`, `unconditional_stop_shadows_following_rules`, or `later_rule_set_retained_empty`.
    - `key` string: The referenced key, as written in the condition.
    - `kind` string: Kind of reference: `counter`, `tag`, `attribute`, or `alias`.
    - `message` string: Human-readable explanation (includes the suggestion when one exists).
    - `rule_id` string: Rule identity is populated for complete-configuration validation. The single-rule authoring surfaces omit these fields.
    - `rule_set_id` string: The id of the rule set that holds the rule.
    - `scope` string: Where the referenced state belongs: `participant`, `program`, or `group`.
    - `suggestion` string: Closest known key, when a near-match exists. Empty otherwise.

## Other responses

- `400`: Invalid ID format (code: validation_error)
- `401`: The API key is missing or not valid. See [Authentication](https://docs.scrip.dev/authentication).
- `404`: Rule not found (code: rule_not_found)
- `429`: Too many requests. Wait the number of seconds in the `Retry-After` header, then retry. See [Limits and durations](https://docs.scrip.dev/limits#rate-limits).
- `500`: Something failed on Scrip's side. Retry the request, and quote `request_id` if it keeps failing. [Errors](https://docs.scrip.dev/errors) lists every code, and the [API introduction](https://docs.scrip.dev/api-reference/introduction) describes the error format.

---

[API](https://skmtc.dev/scrip/apis/scrip-api.md) · [All operations](https://skmtc.dev/scrip/apis/scrip-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scrip/apis/scrip-api/revisions/c52d35da8d97?raw)
