Skip to main content
PATCH
/
templates
/
{template_id}
?app_id=
{app_id}
Update template
curl --request PATCH \
  --url 'https://api.onesignal.com/templates/{template_id}?app_id={app_id}' \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "YOUR_TEMPLATE_NAME",
  "contents": {
    "en": "<string>"
  },
  "isEmail": true,
  "email_body": "<string>",
  "isSMS": true,
  "dynamic_content": "{\"campaign_id\": {\"A\": {\"title\": \"Custom Title A\", \"message\": \"Custom Message A\", \"url\": \"https://www.onesignal.com\"}, \"B\": {\"title\": \"Custom Title B\", \"message\": \"Custom Message B\", \"url\": \"https://www.onesignal.com/login\"}}}"
}'
{
  "id": "15b739e8-93f9-4840-8c94-e115c30afddd",
  "name": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "channel": "<string>",
  "content": {
    "isAndroid": "<any>",
    "isIos": "<any>",
    "isMacOSX": false,
    "isAdm": "<any>",
    "isAlexa": "<any>",
    "isWP": "<any>",
    "isWP_WNS": "<any>",
    "isChrome": false,
    "isChromeWeb": true,
    "isSafari": true,
    "isFirefox": true,
    "isEdge": true,
    "headings": {},
    "subtitle": "<any>",
    "contents": {
      "en": "<string>"
    },
    "global_image": "<any>",
    "url": "<any>",
    "isEmail": true,
    "email_body": "<string>",
    "email_subject": "<string>",
    "email_preheader": "<any>",
    "isSMS": true,
    "sms_from": "<any>",
    "sms_media_urls": "<any>",
    "email_reply_to_address": "<any>",
    "disable_email_click_tracking": "<any>"
  }
}

Overview

This endpoint allows you to update an existing push, email, or SMS template in your OneSignal app. Once updated, the changes are applied immediately and reflected across both the Dashboard and API when using the associated template_id. Templates are updated using the same structure as when creating templates.
See Templates for more information.

How to use this API

To update a template, you must supply:
  • Your OneSignal App ID found in Keys & IDs.
  • The Template ID

Template ID

Each template has a unique OneSignal-generated template_id (UUID v4). You can find it:
  • Using the View Templates API
  • In the OneSignal Dashboard under Messages > Templates > Options > Copy Template ID
Copy Template ID in OneSignal Dashboard

Copy Template ID


Channel-Specific Requirements

Push Templates

  • The contents property must use the en (English) key along with other languages you want to support.
  • All Push Notification Properties are valid.
  • All platforms are enabled by default. To limit, explicitly enable desired ones (e.g., isAndroid: true disables iOS and Web).

Email Templates

SMS Templates


Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Path Parameters

template_id
string
default:YOUR_TEMPLATE_ID
required

Query Parameters

app_id
string
default:YOUR_APP_ID
required

Body

application/json
name
string
default:YOUR_TEMPLATE_NAME
required
contents
object
isEmail
boolean
email_body
string
isSMS
boolean
dynamic_content
object
Example:

Response

id
string
Example:
name
string
created_at
string
updated_at
string
channel
string
content
object