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\",\n  \"name\": \"updated name\",\n  \"created_at\": \"2024-10-07T15:10:35Z\",\n  \"updated_at\": \"2024-10-10T15:10:21Z\",\n  \"channel\": \"push\",\n  \"content\": {\n      \"isAndroid\": null,\n      \"isIos\": null,\n      \"isMacOSX\": false,\n      \"isAdm\": null,\n      \"isAlexa\": null,\n      \"isWP\": null,\n      \"isWP_WNS\": null,\n      \"isChrome\": false,\n      \"isChromeWeb\": true,\n      \"isSafari\": true,\n      \"isFirefox\": true,\n      \"isEdge\": true,\n      \"headings\": {},\n      \"subtitle\": null,\n      \"contents\": {\n          \"en\": \"Updated English Message\"\n      },\n    \"global_image\": null,\n    \"url\": null,\n    \"isEmail\": null,\n    \"email_body\": null,\n    \"email_subject\": null,\n    \"email_preheader\": null,\n    \"isSMS\": null,\n    \"sms_from\": null,\n    \"sms_media_urls\": null,\n    \"email_reply_to_address\": null,\n    \"disable_email_click_tracking\": null\n  }}"

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 (UUID)

Template ID

The template_id is a UUID that uniquely identifies the template.

You can find it in the following ways:

  • Use the View Templates API.
  • In the OneSignal Dashboard under Messages > Templates:
    • Use Options > Copy Template ID

      Copy Template ID

    • View it directly in the template URL

      Template ID in the URL


Channel-Specific Requirements

Push Templates

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

Response

200
application/json

200

The response is of type object.