Skip to main content
POST
Create an automation
Creates an automation scoped to a program. An automation stores the event_type and event_data you would send to POST /v1/events and submits them unchanged when its trigger fires. You must provide name, trigger, scope, and event_type. Rules match the event_type as event.type, and event_data must not contain a type key. The trigger.type can be CRON, ONE_TIME, or PARTICIPANT_STATE. A ONE_TIME trigger with trigger_at omitted fires immediately. The PARTICIPANT_STATE type requires PARTICIPANTS scope; CRON and ONE_TIME accept either scope. An invalid combination is rejected with a validation error. For ONE_TIME automations with scope set to PROGRAM, you can optionally include participant_id to target a specific participant. This sends the event to that participant rather than to the program at large.
For usage patterns and examples, see the Automations guide.

Authorizations

Authorization
string
header
default:sk_...
required

Send your API key as Authorization: Bearer <key>.

Headers

Idempotency-Key
string

Unique key (1-255 printable ASCII characters) to make retries safe. Repeating the same request with the same key within 24 hours replays the original response (Idempotent-Replayed: true).

Maximum string length: 255

Path Parameters

program_id
string<uuid>
required

The program's id.

Body

application/json

Automation configuration

Creates an automation that sends an event on a schedule.

event_type
string
required

The name of the events this automation sends, such as weekly_reminder: 1 to 255 characters with no leading or trailing whitespace. Rules read it as event.type. Send it here, not inside event_data.

Required string length: 1 - 255
Example:

"weekly_reminder"

name
string
required

Human-readable label for this automation (1-255 chars)

Required string length: 1 - 255
Example:

"Weekly points reminder"

scope
enum<string>
required

Whether the automation sends one event to the program (PROGRAM) or one event to each matching participant (PARTICIPANTS).

Available options:
PROGRAM,
PARTICIPANTS
Example:

"PARTICIPANTS"

trigger
object
required

Trigger configuration (type, schedule, timing)

Example:
description
string

Optional human-readable description of what this automation does

Example:

"Sends a weekly reminder event to VIP participants"

event_data
object

JSON object stored with the automation and submitted unchanged when its trigger fires. It must not contain a type key; send the name as event_type.

filter_hints
Automation filter hint · object[]

Checks derived from participant_filter that narrow the participants to consider. Scrip still evaluates the full CEL filter for each candidate.

guard_condition
string

CEL expression evaluated at trigger time; skips the participant if false

Example:

"participant.counter.purchases >= 1"

participant_filter
string

CEL expression that determines which participants are enrolled (scope=participants only)

Example:

"participant.tags.exists(t, t == 'vip')"

participant_id
string<uuid>

Target participant for program-scoped one-time automations (scope=PROGRAM, ONE_TIME trigger only)

Example:

"f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b006"

Response

Automation created

An automation: an event that Scrip sends on a schedule, with its trigger, status and run history.

created_at
string<date-time>

When this automation was created

Example:

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

description
string

Optional human-readable description of what this automation does

Example:

"Sends a weekly reminder event to VIP participants"

error_message
string

Error message if the one-time automation failed

Example:

"participant not found"

event_data
object

Event data submitted when this automation fires

event_type
string

The name of the events this automation sends, such as weekly_reminder. Rules read it as event.type.

Example:

"weekly_reminder"

execution_completed_at
string<date-time>

When the current fan-out execution completed

Example:

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

execution_error
string

Error message if the fan-out execution failed, or JSON-encoded diagnostics for completed runs with CEL eval skips

Example:

"fanout aborted: program is archived"

execution_started_at
string<date-time>

When the current fan-out execution started

Example:

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

execution_status
enum<string>

Progress of the current fan-out run, separate from status.

  • IDLE: no run is in progress.
  • EXECUTING: sending events to matching participants.
  • COMPLETED: latest run finished.
  • FAILED: latest run stopped with an error.
Available options:
IDLE,
EXECUTING,
COMPLETED,
FAILED
Example:

"COMPLETED"

filter_hints
Automation filter hint · object[]

Checks derived from participant_filter that narrow the participants to consider. Scrip still evaluates the full CEL filter for each candidate.

guard_condition
string

CEL expression evaluated at trigger time; skips the participant if false

Example:

"participant.counter.purchases >= 1"

id
string<uuid>

Unique identifier for this automation

Example:

"6b2d4f81-0e93-4c5a-b7d6-3a8c1e5f9b13"

last_error
string

Error message from the most recent cron execution, if any (cron trigger only)

Example:

"failed to enqueue event: queue unavailable"

last_evaluated_at
string<date-time>

When participant filters were last evaluated (PARTICIPANT_STATE trigger only)

Example:

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

last_run_at
string<date-time>

When this automation last fired (cron trigger only)

Example:

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

name
string

Human-readable label for this automation

Example:

"Weekly points reminder"

next_run_at
string<date-time>

When this automation will next fire (cron trigger only)

Example:

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

participant_filter
string

CEL expression that determines which participants are enrolled

Example:

"participant.tags.exists(t, t == 'vip')"

participant_id
string<uuid>

Target participant for program-scoped one-time automations

Example:

"f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b006"

participants_processed
integer

Participants Scrip has sent the event to in the current run so far.

Example:

150

participants_skipped_error
integer

Participants skipped because participant_filter or guard_condition CEL evaluation errored

Example:

0

participants_total
integer

Total candidate participants in the current fan-out run.

Example:

150

processed_at
string<date-time>

When this one-time automation was processed

Example:

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

program_id
string<uuid>

The program this automation belongs to

Example:

"8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01"

scope
enum<string>

Whether the automation sends one event to the program (PROGRAM) or one event to each matching participant (PARTICIPANTS).

Available options:
PROGRAM,
PARTICIPANTS
Example:

"PARTICIPANTS"

source
enum<string>

How the automation was created.

  • API: created through the automations API.
  • RULE_ACTION: created by a SCHEDULE_EVENT or BROADCAST rule action.
  • SYSTEM: created by Scrip for scheduled work such as tier expiration.
Available options:
API,
RULE_ACTION,
SYSTEM
Example:

"API"

source_event_id
string<uuid>

The event whose processing created this automation. Omitted when no source event is recorded, for example on automations created through the API.

Example:

"e5dc1b6a-7f3d-4e2a-8c1b-9a0f4d7e6c05"

source_rule_id
string<uuid>

The rule whose action created this automation. Omitted when no rule action created it, including automations created through the API.

Example:

"c9f0f895-fb98-4b39-9f86-1e5a0d3e2b03"

status
enum<string>

Whether the automation can fire.

  • ACTIVE: fires when its trigger is due.
  • PAUSED: does not fire until you set it back to ACTIVE.
  • COMPLETED: a one-time automation that has fired; it cannot fire again.
  • FAILED: stopped after a failure; set it to ACTIVE to try again.
  • ARCHIVED: removed from use; it never fires again.
Available options:
ACTIVE,
PAUSED,
COMPLETED,
FAILED,
ARCHIVED
Example:

"ACTIVE"

trigger
object

Trigger configuration (type, schedule, and timing)

Example:
updated_at
string<date-time>

When this automation was last updated

Example:

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

warnings
object[]

Advisories about participant_filter and guard_condition, such as a counter, tag or attribute key that no rule in the program writes. They appear on create and update only, and they never block the save.