Overview
The Create message API allows you to send push notifications, emails, and SMS to your users. This guide is specific for push. See Email or SMS to send to those channels. Ensure your application is properly configured by following the Mobile SDK Setup and/or Web SDK Setup guides. You should see subscribed push Subscriptions in your OneSignal dashboard to send them messages.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. Supports Message Personalization.
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.
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
elementsThe message title with language-specific values. Required for Huawei and Web Push. If not set for Web Push, it defaults to your 'Site Name'. Not required if using template_id
or content_available
. Supports Message Personalization and must include the same languages as contents
to ensure localization consistency.
iOS only. The subtitle with language-specific values. Supports Message Personalization and must include the same languages as contents
to ensure localization consistency.
An 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).
The local name or URL of the media attachment to include in your notification. Users can expand the notification to view images, videos, or other supported attachments. See Images & Rich Media.
The local name or URL of the image to include in your Google Android notification. Users can expand the notification to view the images. See Images & Rich Media.
The local name or URL of the image to include in your Huawei Android notification. Users can expand the notification to view the images. See Images & Rich Media.
The local name or URL of the image to include in your Amazon Android notification. Users can expand the notification to view the images. See Images & Rich Media.
The URL of the image to include in your Chrome notification. Users can expand the notification to view the images. Supported on Chrome for Windows and Android. macOS does not support this parameter and instead expands the chrome_web_icon
. See Images & Rich Media.
The local name of the small icon to display in the Google Android notification. See Notification icons.
The local name of the small icon to display in the Huawei Android notification. See Notification icons.
The local name of the small icon to display in the Amazon Android notification. See Notification icons.
The local name or URL of the large icon to display in the Google Android notification. See Notification icons.
The local name or URL of the large icon to display in the Huawei Android notification. See Notification icons.
The local name or URL of the large icon to display in the Amazon Android notification. See Notification icons.
The URL of the icon to display in the Chrome web notification. Defaults to the resource set in the OneSignal dashboard. See Notification icons.
The URL of the icon to display in the Firefox web notification. Defaults to the resource set in the OneSignal dashboard. See Notification icons.
The UUID of the Android notification channel category created within your OneSignal app.
The UUID of the Android notification channel category created within your Android app.
The UUID of the Android notification channel category created within your OneSignal app.
The UUID of the Android notification channel category created within your Huawei app.
The category you set for notifications sent to Huawei devices. The category chosen must align with an approved self-classification application. Subject to daily send limitations ranging from 2 to 5, depending on the specific third-level classifications the message falls under.
MARKETING
, IM
, VOIP
, SUBSCRIPTION
, TRAVEL
, HEALTH
, WORK
, ACCOUNT
, EXPRESS
, FINANCE
, DEVICE_REMINDER
, MAIL
The type of notification being sent to Huawei devices. Options: message
- (default) For displayable notifications to the user. Notification will be shown even if the app is force quit. If the device is offline it will display the notification when it connects to the internet within the ttl
timeframe (usually 3 days). Does not support Confirmed Delivery, Huawei requires using their dashboard to track this. data
- used for notifications containing data payloads you intend to process in the background. If the app is force quit, HMS Core will not start the app to process the notification. Supports Confirmed Delivery.
message
, data
Define a tag for associating messages in a batch delivery, facilitating precise monitoring and analysis of delivery stats. This tag is returned to your server when Huawei's Push Kit sends a message receipt. You can set this parameter to track your push campaigns' performance and optimize your messaging strategy.
Set the priority based on the urgency of the message. 10
- High priority. 5
- Normal priority. Recommended and default value is 10
. APNs and FCM use this parameter to determine how quickly a notification is delivered and processed, particularly in power-saving modes. If sending data/background notifications, 5
(Normal priority) is recommended. For details, see APNs apns-priority
and FCM priority
.
10
, 5
The priority and delivery timing of iOS notifications based on their importance and the urgency with which they should interrupt the user. See iOS Focus modes and interruption levels.
active
, passive
, time_sensitive
, critical
The local name of the custom sound file to play when the notification is received instead of the default sound. See Notification sounds.
The ARGB Hex formatted color of the Android small icon background. For Android 8+ use Android notification channel category and android_channel_id
.
The ARGB Hex formatted color of the Huawei small icon background. For Android 8+ use Android notification channel category and huawei_channel_id
.
The https
URL that opens in the browser when a user interacts with the notification. See URLs, Links and Deep Links. Supports Message Personalization.
Similar to the url
parameter but exclusively targets mobile platforms like iOS, Android. Accepts values other than https
but must use your-app-scheme://
protocol.
Use with app_url
if your app and website need different URLs. Accepts URLs with protocol https://
Direct the notification to a specific user experience within your app, such as an App Clip, or target a particular window in applications that use multiple scenes. See Apple's documentation.
Add a maximum of 3 Action Buttons to Android and iOS push notifications. See Action Buttons.
3
Add a maximum of 2 Action Buttons to Chrome web push notifications. See Action Buttons.
2
An ID to group notifications on Apple devices. Notifications with the same identifier are organized together in the notification center.
A value between 0
and 1
, to sort the notifications from your app. The highest score gets featured in the notification summary. See iOS Relevance Score
An ID to group notifications on Google Android devices. Notifications with the same identifier are organized together in the notification center.
An ID to group notifications on Amazon Android devices. Notifications with the same identifier are organized together in the notification center.
The duration in seconds for which a notification remains valid if the device is offline. Any number between 0
and 2419200
(28 days). Defaults to 3 days. See Push: Time to Live.
An ID that replaces older notifications with newer ones that have the same identifier. For mobile push only. See Push: Collapse ID.
An ID that prevents replacement of older notifications with newer ones that have different identifiers. For web push only. See Push: Web Push Topic.
Bundle a custom data map within your notification, which is then passed to your app. See Push: Additional Data.
Allows for sending data/background notifications to the Android and iOS apps. Set to true
and omit contents
. Apple interprets this as content-available=1
. See Data & background notifications.
Enable users to respond directly to a notification without launching the app. The Category will activate the corresponding Notification Content Extension in your app when the push is interacted with.
Use only for VoIP notifications. Corresponds to the apns-push-type
. OneSignal automatically sets this value to alert
or background
based on the notification content. Pass voip
to initiate VoIP calls or alert the user to incoming VoIP calls.
Specifies if the notification should target iOS mobile apps only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled.
Specifies if the notification should target Google Android mobile apps only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled.
Specifies if the notification should target Huawei mobile apps only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled.
Specifies if the notification should target web push only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled.
Specifies if the notification should target Chrome only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled.
Specifies if the notification should target Firefox only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled.
Specifies if the notification should target Safari only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled
Specifies if the notification should target Windows apps only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled
Specifies if the notification should target Amazon devices only. Defaults to true
. If set to true
, all other platforms are disabled unless explicitly enabled
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).
Overrides the throttle limit set in the OneSignal dashboard settings. Must be enabled through the dashboard. Only available with push notifications. See Push Throttling. If throttle_rate_per_minute
is set to 0
, then the message will be sent immediately without any rate limiting.
Overrides the frequency cap set in the OneSignal dashboard settings. Must be enabled through the dashboard first. Only available with push notifications. See Frequency Capping. Set to false
to disable frequency capping.
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.