---
title: "Automation data and variables"
description: "The data paths conditions and template variables read in an automation: the contact, the trigger event, earlier blocks' outputs and the run itself."
url: https://www.unitpost.com/guides/automations-data
section: Guides
updated: 2026-11-29
---
# Automation data and variables

## Automation data and variables

> The data paths conditions and template variables read in an automation: the contact, the trigger event, earlier blocks' outputs and the run itself.

Conditions (`filter.conditions[].field`), template variables (`variables`) and contact updates (`{ path }`) read the run's data by path. A path always starts with a scope: `contact.`, `handle.`, `event.`, `steps.<id>.output.` or `run.`.

- A variable is a path (`"contact.first_name"`), a path with a fallback (`{ "path": "event.data.cart_url", "fallback": "https://shop.acme.com/cart" }`), or a fixed value (`{ "value": "Spring sale" }`).
- Trigger and wait-for-event filters can't read `steps.*` or `run.*`: nothing has run yet when they are checked.
- `steps.<id>` must name a block that runs before this one.
- For one block's exact paths in your workspace (your custom contact fields, the payload keys your backend sends, earlier outputs), call `GET /v1/automations/catalog?automation_id=…&node_id=…`.

### Conditions

- Operators: `eq`, `neq`, `contains`, `not_contains`, `starts_with`, `ends_with`, `gt`, `gte`, `lt`, `lte`, `is_set`, `is_not_set`. For dates also `within_last_days`, `more_than_days_ago`, `within_next_days` (value: whole days, 1 to 3,650) and `before_now`, `after_now` (no value).
- A date is ISO 8601 (`2026-12-01`, read as midnight UTC, or `2026-12-01T09:00:00Z`). A missing or unreadable date matches no date operator: "more than 90 days ago" is false for someone who never opened an email. Windows are rolling (N × 24 hours from now).
- Segment membership puts the segment id in the field: `{ "field": "contact.segments.seg_…", "operator": "eq", "value": true }` (in it) or `"value": false` (not in it); `contact.segments` with `contains` and the id as the value is not membership (it reads a custom field named segments and matches nobody). Topic subscription: `{ "field": "contact.topics.top_…", "operator": "eq", "value": true }`, for every channel's topics alike (their own choice, else the topic's default). Read the ids first (segments and topics); never invent one.
- Email engagement, read-only: `contact.email_stats.last_opened_at`, `contact.email_stats.last_clicked_at`, `contact.email_stats.last_sent_at`, `contact.email_stats.first_sent_at`, `contact.email_stats.sent`, `contact.email_stats.delivered`, `contact.email_stats.opened`, `contact.email_stats.clicked`, `contact.email_stats.bounced`, `contact.email_stats.complained`. The dates are empty when it never happened; opens include machine opens, so a click is the stronger signal.
- A segment or topic a condition names must exist: validate and publish refuse a missing one (pinned to the condition), and deleting or archiving one a live automation uses is refused (`409 resource_in_use`, naming the automation). If one is gone anyway, the automation pauses (`dependency_broken`) and you're emailed.
- Exit rules (`policy.exitConditions`) are checked before every block, and also as soon as a change to the contact made through the API, the dashboard or an automation arrives (a field update, a segment joined or left, a topic subscribed or unsubscribed): a matching run then ends even mid-wait. A change that sends no event (an import or a migration, a changed field default, engagement, time passing) is judged at the run's next block; a bulk segment or field edit sends one per contact, like a single change. Unsubscribing ends no run by itself: the person stays in, later marketing emails skip and other blocks still run, unless the exit rule has `contact.unsubscribed` eq true (readiness `unsubscribed_stay_in`).
- Relative dates work in automation conditions only; a segment's own rules refuse them. In a segment, `contact.segments.…` and the like are ordinary custom-field paths. In an automation they mean membership only when the id is a real segment or topic id (`seg_…`, `top_…` or a UUID).

### Waiting for a date

- To time a step from a date ("3 days before the trial ends", "24 hours before the appointment"), use Wait until with `relativeTo`: `{ "relativeTo": { "path": "contact.trial_ends_at", "offset": "P3D", "direction": "before" }, "timeOfDay": "09:00", "timezone": "contact", "fallbackTimezone": "UTC" }`. `path` is a DATE contact field (`contact.<field>`) or a key of the trigger event (`event.data.<key>`); `timeOfDay` is optional (without it the wait ends at the exact moment).
- Offsets in days, weeks, months or years keep the local time across daylight saving; hours and minutes are exact (`PT24H` is 24 real hours). A date field holding a day (stored as midnight UTC) means that calendar day in every time zone. In event data a bare `YYYY-MM-DD` is that day too, and a value with a time (`2026-12-05T09:00:00+09:00`, or `…T00:00:00Z`) is that exact instant: send a bare day when you mean a day.
- A contact date that changes while a run waits re-times the wait (earlier continues sooner, later waits longer, cleared follows the no-date rule). An event's date is fixed when the run starts: send the event again to move it.
- No usable date (missing, empty, not ISO 8601): `onMissingDate` is `exit` (default, sends nothing more), `continue`, or `branch` (wire the `no_date` handle). Moment already passed when the run gets there, or moved behind by a change: `onPassed` is `continue` (default), `exit`, or `branch` (wire the `passed` handle). A moment later than the run can wait (its `maxRunDuration`, 90 days unless set, or the longest wait) ends the run without sending (`wait_date_too_far`): raise `maxRunDuration` for dates months away. The step's output says which: `steps.<id>.output.date_status` is `on_time`, `passed`, `missing`, `invalid` or `too_far`.

### Contact

The enrolled contact. Your custom fields are read the same way (`contact.plan`, `contact.company`); the catalog with an automation and block id lists this workspace's.

| Path | Type | Meaning |
| --- | --- | --- |
| `contact.email` | text | The enrolled contact's email address. |
| `contact.first_name` | text | First name |
| `contact.last_name` | text | Last name |
| `contact.unsubscribed` | boolean | true when the contact opted out of every marketing email. |

### Segments and topics

Yes / no per segment or topic: compare with `eq` and `true` or `false`. One field per segment (`contact.segments.<segment id>`) and per topic (`contact.topics.<topic id>`); the catalog with an automation and block id lists this workspace's.

| Path | Type | Meaning |
| --- | --- | --- |
| `contact.segments.<seg_id>` | boolean | true when the contact is in that segment (a static segment's member, or matching a dynamic segment's rules now). |
| `contact.topics.<top_id>` | boolean | true when the contact is subscribed to that email or SMS topic (their own choice, else the topic's default). |

### Email engagement

Read-only lifetime numbers from every email sent to the contact. Dates work with the relative-date operators.

| Path | Type | Meaning |
| --- | --- | --- |
| `contact.email_stats.last_opened_at` | date | When they last opened one of your emails (empty if never). Opens include machine opens; a click is the stronger signal. Use with “in the last N days” / “more than N days ago”. |
| `contact.email_stats.last_clicked_at` | date | Empty if it never happened. Use with “in the last N days” / “more than N days ago”. |
| `contact.email_stats.last_sent_at` | date | Empty if it never happened. Use with “in the last N days” / “more than N days ago”. |
| `contact.email_stats.first_sent_at` | date | Empty if it never happened. Use with “in the last N days” / “more than N days ago”. |
| `contact.email_stats.sent` | number | A lifetime count across every email sent to them. |
| `contact.email_stats.delivered` | number | A lifetime count across every email sent to them. |
| `contact.email_stats.opened` | number | A lifetime count across every email sent to them. |
| `contact.email_stats.clicked` | number | A lifetime count across every email sent to them. |
| `contact.email_stats.bounced` | number | A lifetime count across every email sent to them. |
| `contact.email_stats.complained` | number | A lifetime count across every email sent to them. |

### Reachability

The contact's primary address or number per channel and its consent state.

| Path | Type | Meaning |
| --- | --- | --- |
| `handle.email.status` | text | ACTIVE, PENDING_VERIFY, OPTED_OUT, or UNREACHABLE. |
| `handle.email.address` | text | Email address |
| `handle.email.is_primary` | boolean | Email handle is primary |
| `handle.email.consented_at` | date | When express consent was recorded (null if none). |
| `handle.email.verified_at` | date | Email verified timestamp |
| `handle.sms.status` | text | ACTIVE, PENDING_VERIFY, OPTED_OUT, or UNREACHABLE. |
| `handle.sms.address` | text | Phone number |
| `handle.sms.is_primary` | boolean | SMS handle is primary |
| `handle.sms.consented_at` | date | When express consent was recorded (null if none). |
| `handle.sms.verified_at` | date | SMS verified timestamp |

### This run

Run metadata. Not readable in a trigger filter or a wait-for-event filter.

| Path | Type | Meaning |
| --- | --- | --- |
| `run.started_at` | date | ISO-8601 timestamp of enrollment. |
| `run.steps_executed` | number | Steps executed so far |

### Event: Contact created

What `event.*` holds when the trigger is Contact created.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.id` | text | Id |
| `event.data.email` | text | Email |
| `event.data.first_name` | text | First name |
| `event.data.last_name` | text | Last name |
| `event.data.unsubscribed` | boolean | Unsubscribed |

### Event: Contact updated

What `event.*` holds when the trigger is Contact updated.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.id` | text | Id |
| `event.data.email` | text | Email |
| `event.data.first_name` | text | First name |
| `event.data.last_name` | text | Last name |
| `event.data.unsubscribed` | boolean | Unsubscribed |
| `event.data.changed_fields` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.source` | text | Source |

### Event: Joined segment

What `event.*` holds when the trigger is Joined segment.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.segment_id` | text | Segment ID |
| `event.data.segment_name` | text | Segment name |
| `event.data.contact_id` | text | Contact ID |
| `event.data.email` | text | Email |

### Event: Left segment

What `event.*` holds when the trigger is Left segment.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.segment_id` | text | Segment ID |
| `event.data.segment_name` | text | Segment name |
| `event.data.contact_id` | text | Contact ID |
| `event.data.email` | text | Email |

### Event: Subscribed to topic

What `event.*` holds when the trigger is Subscribed to topic.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.topic_id` | text | Topic ID |
| `event.data.topic_name` | text | Topic name |
| `event.data.contact_id` | text | Contact ID |
| `event.data.email` | text | Email |
| `event.data.source` | text | Source |

### Event: Unsubscribed from topic

What `event.*` holds when the trigger is Unsubscribed from topic.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.topic_id` | text | Topic ID |
| `event.data.topic_name` | text | Topic name |
| `event.data.contact_id` | text | Contact ID |
| `event.data.email` | text | Email |
| `event.data.source` | text | Source |

### Event: Email activity

What `event.*` holds when the trigger is Email activity.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.email_id` | text | Email ID |
| `event.data.to` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.from` | text | From |
| `event.data.subject` | text | Subject |
| `event.data.created_at` | text | Created time |
| `event.data.campaign_id` | text | Campaign ID |
| `event.data.template_id` | text | Template ID |
| `event.data.tags.category` | text | Category |
| `event.data.tags` | text | Tags |
| `event.data.bounce.type` | text | Type |
| `event.data.bounce.sub_type` | text | Sub type |
| `event.data.bounce.category` | text | Category |
| `event.data.bounce.message` | text | Message |
| `event.data.bounce.diagnostic_code` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.complaint.feedback_type` | text | Feedback type |
| `event.data.open.ip_address` | text | Ip address |
| `event.data.open.user_agent` | text | User agent |
| `event.data.open.timestamp` | text | Timestamp |
| `event.data.click.ip_address` | text | Ip address |
| `event.data.click.link` | text | Link |
| `event.data.click.user_agent` | text | User agent |
| `event.data.click.timestamp` | text | Timestamp |
| `event.data.failed.reason` | text | Reason |
| `event.data.scheduled_at` | text | Scheduled time |
| `event.data.batch_id` | text | Batch ID |
| `event.data.suppressed` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.full` | boolean | Full |
| `event.data.cc` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.bcc` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.message_id` | text | Message ID |
| `event.data.thread_id` | text | Thread ID |
| `event.data.reply_to` | text | A list. A condition matches when any one entry does (not equals / does not contain: when none does). As a template value it reads as the entries joined with ", ". |
| `event.data.sent_by_us` | boolean | Sent by us |
| `event.data.text` | text | The plain-text body of the received email, quoted replies included, up to 16,000 characters. Empty when the email had no text part. Not set for a copy of one of your own sends (event.data.sent_by_us). |
| `event.data.snippet` | text | A short preview of the new text (about 200 characters, quoted history removed). Not set for a copy of one of your own sends. |

### Event: Text received

What `event.*` holds when the trigger is Text received.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |
| `event.data.sms_id` | text | Sms ID |
| `event.data.from` | text | From |
| `event.data.to` | text | To |
| `event.data.body` | text | Body |
| `event.data.keyword` | text | Keyword |
| `event.data.auto_replied` | boolean | Auto replied |
| `event.data.looks_like_opt_out` | boolean | Looks like opt out |
| `event.data.in_reply_to` | text | In reply to |
| `event.data.contact_id` | text | Contact ID |
| `event.data.received_at` | text | Received time |
| `event.data.created_at` | text | Created time |
| `event.data.participant_opted_out` | boolean | Participant opted out |
| `event.data.sender_id` | text | The id (snum_…) of your number the person texted. event.data.to is the number itself. |

### Event: Custom event

Your backend's payload is read as `event.data.<key>`. `event_definitions_list` (GET /v1/events/definitions) lists the keys it has seen. Unitpost adds two keys of its own, over a payload key of the same name: `event.data.email` and `event.data.contact_id`, the contact the event names (in a run, the contact it started for, one the event made included), plus `event.data.create_contact: false` when the event opted out.

| Path | Type | Meaning |
| --- | --- | --- |
| `event.type` | text | Event type |
| `event.source` | text | Event source |
| `event.created_at` | date | Event time |

### Earlier block: Send email

Read as `steps.<blockId>.output.<key>` by blocks after a Send email block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.channel` | text | Always "email" for this block. |
| `steps.<id>.output.status` | text | queued = handed to the sending gate, scheduled = future send time, skipped = not sent (see skip_reason). |
| `steps.<id>.output.skip_reason` | text | Why the email was not sent; null when it was. `unsubscribed`: they unsubscribed from all marketing email; `not_subscribed`: they aren't subscribed to the email's topic; `suppressed`: the address is on the suppression list; `frequency_capped`: the daily marketing cap; `no_email_handle`: no address; `missing_template_variables`: a template value had no value; `stale_hold`: held by a marketing pause more than 7 days. |
| `steps.<id>.output.address` | text | The recipient address used. |
| `steps.<id>.output.handle_id` | text | The contact's email handle id (null for a fixed `to` recipient). |
| `steps.<id>.output.message_id` | text | The sent email's id once queued; null when skipped. Read here without its prefix; a run read shows it as `email_…`. |
| `steps.<id>.output.provider_message_id` | text | Provider message id, assigned asynchronously, so null at send time. Wait for email.delivered before branching on it. |
| `steps.<id>.output.marketing` | boolean | true when this send counted as marketing (honors unsubscribe + the daily cap); false for transactional and fixed-recipient sends. |

### Earlier block: Send SMS

Read as `steps.<blockId>.output.<key>` by blocks after a Send SMS block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.channel` | text | Always "sms" for this block. |
| `steps.<id>.output.status` | text | queued = accepted by the SMS send path, scheduled = accepted for a later send time (the send path holds it until then), skipped = not sent (see skip_reason). |
| `steps.<id>.output.skip_reason` | text | Why the SMS was not sent; null when it was. |
| `steps.<id>.output.address` | text | The E.164 number used. |
| `steps.<id>.output.handle_id` | text | The contact's phone handle id. |
| `steps.<id>.output.message_id` | text | The message id once queued; null when skipped. Read here without its prefix; a run read shows it as `sms_…`. |
| `steps.<id>.output.marketing` | boolean | true when classified as marketing (consent-gated). |

### Earlier block: Update contact

Read as `steps.<blockId>.output.<key>` by blocks after a Update contact block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.changed_fields` | unknown | Field keys whose value actually changed (a no-op update leaves this empty). |
| `steps.<id>.output.opt_out_kept` | boolean | true when `unsubscribed: false` was not applied: the contact unsubscribed themselves and their own action didn't start this run (AUTOMATIONS.md D25). The block's other fields still changed. |
| `steps.<id>.output.skip_reason` | text | contact_opted_out when keeping their opt-out left nothing to change (the step is skipped). |

### Earlier block: Change topic subscription

Read as `steps.<blockId>.output.<key>` by blocks after a Change topic subscription block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.topic_id` | text | The topic acted on (a run read shows it as `top_…`). |
| `steps.<id>.output.op` | text | Which operation ran. |
| `steps.<id>.output.changed` | boolean | false when the contact already had this subscription state (safe no-op), or the subscribe was refused. |
| `steps.<id>.output.skip_reason` | text | contact_opted_out when a subscribe was refused (step skipped): the contact unsubscribed from this topic themselves and their own action didn't start this run (AUTOMATIONS.md D25). |

### Earlier block: Add/remove from segment

Read as `steps.<blockId>.output.<key>` by blocks after a Add/remove from segment block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.segment_id` | text | The static segment acted on (a run read shows it as `seg_…`). |
| `steps.<id>.output.op` | text | Which operation ran. |
| `steps.<id>.output.changed` | boolean | false when membership was already in the requested state. |

### Earlier block: Call webhook

Read as `steps.<blockId>.output.<key>` by blocks after a Call webhook block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.response_code` | number | HTTP status your endpoint returned (2xx). |

### Earlier block: Wait

Read as `steps.<blockId>.output.<key>` by blocks after a Wait block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.waited` | boolean | true once the wait elapsed. |
| `steps.<id>.output.skipped_by_user` | boolean | true when a person skipped the rest of the wait ("Skip wait"); absent when it elapsed on its own. |

### Earlier block: Wait until

Read as `steps.<blockId>.output.<key>` by blocks after a Wait until block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.waited` | boolean | true once the wait ended (or its moment had passed); false when a date to wait for was missing. |
| `steps.<id>.output.passed` | boolean | true when the date (plus offset) had already passed as the run reached the block, or a change moved it behind, so it didn't wait. |
| `steps.<id>.output.date_status` | text | Waits on a contact or event date only: "on_time" (it waited for the moment), "passed", "missing" (no date), "invalid" (not an ISO date) or "too_far" (later than the run can wait; the run ended). |
| `steps.<id>.output.date` | text | Waits on a contact or event date only: the date value read, as stored. |
| `steps.<id>.output.skipped_by_user` | boolean | true when a person skipped the rest of the wait ("Skip wait"). |

### Earlier block: Wait for event

Read as `steps.<blockId>.output.<key>` by blocks after a Wait for event block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.resumed_by` | text | "event" when the awaited event arrived, "timeout" when the wait expired. |
| `steps.<id>.output.skipped_by_user` | boolean | true when a person skipped the wait ("Skip wait"): the run took the timeout path early. |
| `steps.<id>.output.event_id` | text | Id of the event that ended the wait (null on timeout). |
| `steps.<id>.output.event.id` | text | event.id |
| `steps.<id>.output.event.type` | text | Event type, e.g. email.opened or order.completed. |
| `steps.<id>.output.event.source` | text | Who emitted it. |
| `steps.<id>.output.event.created_at` | text | ISO-8601 timestamp. |

### Earlier block: If / else

Read as `steps.<blockId>.output.<key>` by blocks after a If / else block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.matched` | boolean | true → took the yes handle. |

### Earlier block: Multi-branch

Read as `steps.<blockId>.output.<key>` by blocks after a Multi-branch block.

| Path | Type | Meaning |
| --- | --- | --- |
| `steps.<id>.output.branch` | number | 1-based index of the branch taken; null when the else path ran. |
| `steps.<id>.output.label` | text | The taken branch's label, if it has one. |

## Related

- [Automation safety and limits](https://www.unitpost.com/guides/automations-safety): The guards every automation runs with: loop guards, frequency caps, re-entry, wait and run limits, live-run ceilings and the permissions each step needs.
- [Test and publish an automation](https://www.unitpost.com/guides/automations-testing): Validate, read readiness, dry-run for a contact, preview an enrollment, publish, and what a new version does to people mid-journey.
- [Automation runs and debugging](https://www.unitpost.com/guides/automations-runs): Run states, why an automation pauses and what lifts it, and how to find, fix and retry a run that failed without sending anything twice.
