Update in-app message
curl --request PUT \
--url https://api.onesignal.com/apps/{app_id}/in_app_messages/{id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"is_draft": false,
"in_app_message": {
"name": "Welcome offer (updated)",
"display_duration": 0,
"html": "<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>",
"start_time": "2026-11-01T00:00:00Z",
"end_time": null,
"triggers": [
{
"conditions": [
{
"kind": "session_time",
"operator": "greater",
"value": 30
}
]
}
]
}
}
'const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
is_draft: false,
in_app_message: {
name: 'Welcome offer (updated)',
display_duration: 0,
html: '<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>',
start_time: '2026-11-01T00:00:00Z',
end_time: null,
triggers: [{conditions: [{kind: 'session_time', operator: 'greater', value: 30}]}]
}
})
};
fetch('https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}"
payload = {
"is_draft": False,
"in_app_message": {
"name": "Welcome offer (updated)",
"display_duration": 0,
"html": "<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>",
"start_time": "2026-11-01T00:00:00Z",
"end_time": None,
"triggers": [{ "conditions": [
{
"kind": "session_time",
"operator": "greater",
"value": 30
}
] }]
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'is_draft' => false,
'in_app_message' => [
'name' => 'Welcome offer (updated)',
'display_duration' => 0,
'html' => '<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>',
'start_time' => '2026-11-01T00:00:00Z',
'end_time' => null,
'triggers' => [
[
'conditions' => [
[
'kind' => 'session_time',
'operator' => 'greater',
'value' => 30
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}"
payload := strings.NewReader("{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.put("https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<authorization>");
request.AddJsonBody("{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
false{
"success": true,
"payload": {
"id": "2c5c6b7e-0f6d-4a5e-9a2b-1a2b3c4d5e6f"
}
}{
"success": false,
"errors": [
"start_time is required.",
"end_time is required. Send null for a message with no end time.",
"triggers is required. Send [] for a message shown on app open."
]
}{
"errors": [
"Access denied. Please include an 'Authorization: ...' header with a valid API key (https://documentation.onesignal.com/docs/en/keys-and-ids#api-keys)."
]
}{
"errors": [
"Current user permissions do not allow this action."
]
}{
"success": false,
"errors": [
"In-App Message not found"
]
}{
"success": false,
"errors": [
"Commit rejected: a concurrent edit has already been committed. Please refresh and retry."
]
}{
"success": false,
"errors": [
"Commit failed: your editing session has expired. Please refresh."
]
}{
"errors": [
"API rate limit exceeded"
],
"limit": "API Per App"
}Update in-app message
Replace a custom HTML in-app message’s html, schedule, audience, and triggers. An update replaces the whole in-app message, so send every required field on each request.
PUT
/
apps
/
{app_id}
/
in_app_messages
/
{id}
Update in-app message
curl --request PUT \
--url https://api.onesignal.com/apps/{app_id}/in_app_messages/{id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"is_draft": false,
"in_app_message": {
"name": "Welcome offer (updated)",
"display_duration": 0,
"html": "<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>",
"start_time": "2026-11-01T00:00:00Z",
"end_time": null,
"triggers": [
{
"conditions": [
{
"kind": "session_time",
"operator": "greater",
"value": 30
}
]
}
]
}
}
'const options = {
method: 'PUT',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
is_draft: false,
in_app_message: {
name: 'Welcome offer (updated)',
display_duration: 0,
html: '<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>',
start_time: '2026-11-01T00:00:00Z',
end_time: null,
triggers: [{conditions: [{kind: 'session_time', operator: 'greater', value: 30}]}]
}
})
};
fetch('https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}"
payload = {
"is_draft": False,
"in_app_message": {
"name": "Welcome offer (updated)",
"display_duration": 0,
"html": "<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>",
"start_time": "2026-11-01T00:00:00Z",
"end_time": None,
"triggers": [{ "conditions": [
{
"kind": "session_time",
"operator": "greater",
"value": 30
}
] }]
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'is_draft' => false,
'in_app_message' => [
'name' => 'Welcome offer (updated)',
'display_duration' => 0,
'html' => '<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>',
'start_time' => '2026-11-01T00:00:00Z',
'end_time' => null,
'triggers' => [
[
'conditions' => [
[
'kind' => 'session_time',
'operator' => 'greater',
'value' => 30
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}"
payload := strings.NewReader("{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.put("https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.onesignal.com/apps/{app_id}/in_app_messages/{id}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<authorization>");
request.AddJsonBody("{\n \"is_draft\": false,\n \"in_app_message\": {\n \"name\": \"Welcome offer (updated)\",\n \"display_duration\": 0,\n \"html\": \"<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>\",\n \"start_time\": \"2026-11-01T00:00:00Z\",\n \"end_time\": null,\n \"triggers\": [\n {\n \"conditions\": [\n {\n \"kind\": \"session_time\",\n \"operator\": \"greater\",\n \"value\": 30\n }\n ]\n }\n ]\n }\n}", false);
var response = await client.PutAsync(request);
Console.WriteLine("{0}", response.Content);
false{
"success": true,
"payload": {
"id": "2c5c6b7e-0f6d-4a5e-9a2b-1a2b3c4d5e6f"
}
}{
"success": false,
"errors": [
"start_time is required.",
"end_time is required. Send null for a message with no end time.",
"triggers is required. Send [] for a message shown on app open."
]
}{
"errors": [
"Access denied. Please include an 'Authorization: ...' header with a valid API key (https://documentation.onesignal.com/docs/en/keys-and-ids#api-keys)."
]
}{
"errors": [
"Current user permissions do not allow this action."
]
}{
"success": false,
"errors": [
"In-App Message not found"
]
}{
"success": false,
"errors": [
"Commit rejected: a concurrent edit has already been committed. Please refresh and retry."
]
}{
"success": false,
"errors": [
"Commit failed: your editing session has expired. Please refresh."
]
}{
"errors": [
"API rate limit exceeded"
],
"limit": "API Per App"
}Overview
Update an existing custom HTML in-app message. This API updates custom HTML in-app messages only. Use this endpoint to change an in-app message’s HTML, schedule, audience, triggers, or redisplay settings, and to publish a draft.An update replaces the whole in-app message. It is not a patch.
html, start_time, end_time, and triggers are required on every request. Read the in-app message with View in-app message first and send the stored values back for anything you are not changing.400 and nothing changes:
- An in-app message built with the Block Editor.
- An in-app message with language variants authored in the dashboard. The API manages an in-app message’s default language only.
How to use this API
Authenticate with your App API Key. The body has two top-level keys:is_draft and in_app_message.
{
"is_draft": false,
"in_app_message": {
"name": "Welcome offer (updated)",
"display_duration": 0,
"html": "<!doctype html><html><body><h1>Welcome!</h1><p>25% off your first order.</p></body></html>",
"start_time": "2026-11-01T00:00:00Z",
"end_time": null,
"triggers": [
{ "conditions": [{ "kind": "session_time", "operator": "greater", "value": 30 }] }
]
}
}
Draft or publish
is_draft is required and sets whether the in-app message is live after the update.
is_draft: trueleaves the in-app message paused, and pauses it if it was live.is_draft: falsepublishes the in-app message, including an in-app message that was paused before this update.
is_draft at the top level of the body, beside in_app_message. A missing key, null, or an is_draft nested inside in_app_message is rejected with a 400 and nothing changes.
Required and optional fields
| Field | Required | How to keep the stored value |
|---|---|---|
name | Yes | Send the stored value. |
display_duration | Yes | Send the stored value. |
html | Yes | Send the stored value. Every update stores a new version of the HTML. |
start_time | Yes | Send the stored value. |
end_time | Yes | Send the stored value, or null for no end. The key must be present. |
triggers | Yes | Send the stored trigger sets, or [] to show the in-app message on app open. The key must be present and must be an array. |
redisplay_delay, redisplay_limit | No | Omit both to keep the stored pair. Send both as integers to change them, or both as null to show the in-app message once. |
included_segment_ids, excluded_segment_ids | No | Omit the key to keep the stored list. Send [] to clear it. |
id values of trigger sets and conditions change. You can send the id values back or omit them.
Triggers, redisplay settings, and limits follow the same rules as Create in-app message. An update keeps the in-app message’s dashboard labels.
Removed clickable elements
OneSignal keeps the stats of clickable elements that an update removes from the HTML. An in-app message can hold up to 100 removeddata-onesignal-unique-label values. An update that would exceed 100 is rejected with a 400. Create a new in-app message to continue.
Permissions
An API key can update and publish in-app messages in its app. A request made with an OAuth access token, such as through the OneSignal MCP server, acts with the role of the signed-in user. A role that can edit in-app messages but cannot activate them, such as Composer, can save withis_draft: true. With is_draft: false, that role receives a 403 when the in-app message is paused or is currently live.
Response
A successful request returns200 OK with the id of the in-app message:
{
"success": true,
"payload": { "id": "2c5c6b7e-0f6d-4a5e-9a2b-1a2b3c4d5e6f" }
}
A
429 rate limit response uses a different shape from the other errors on this endpoint. It has no success key and adds a limit key that names the rate limit: { "errors": ["API rate limit exceeded"], "limit": "API Per App" }. See Rate limits.Headers
Your App API key with prefix Key. See Keys & IDs.
Path Parameters
Your OneSignal App ID in UUID v4 format. See Keys & IDs.
Body
application/json
Was this page helpful?