Create a push template

API at a glance

Description: This API creates a new push notification template in your Blueshift account. You can specify the template content, target devices (iOS/Android/both), recommendation schemes, external fetches, and other campaign behavior properties.

Authentication & testing

Testing the API on this page

How to try it here

  • Use your User API Key as the Username (leave Password blank).
  • Select the appropriate API endpoint based on your Blueshift region.
  • API - Select Region
  • Enter the necessary parameters and click Try It to run the request.
Authentication using Base64 encoding

Note for developers

API requests require authentication using HTTP Basic Authentication with an API key. The API key serves as the username, while the password field should be left empty. The format to encode is: your_api_key: (note the trailing colon).

This string must be Base64-encoded and included in the request's Authorization header as follows:

Authorization: Basic encoded_value

You can generate the encoded value using a trusted Base64 encoder.


Postman collection

Try it with Postman: Explore the API using Blueshift's Postman collection.


Things to know before you start

  • Required fields: push_template (with name, content, skip_user_on_external_fetch_error) and template_property (with skip flags) are required.
  • Message type: Only json message type is supported.
  • Device targeting: Choose apple, android, or both (default).
  • JSON payload: The content field should contain the JSON payload for push notifications. Leave GCM payload empty for iOS-only notifications, or leave APNs payload empty for Android-only notifications.
  • Recommendation schemes: Use account_algorithm_uuid to add recommendation schemes. Send null to remove existing schemes.
  • Tag data: Tags must already exist in your account. Format: folder_name:tag1,tag2,tag3.
  • Use case: Best for programmatically creating push templates, automating template setup, and bulk template creation.

Request parameters

Check out the request parameters

Body parameters

ParameterTypeRequiredDescription
push_templateobject✅ YesPush template object. See structure below.
template_propertyobject✅ YesCampaign behavior properties. See structure below.
external_fetchesarray❌ NoArray of external fetch UUIDs to integrate external data sources.
transaction_mixinsarray❌ NoArray of transaction mixin UUIDs.

Push template object

ParameterTypeRequiredDescription
namestring✅ YesSpecify the name of the template.
contentstring✅ YesSpecify the JSON payload of the notification. Leave GCM empty for iOS-only, APNs empty for Android-only.
skip_user_on_external_fetch_errorboolean✅ YesMessage is not sent if external fetch encounters an error. Default: true.
authorstring❌ NoSpecify the email address of the template's author.
message_typestring❌ NoOnly json is supported. Default: json.
device_typestring❌ NoTarget device: apple, android, or both. Default: both.
tag_datastring❌ NoFolder and tags in format folder_name:tag1,tag2,tag3. Tags must exist in your account.

Template property object

ParameterTypeRequiredDescription
skip_user_on_blank_productsboolean✅ YesSkip user if products are blank. Default: true.
skip_user_on_blank_event_productsboolean✅ YesSkip user if event products are blank. Default: true.
account_algorithm_uuidstring❌ NoRecommendation scheme UUID. Leave blank for no change, send null to remove existing scheme.

Example requests & responses

Create a push template

Request

curl --request POST \
     --url https://api.getblueshift.com/api/v1/push_templates.json \
     --header 'accept: application/json' \
     --header 'authorization: Basic <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '{
       "push_template": {
         "name": "Summer Rush",
         "author": "[email protected]",
         "message_type": "json",
         "device_type": "apple",
         "content": "{\"GCM\":{\"notification\":{\"title\":\"Notification Content\"}},\"APNS\":{\"aps\":{\"alert\":\"Hello world, now we'\''re cookin!\"}}}",
         "tag_data": "Regions:USA,China,Brazil,Hong Kong,India,Sweden,Canada",
         "skip_user_on_external_fetch_error": true
       },
       "template_property": {
         "skip_user_on_blank_products": true,
         "skip_user_on_blank_event_products": true,
         "account_algorithm_uuid": "2879b1a3-ee84-4e13-b63c-ad83674c0ca1"
       },
       "external_fetches": [
         {
           "uuid": "e789705f-3eb3-4e2a-a666-648dedae6g86"
         }
       ]
     }'

Response

{
  "status": "OK",
  "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Body Params

Specify the details of the push template.

push_template
object
required
template_property
object
required
external_fetches
array of objects
external_fetches
transaction_mixins
array of objects
transaction_mixins
Responses
200

OK

Language
Credentials
Basic
base64
:
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json