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

Your App API key with prefix Key. See Keys & IDs.

Path Parameters

template_id
string
default:YOUR_TEMPLATE_ID
required

The template ID in UUID v4 format. See Templates.

Query Parameters

app_id
string
default:YOUR_APP_ID
required

Your OneSignal App ID in UUID v4 format. See Keys & IDs.

Body

application/json
name
string
default:YOUR_TEMPLATE_NAME
required

An internal name you set to help organize and track Templates. Maximum 128 characters.

contents
object

The main message body with language-specific values. Supports Message Personalization.

isEmail
boolean

Required to be set true for email templates.

email_body
string

The body of the email in HTML format. Required for email templates. Supports Message Personalization.

isSMS
boolean

Required to be set true for SMS templates.

dynamic_content
object

Add personalization to your templates programmatically. No need to upload a CSV. See Dynamic Content for details.

Example:

"{\"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\"}}}"

Response

200

id
string

The ID of the template in UUID v4 format.

Example:

"15b739e8-93f9-4840-8c94-e115c30afddd"

name
string

An internal name you set to help organize and track Templates. Maximum 128 characters.

created_at
string

The date and time the template was created in ISO 8601 format.

updated_at
string

The date and time the template was last updated in ISO 8601 format.

channel
string

Options are: push, email, and SMS.

content
object