Overview
The Create message API allows you to send push notifications, emails, and SMS to your users. This guide is specific for SMS and MMS. See Push notification or Email to send to those channels. Ensure your SMS setup is complete.Trackable links
Add trackable links to your SMScontents
using liquid syntax in the format {{'your_url' | track_link}}
.
Example:
1sgnl.co/XXXX
.
Headers
Your App API key with prefix Key
. See Keys & IDs.
Body
Your OneSignal App ID in UUID v4 format. See Keys & IDs.
The main message body with language-specific values. Too many characters may result in multiple messages and increased costs. See SMS. Required unless using template_id
. Supports Message Personalization. You can add trackable links to your SMS via the API by including liquid syntax in your message contents. For example: {{'your_url' | track_link}} The liquid syntax block will be replaced with a trackable short link in the following format: 1sgnl.co/XXXX. Using trackable links allows you to see the click through rates of your SMS.
Target up to 20,000 users by their external_id
, onesignal_id
, or your own custom alias. Use with target_channel
to control the delivery channel. Not compatible with any other targeting parameters like filters
, include_subscription_ids
, included_segments
, or excluded_segments
. See Sending messages with the OneSignal API.
The targeted delivery channel. Required when using include_aliases
. Accepts push
, email
, or sms
.
push
, email
, sms
Target users' specific subscriptions by ID. Include up to 20,000 subscription_id
per API call. Not compatible with any other targeting parameters like filters
, include_aliases
, included_segments
, or excluded_segments
. See Sending messages with the OneSignal API.
Send SMS/MMS to specific users by their phone number in E.164 format. Can only be used when sending SMS/MMS. Include up to 20,000 phone numbers per API call. If the phone number does not exist within the OneSignal App, then a new SMS Subscription will be created. Not compatible with any other targeting parameters like filters
, include_aliases
, included_segments
, or excluded_segments
. See Sending messages with the OneSignal API.
Target predefined Segments. Users that are in multiple segments will only be sent the message once. Can be combined with excluded_segments
. Not compatible with any other targeting parameters like filters
, include_aliases
, or include_subscription_ids
. See Sending messages with the OneSignal API.
Exclude users in predefined Segments. Overrides membership in any segment specified in the included_segments
. Not compatible with any other targeting parameters like filters
, include_aliases
, or include_subscription_ids
. See Sending messages with the OneSignal API.
Filters define the segment based on user properties like tags, activity, or location using flexible AND/OR logic. Limited to 200 total entries, including fields and OR
operators. See Sending messages with the OneSignal API.
1 - 200
elementsAn internal name you set to help organize and track messages. Not shown to recipients. Maximum 128 characters.
Include user or context-specific data (e.g., cart items, OTPs, links) in a message. Use with template_id
. See Message Personalization. Max size: 2KB (Push/SMS), 10KB (Email).
Schedule delivery for a future date/time (in UTC). The format must be valid per the ISO 8601 standard and compatible with JavaScript’s Date() parser
. Example: 2025-09-24T14:00:00-07:00
Controls how messages are delivered on a per-user basis: 'timezone'
— Sends at the same local time across time zones. 'last-active'
— Delivers based on each user’s most recent session. Not compatible with Push Throttling. If enabled, set throttle_rate_per_minute
to 0
.
Use with delayed_option: 'timezone'
to set a consistent local delivery time. Accepted formats: '9:00AM'
(12-hour), '21:45'
(24-hour), '09:45:30'
(HH:mm:ss).
A unique identifier used to prevent duplicate messages from repeat API calls. See Idempotent notification requests. Must be a v3 or v4 UUID. Valid for 30 days. Previously called external_id
.
Response
200
The message ID in UUID v4 format. If id
is an empty string, then the message was not sent.
The idempotency_key
parameter if set. Used to prevent duplicate messages from repeat API calls. See Idempotent message requests.
If the message id
is set, then a message was sent. Any errors reported are with individual Users or Subscriptions that cannot be sent the message.