Create journey
Create a new journey with an audience and a node graph. Journeys are always created in the draft state.
Overview
Create a new Journey programmatically. A journey is defined by an entryaudience and an ordered list of nodes.
draft state. The request accepts only writable fields: sending a server-controlled field such as state or id returns a 400 validation error. Activate a journey with the Update journey API or from the OneSignal dashboard.How to use this API
Authenticate with your App API Key. The authenticated key must have permission to create journeys. Onlyname is required. Sending an empty nodes array creates a journey with only its required defaults.
Define the audience
Theaudience sets who enters the journey. It is either segment-based or event-triggered. Segments are referenced by UUID; every segment id (here, in early_exit, and in segment_membership branch conditions) must be a valid UUID that references an existing segment, or the request is rejected.
future_additions_only applies only to segment audiences and defaults to false. When true, only users who newly match the segment after the journey is activated can enter. Users already in the segment at activation never enter, even if they leave and rejoin later.
For event-triggered audiences, attributes is a list of condition groups. Send a single group, whose conditions are AND’d together; sending more than one group is rejected. Valid operators are equal, not_equal, less, less_or_equal, greater_or_equal, greater, is, is_not, exists, not_exists, before, and after. The value field is not required for exists and not_exists.
An event name is limited to 255 characters, and each attribute key to 255 and value to 1024.
equal, not_equal, less, less_or_equal, greater_or_equal, and greater compare numerically: value must be a number (sent as a string, e.g. "5" or "19.99"). A non-numeric value on these operators is rejected. Use is and is_not to compare non-numeric values such as a currency code or plan name.
Add nodes
nodes is an ordered list. Linear nodes run in sequence. Each node requires a kind, plus the fields for that kind.
day_of_week (1–7, where 1 is Monday) is a sibling of start and end, not nested inside them. start and end hold only hour and minute. A window with no day_of_week applies to every day of the week. Each window must span at least 15 minutes.
A day-agnostic window is stored as seven per-day windows and returned in its original day-agnostic form, so a node read from a response can be sent back unchanged. One consequence: seven per-day windows that all share the same start and end are also returned as a single day-agnostic window.
windows apply only when relative_to is schedule_in_timezone. With relative_to: "last_active_time" a journey must not send windows; doing so is rejected. A last_active_time node is returned without a windows key, so a node read from a response can be sent back unchanged.
A send_push, send_email, or send_sms node’s template_id must reference an existing template of the matching channel (a push template for send_push, an email template for send_email, an SMS template for send_sms), or the request is rejected. Likewise a send_iam node’s iam_id and a send_webhook node’s webhook_id must reference existing resources. You may omit these ids while drafting, but a send node requires its id before the journey can go live.
A wait node’s duration_seconds must be between 60 seconds and 1 year (31556952 seconds). These bounds are enforced on create and on every update, in every state.
A tag node’s assignments keys are limited to 255 characters and values to 1024. An empty string value removes the tag. A node’s optional annotation is limited to 255.
Branching nodes
Branching nodes nest their sub-graphs inline throughbranches. After a branching node resolves, flow continues to the next sibling node.
split_rangetakes between 2 and 20 branches, and their weights must sum to 100.randomize_on_entrydefaults tofalse. Whentrue, the node assigns each user to a branch at random on entry.yes_norequires exactly two branches. The branch with aconditionis the “yes” branch; the branch without one is the “no” branch.wait_untiltakes between 1 and 10 condition branches. The optionalexpirationtimer exits the journey whenexitsistrue, or continues to convergence whenfalse. Itsduration_secondsfollows the same 60 second to 1 year bounds as awaitnode. Omitexpiration(or set it tonull) to wait indefinitely.
Branch conditions
yes_no and wait_until branches use a condition object selected by its kind:
on_notification_action condition branches on what a user did with a message sent earlier in the same journey. The sending node it references must be a message node (send_push, send_email, send_sms, send_iam, or send_webhook) that sits earlier in the flow than the branching node.
On create, the sending node has no server id yet. Give it a client_node_id that is unique within the journey, and send that same value on the condition. client_node_id on the condition is write-only: the API resolves it to the sending node’s id.
send_webhook node reports no user actions, so no action applies to it. An action outside this table is accepted by the API but never matches, so the branch is never taken.
An event_trigger condition’s attributes use the same list-of-lists shape and operators as an event-triggered audience. Its optional entry_event_match_attributes is a list of objects, each with two fields, used to match an incoming event against the event that entered the user into the journey:
entry_event_key is the property on the entry event; incoming_event_key is the property on the incoming event compared against it. Both are required and must be non-blank.
Lifecycle and early exit
Optionally configureschedule, reentry_rules, and early_exit at the journey level.
scheduletimestamps must use UTC (Zor+00:00). Astart_atmust be at least 5 minutes in the future, and astop_atmust be in the future and later thanstart_at.reentry_rulessets how long a user must wait before re-entering.duration_secondsmust be at least 600 (10 minutes); a shorter value is rejected. Omitreentry_rulesor sendnullto disallow re-entry.early_exitremoves a user before the journey completes. At least one rule must be set underrules; anearly_exitthat configures no rule is rejected. Sendearly_exit: nullto remove early exit entirely.
Response
A successful request returns201 Created with the full journey in its draft state, including server-assigned id fields and a concurrency_key. Pass that concurrency_key unchanged on a later Update journey request to avoid overwriting a concurrent change. Activate the draft by sending state: "active" on that same endpoint.
The journey id and state, and node and branch id fields, are server-controlled. Sending any of them is rejected with 400 invalid-payload. A body app_id is ignored: the journey is always created under the app in the URL, and the response returns that app_id.
Error responses
{ "errors": [{ "code", "title", "meta" }] }; for validation errors the failing field is in meta.attribute, with meta.path for the offending property. Branch on code and meta, not on title, whose wording can change between releases.Path Parameters
Your OneSignal App ID in UUID v4 format. See Keys & IDs.
Body
Journey name.
Optional journey description.
The journey entry audience. Either a segment-based or event-triggered audience.
- segment
- event_trigger
Conditions that remove a user from the journey before it completes. At least one rule must be set under rules; an early_exit that configures no rule is rejected. Send null to remove early exit entirely, or null for an individual rule to drop just that rule.
Controls whether and how soon a user can re-enter the journey. null means re-entry is not allowed.
Optional future start and/or stop time. null means no scheduled activation.
Ordered list of journey nodes. Server-assigned id fields are rejected on create with a 400 validation error.
A journey node. The kind field selects the shape. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
Response
201
Full journey representation returned by the detail and create endpoints.
Journey UUID. Read-only.
UUID of the app the journey belongs to. Read-only.
Journey name, up to 300 characters.
Journey description, up to 1024 characters. Defaults to an empty string.
Journey state. Read-only. New journeys are created as draft. processing is a transient state while an activation is in progress, and archived is a journey that has been stopped. Change it through the state field on Update journey.
draft, scheduled, processing, active, archived ISO 8601 creation time. Read-only.
ISO 8601 last-update time. Read-only.
ISO 8601 time the journey was activated, or null. Read-only. May stay null briefly after you set state to active: activation is enqueued for processing, and started_at populates once the journey finishes processing and becomes active.
ISO 8601 time the journey was archived, or null. Read-only.
Origin of the journey, for example public_api or dashboard. Read-only.
The journey entry audience. Either a segment-based or event-triggered audience.
- segment
- event_trigger
Conditions that remove a user from the journey before it completes. At least one rule must be set under rules; an early_exit that configures no rule is rejected. Send null to remove early exit entirely, or null for an individual rule to drop just that rule.
Controls whether and how soon a user can re-enter the journey. null means re-entry is not allowed.
Optional future start and/or stop time. null means no scheduled activation.
Ordered list of journey nodes.
A journey node. The kind field selects the shape. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
Opaque optimistic-concurrency token. Read-only. Pass it back on update to guard against overwriting a concurrent change (409 journey-stale). Send it back exactly as read from this response; do not construct or parse it.